Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: help with unraring

by nikosv (Chaplain)
on Apr 24, 2012 at 07:41 UTC ( #966756=note: print w/replies, xml ) Need Help??

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

    thanks for the reply. $result gives error -->found in chain.already processed. What does that mean ? How can i remove it?

      is that a multipart file you are trying to extract? you can safely ignore this message;it merely says that the file has been already processed.It is used for caching purposes

        yes it is a multipart file. But the archive is not extracted to the given directory because of this error.

        Also can you tell me how to process each extracted file one at a time such that one file is extracted and its contents are processed for a regex than the next one is processed in similar fashion and so on instead of just extracting in a single go?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://966756]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2018-01-21 05:17 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (227 votes). Check out past polls.