1 #!/usr/local/bin/perl -w
6 use POSIX qw( :fcntl_h ) ;
7 use Test::More tests => 2 ;
9 # in case SEEK_SET isn't defined in older perls. it seems to always be 0
13 *SEEK_SET = sub { 0 } unless eval { SEEK_SET() } ;
17 use_ok( 'File::Slurp', ) ;
24 skip <<TEXT, 1 if $@ ;
25 B.pm not found in this Perl. This will cause slurping of
26 the DATA handle to fail.
29 test_data_list_slurp() ;
35 sub test_data_list_slurp {
37 my $data_seek = tell( \*DATA );
39 # first slurp in the lines
41 my @slurp_lines = read_file( \*DATA ) ;
43 # now seek back and read all the lines with the <> op and we make
46 seek( \*DATA, $data_seek, SEEK_SET ) || die "seek $!" ;
47 my @data_lines = <DATA> ;
49 # test the array slurp
51 ok( eq_array( \@data_lines, \@slurp_lines ), 'list slurp of DATA' ) ;
62 we can't test long handle slurps from DATA since i would have to type