| 1 | # -*- perl -*- | ||
| 2 | |||
| 3 | # Copyright (c) 2010 AdCopy | ||
| 4 | # Author: Jeff Weisberg | ||
| 5 | # Created: 2010-Jan-26 12:00 (EST) | ||
| 6 | # Function: read files to map | ||
| 7 | # | ||
| 8 | # $Id: ReadInput.pm,v 1.1 2010/11/01 18:41:44 jaw Exp $ | ||
| 9 | |||
| 10 | package AC::MrGamoo::ReadInput; | ||
| 11 | use AC::MrGamoo::Customize; | ||
| 12 | use AC::Import; | ||
| 13 | use strict; | ||
| 14 | |||
| 15 | our @ISA = 'AC::MrGamoo::Customize'; | ||
| 16 | our @EXPORT = qw(readinput); | ||
| 17 | our @CUSTOM = @EXPORT; | ||
| 18 | |||
| 19 | |||
| 20 | 1; | ||
| 21 | |||
| 22 | =head1 NAME | ||
| 23 | |||
| 24 | AC::MrGamoo::ReadInput - read input records | ||
| 25 | |||
| 26 | =head1 SYNOPSIS | ||
| 27 | |||
| 28 | emacs /myperldir/Local/MrGamoo/ReadInput.pm | ||
| 29 | copy. paste. edit. | ||
| 30 | |||
| 31 | use lib '/myperldir'; | ||
| 32 | my $m = AC::MrGamoo::D->new( | ||
| 33 | class_readinput => 'Local::MrGamoo::ReadInput', | ||
| 34 | ); | ||
| 35 | |||
| 36 | =head1 DESCRIPTION | ||
| 37 | |||
| 38 | In your map/reduce job, your C<map> function is called once per record. | ||
| 39 | The C<readinput> function is responsible for reading the actual files | ||
| 40 | and returning records. | ||
| 41 | |||
| 42 | The default C<readinput> returns one line at a time (just like <FILE>). | ||
| 43 | |||
| 44 | If you want different behavior, you can provide a C<ReadInput> class, | ||
| 45 | or spoecify a C<readinput> block in your map/reduce job. | ||
| 46 | |||
| 47 | Your function should return an array of 2 values | ||
| 48 | |||
| 49 | =head2 record | ||
| 50 | |||
| 51 | the record data | ||
| 52 | |||
| 53 | =head2 eof | ||
| 54 | |||
| 55 | have we reached the end-of-file | ||
| 56 | |||
| 57 | |||
| 58 | =head1 BUGS | ||
| 59 | |||
| 60 | none. you write this yourself. | ||
| 61 | |||
| 62 | =head1 SEE ALSO | ||
| 63 | |||
| 64 | AC::MrGamoo | ||
| 65 | |||
| 66 | =head1 AUTHOR | ||
| 67 | |||
| 68 | You! | ||
| 69 | |||
| 70 | =cut |