| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Chess::NumberMoves; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 19723 | use 5.008; | 
|  | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 29 |  | 
| 4 | 1 |  |  | 1 |  | 5 | use strict; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 26 |  | 
| 5 | 1 |  |  | 1 |  | 4 | use warnings; | 
|  | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 135 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | require Exporter; | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | our @ISA = qw(Exporter); | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | # Items to export into callers namespace by default. Note: do not export | 
| 12 |  |  |  |  |  |  | # names by default without a very good reason. Use EXPORT_OK instead. | 
| 13 |  |  |  |  |  |  | # Do not simply export all your public functions/methods/constants. | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | # This allows declaration	use Chess::NumberMoves ':all'; | 
| 16 |  |  |  |  |  |  | # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK | 
| 17 |  |  |  |  |  |  | # will save memory. | 
| 18 |  |  |  |  |  |  | our %EXPORT_TAGS = ( 'all' => [ qw( | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | ) ] ); | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | our @EXPORT = qw( | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  | ); | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | our $VERSION = '0.03'; | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | # Preloaded methods go here. | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | sub from_file { | 
| 34 |  |  |  |  |  |  |  | 
| 35 | 0 |  |  | 0 | 0 |  | my $file = shift; | 
| 36 | 1 |  |  | 1 |  | 687 | use FileHandle; | 
|  | 1 |  |  |  |  | 12040 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 37 | 0 |  |  |  |  |  | my $fh = new FileHandle "< $file"; | 
| 38 | 0 | 0 |  |  |  |  | $fh or die $!; | 
| 39 |  |  |  |  |  |  |  | 
| 40 | 0 |  |  |  |  |  | my @line; | 
| 41 |  |  |  |  |  |  |  | 
| 42 | 0 |  |  |  |  |  | my $line = 1; | 
| 43 | 0 |  |  |  |  |  | my $space = '  '; # 2 spaces to start with | 
| 44 | 0 |  |  |  |  |  | while (<$fh>) { | 
| 45 |  |  |  |  |  |  |  | 
| 46 | 0 | 0 |  |  |  |  | if (/^[A-Z]/i) | 
| 47 |  |  |  |  |  |  | { | 
| 48 |  |  |  |  |  |  |  | 
| 49 | 0 | 0 |  |  |  |  | $line == 10 and $space = ' '; # now one space | 
| 50 | 0 |  |  |  |  |  | $_ = "$line.$space$_"; | 
| 51 | 0 |  |  |  |  |  | ++$line; | 
| 52 |  |  |  |  |  |  | } | 
| 53 |  |  |  |  |  |  |  | 
| 54 | 0 |  |  |  |  |  | push @line, $_; | 
| 55 |  |  |  |  |  |  | } | 
| 56 |  |  |  |  |  |  |  | 
| 57 | 0 |  |  |  |  |  | join '', @line; | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | } | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | 1; | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | __END__ |