in reply to help with unraring
list_files_in_archive does not return references to the contained files but just dumps them to stdout. If you need to get the filenames then you must capture the stdout and process it. Instead of forking, use the IO::CaptureOutput module
use Archive::Unrar qw(list_files_in_archive process_file); use IO::CaptureOutput qw(capture); my @files; { local ($stdout, $stderr); capture sub {list_files_in_archive( file=>"C:/perl2exe/For perl 5.10. +1/test.rar" ,undef)}, \$stdout, \$stderr; @files=map {/Archive contents : (.*\.txt$)/ } split ("\n",$stdout); } foreach (@files) { print "file ",++$i," : ",$_,"\n"; }
Also check the $result value to get and indication of the error returned
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: help with unraring
by gautamparimoo (Beadle) on Apr 24, 2012 at 11:23 UTC | |
by nikosv (Deacon) on Apr 24, 2012 at 20:13 UTC | |
by gautamparimoo (Beadle) on Apr 25, 2012 at 05:39 UTC | |
by nikosv (Deacon) on Apr 25, 2012 at 08:22 UTC | |
by gautamparimoo (Beadle) on Apr 25, 2012 at 08:44 UTC | |
|