ingydotnet / io-all-pm

All in One Perl IO
http://search.cpan.org/dist/IO-All/
38 stars 20 forks source link

IO::All::File/tie should honor separator value #52

Closed EJBivona closed 9 years ago

EJBivona commented 10 years ago

Hi,

In IO::All::File.pm (v0.79), the assert_tied_file() method uses "\n" as the recsep parameter to Tie::File, instead of using the separator() attribute. Given that default, tied access to a file is of limited utility.

Please consider the following patch to change this behavior.

-Eric

*** File.pm-orig    2014-09-12 08:33:44.679184141 -0400
--- File.pm 2014-09-12 08:37:08.562962450 -0400
***************
*** 66,72 ****
          my $array_ref = do { my @array; \@array };
          my $name = $self->pathname;
          my @options = $self->_rdonly ? (mode => O_RDONLY) : ();
!         push @options, (recsep => "\n");
          tie @$array_ref, 'Tie::File', $name, @options;
          $self->throw("Can't tie 'Tie::File' to '$name':\n$!")
            unless tied @$array_ref;
--- 66,72 ----
          my $array_ref = do { my @array; \@array };
          my $name = $self->pathname;
          my @options = $self->_rdonly ? (mode => O_RDONLY) : ();
!         push @options, (recsep => $self->separator);
          tie @$array_ref, 'Tie::File', $name, @options;
          $self->throw("Can't tie 'Tie::File' to '$name':\n$!")
            unless tied @$array_ref;
frioux commented 9 years ago

done, will release shortly