Acme-InputRecordSeparatorIsRegexp

 view release on metacpan or  search on metacpan

lib/Acme/InputRecordSeparatorIsRegexp.pm  view on Meta::CPAN


Returns the current setting, or changes the setting, of a file handle's
input record separator, I<including file handles that have not
already been tied to this package>. This overcomes a limitation
in L<IO::Handle::input_record_separator|IO::Handle/"METHODS">
where input record separators are not supported on a per-filehandle
basis.

With no arguments, returns the input record separator associated
with the file handle. For regular file handles, this is always
the current value of L<< C<$/>|perlvar/"$INPUT_RECORD_SEPARATOR" >>.

    use Acme::InputRecordSeperatorIsRegexp ':all';

    open my $fh_reg, "<", "some_text_file";
    open my $fh_pkg, "<:irs(\d)", "some_text_file";

    $rs = $fh_reg->input_record_separator;    #   "\n"
    $rs = input_record_separator($fh_reg);    #   "\n"
    $rs = $fh_pkg->input_record_separator;    #   '\d'
    $rs = input_record_separator($fh_pkg);    #   '\d'

lib/Acme/InputRecordSeparatorIsRegexp.pm  view on Meta::CPAN


=item * Search CPAN

L<http://search.cpan.org/dist/Acme-InputRecordSeparatorIsRegexp/>

=back


=head1 ACKNOWLEDGEMENTS

L<perlvar|perlvar/"$INPUT_RECORD_SEPARATOR">

=head1 LICENSE AND COPYRIGHT

Copyright 2013-2018 Marty O'Brien.

This program is free software; you can redistribute it and/or modify it
under the terms of the the Artistic License (2.0). You may obtain a
copy of the full license at:

L<http://www.perlfoundation.org/artistic_license_2_0>

t/06-DATA.t  view on Meta::CPAN

    seek(DAT, $t, 0);
    my $u = readline(DAT);

    is( $u, $s, "seek to $t returns same result");
}

done_testing();


__DATA__
0:AAA1:AAB2:AAC3:AAD4:AAE5:AAF6:AAG7:AAH8:AAI9:AAJ10:AAK11:AAL12:AAM13:AAN14:AAO15:AAP16:AAQ17:AAR18:AAS19:AAT20:AAU21:AAV22:AAW23:AAX24:AAY25:AAZ26:ABA27:ABB28:ABC29:ABD30:ABE31:ABF32:ABG33:ABH34:ABI35:ABJ36:ABK37:ABL38:ABM39:ABN40:ABO41:ABP42:ABQ43...

t/06b-DATA.t  view on Meta::CPAN

    seek(DATA, $t, 0);
    my $u = readline(DATA);

    is( $u, $s, "seek to $t returns same result");
}

done_testing();


__DATA__
0:AAA1:AAB2:AAC3:AAD4:AAE5:AAF6:AAG7:AAH8:AAI9:AAJ10:AAK11:AAL12:AAM13:AAN14:AAO15:AAP16:AAQ17:AAR18:AAS19:AAT20:AAU21:AAV22:AAW23:AAX24:AAY25:AAZ26:ABA27:ABB28:ABC29:ABD30:ABE31:ABF32:ABG33:ABH34:ABI35:ABJ36:ABK37:ABL38:ABM39:ABN40:ABO41:ABP42:ABQ43...



( run in 0.691 second using v1.01-cache-2.11-cpan-4e96b696675 )