Acme-InputRecordSeparatorIsRegexp
    
    
  
  
  
view release on metacpan or search on metacpan
Revision history for Acme-InputRecordSeparatorIsRegexp
0.01	2013-10-05
	First version, released on an unsuspecting world.
0.02	2013-10-07
	Allow a qr// expression to be used to specify the record separator.
	Add  chomp  method and  autochomp  attribute/feature
0.03	2013-11-01
	<v5.14 compatibility changes in t/01
	bug fix to allow look-behinds to be used sometimes
0.04	2018-08-13
	Custom  open  function which support  :irs(REGEXP)  layer to set
	record separator. Previous functionality of  open  function is retired.
	Support  autochomp  and  input_record_separator  functions on arbitrary
	filehandles, possibly tie-ing them to this package as a side-effect.
0.05	2018-08-28
	Test fixes for MSWin32
lib/Acme/InputRecordSeparatorIsRegexp.pm view on Meta::CPAN
Overrides Perl's builtin L<binmode|perlfunc/"binmode"> function. 
If the I<pseudo-layer> C<:irs(...)> is specified, then apply the 
given regular expression as the dynamic input record separator for 
the given filehandle.
Any other layers specified are passed to Perl's builtin C<binmode>
function.
=head2 input_record_separator
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" >>.
lib/Acme/InputRecordSeparatorIsRegexp.pm view on Meta::CPAN
associated with the tied file handle. Use the construction
C<< tied(*$fh)->chomp(...) >> to perform the chomp operation on
a filehandle that has customized its input record separator with
this package. Or see the L<< C<autochomp>|"autochomp" >> method
to automatically get chomped input.
Please report any bugs or feature requests to 
C<bug-acme-inputrecordseparatorisregexp at rt.cpan.org>, or through
the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Acme-InputRecordSeparatorIsRegexp>.  
I will be notified, and then you'll
automatically be notified of progress on your bug as I make changes.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
    perldoc Acme::InputRecordSeparatorIsRegexp
You can also look for information at:
t/09-autochomp.t view on Meta::CPAN
    push @tell, tell($fh);
    if (@seek > 1) {
	ok( $seek[-2] !~ /[\r\n]$/, 'line ending was chomped' )
	    or diag $seek[-2], "\n\n", $seek[-1],
	    "\n\n", length($seek[-2]),"\t",length($seek[-1]);
	ok( length($seek[-2]) == 9999, 'autochomped line length' );
	my $x = $seek[-2];
	my $u = tied(*$fh)->chomp($x);
	ok($u==0, 'chomp return value for already chomped');
	ok($x eq $seek[-2], 'already chomped line not changed');
    }
}
# don't close
while (@seek) {
    my $i = int(rand(@seek));
    my $t = splice @tell, $i, 1;
    my $s = splice @seek, $i, 1;
    seek($fh, $t, 0);
t/09b-autochomp.t view on Meta::CPAN
    push @tell, tell($fh);
    if (@seek > 1) {
	ok( $seek[-2] !~ /[\r\n]$/, 'line ending was chomped' )
	    or diag $seek[-2], "\n\n", $seek[-1],
	    "\n\n", length($seek[-2]),"\t",length($seek[-1]);
	ok( length($seek[-2]) == 9999, 'autochomped line length' );
	my $x = $seek[-2];
	my $u = tied(*$fh)->chomp($x);
	ok($u==0, 'chomp return value for already chomped');
	ok($x eq $seek[-2], 'already chomped line not changed');
    }
}
# don't close
while (@seek) {
    my $i = int(rand(@seek));
    my $t = splice @tell, $i, 1;
    my $s = splice @seek, $i, 1;
    seek($fh, $t, 0);
( run in 0.339 second using v1.01-cache-2.11-cpan-5dc5da66d9d )