Games::Sudoku::Component::Controller::Loader
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; }
This module loads and parses puzzle data from file or scalar (reference) and returns an array of Games::Sudoku::Component::Table::Item objects.
Loads and parses puzzle data from file or scalar (reference), and then, returns an array of Games::Sudoku::Component::Table::Item objects.
Hash options are:
file
Filename for puzzle data.
Scalar of puzzle data.
Scalar reference of puzzle data.
Column separator is whitespaces. Row separator is line breaks. Other characters are treated as number, i.e. [^1-9] = 0.
Kenichi Ishigaki, <ishigaki@cpan.org>
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.
To install Games::Sudoku::Component, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Games::Sudoku::Component
CPAN shell
perl -MCPAN -e shell install Games::Sudoku::Component
For more information on module installation, please visit the detailed CPAN module installation guide.