/home/cpanrun/depot/main/contrib-patched/perl/CPAN/src/Games-Sudoku-Component/blib/lib/Games/Sudoku/Component/Controller/Loader.pm


NAME

Games::Sudoku::Component::Controller::Loader


SYNOPSIS

  require Games::Sudoku::Component::Controller::Loader;
  # Load from text
  my @cells = Games::Sudoku::Component::Controller::Loader->load(<<'EOT');
  4 . . . . 1
  2 1 . . 5 .
  3 5 1 2 6 .
  1 . . . 3 .
  6 . . 5 1 2
  5 . . . 4 6
  EOT
  # Or load from file
  my @cells = Games::Sudoku::Component::Controller::Loader->load(
    filename => 'file.txt',
  );
  # Or load from scalarref
  my $puzzle =<<'EOT';
  4 . . . . 1
  2 1 . . 5 .
  3 5 1 2 6 .
  1 . . . 3 .
  6 . . 5 1 2
  5 . . . 4 6
  EOT
  my @cells = Games::Sudoku::Component::Controller::Loader->load(\$puzzle);
  # When you finished loading, put the loaded data into a table.
  my $table = Games::Sudoku::Component::Table->new;
  foreach my $item (@cells) {
    $table->cell($item->row,$item->col)->value($item->value);
    $table->cell($item->row,$item->col)->lock if $item->value;
  }


DESCRIPTION

This module loads and parses puzzle data from file or scalar (reference) and returns an array of the Games::Sudoku::Component::Table::Item manpage objects.


METHODS

load (scalar or scalarref or hash or hashref)

Loads and parses puzzle data from file or scalar (reference), and then, returns an array of the Games::Sudoku::Component::Table::Item manpage objects.

Hash options are:

filename (or file, for short)
Filename for puzzle data.

scalar
Scalar of puzzle data.

scalarref
Scalar reference of puzzle data.


DATA STRUCTURE

Column separator is whitespaces. Row separator is line breaks. Other characters are treated as number, i.e. [^1-9] = 0.


SEE ALSO

the Games::Sudoku::Component manpage,
the Games::Sudoku::Component::Controller manpage,
the Games::Sudoku::Component::Table manpage


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.

 /home/cpanrun/depot/main/contrib-patched/perl/CPAN/src/Games-Sudoku-Component/blib/lib/Games/Sudoku/Component/Controller/Loader.pm