NAME

Games::Sudoku::Component::Result

SYNOPSIS

use Games::Sudoku::Component::Result;

# verbose
my $verbose = 1;

sub some_function {
  my $return_code = 1;

  if ($verbose) {
    return Games::Sudoku::Component::Result->new(
      result => $code,
      reason => 'more descriptive error message',
    );
  }
  else {
    return $code;
  }
}

# Then, check the result. 

if (my $result = &some_function) {
  print ref $result ? $result->{reason} : 'something has happened';
}

DESCRIPTION

This module is mainly for debugging. Use this for a normal scalar return code, and you can get more detailed or additional information about it.

METHODS

new (scalar or hash or hashref)

Options are:

result

Something you'd like to return.

reason

Debug message, error code, or something like that.

If there is only one argument, it is supposed to be a result code.

result

reason

Returns the values stored when the object was created, respectively.

AUTHOR

Kenichi Ishigaki, <ishigaki@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2006 by Kenichi Ishigaki

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.