Skip to content

Commit

Permalink
Starting work on moving the data fetching routines into their own module
Browse files Browse the repository at this point in the history
  • Loading branch information
ranginui committed Jul 13, 2012
1 parent 562b75e commit 869a945
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions lib/KC/Data.pm
@@ -0,0 +1,48 @@
package KC::Data;

use 5.010001;
use strict;
use warnings;

require Exporter;

our @ISA = qw(Exporter);

# This allows declaration use KC::Data ':all';
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
# will save memory.
our %EXPORT_TAGS = (
'all' => [
qw(
get_dates
)
]
);

our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );

our @EXPORT = qw(
);

our $VERSION = '0.01';

sub get_dates {

# subroutine to parse a date file and put it into a form suitable for TT
open( my $FH, '<', 'data/dates.txt' );
my @dates;
while ( my $line = <$FH> ) {
my ( $date, $desc ) = split( '|', $line );
my $daterow = {
'date' => $date,
'desc' => $desc
} push @dates, $daterow;
}
close $FH;
return \@dates;

}

1;
__END__

0 comments on commit 869a945

Please sign in to comment.