Skip Menu |

This queue is for tickets about the Archive-Cpio CPAN distribution.

Report information
The Basics
Id: 31686
Status: resolved
Worked: 15 min
Priority: 0/
Queue: Archive-Cpio

People
Owner: Nobody in particular
Requestors: rhomel.chinsio [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.06
Fixed in: (no value)



Subject: read method does not accept globs
When reading from a file handle instead of a file name, the read_with_handler method must be used with not nicely encapsulated perl code in the handler. Example: $cpio->read_with_handler(\*STDIN, sub { my ($e) = @_; push @{$cpio->{list}}, $e; }); It would be more convenient if the read method was modified to accept globs in addition to file names: $cpio->read($filename); $cpio->read(\*STDIN); # in Cpio.pm sub read { my ($cpio, $filename) = @_; my $IN; if (ref($filename) eq 'SCALAR') { open($IN, '<', $filename) or die "can't open $filename: $!\n"; } elsif (ref($filename) eq 'GLOB') { $IN = $filename; } else { die "require SCALAR or GLOB for reading cpio file\n"; } read_with_handler($cpio, $IN, sub { my ($e) = @_; push @{$cpio->{list}}, $e; }); } I have not tested the code. I just wrote it to illustrate the implementation.
done in Archive::Cpio 0.07 thanks!