Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi

I am using the Archive::Rar module to unrar a file and then extract it to user defined folder. But it is extracting in the cwd even when i have given to=>'diretory'. PLz help in extracting to user defined folder

my $archive= 'text-test.rar'; my $destinationDirectory = 'C:/tmp'; my $rar = Archive::Rar->new( -archive => $archive ); foreach my $member ($rar->List( )) { $member = $rar->Extract( to => '$destinationDirectory');

Also i cannot make this module work on a 64 bit windows machine. Is it not 64bit compliant ? Also how to specify user defined folder to extract?

Replies are listed 'Best First'.
Re: Help with Archive::Rar
by Corion (Patriarch) on Apr 10, 2012 at 09:03 UTC

    Where did you find the to option documented in Archive::Rar? I see no such documentation in the ->Extract method.

      If we cannot use to=> then how can i extract it to some directory of our choice??

        Maybe see chdir and change the directory to a directory where you want to extract to?

        Or maybe make some more stuff up and create a text file which contains the name of the directory where you want to extract to?

        Personally, I recommend reading the source code of Archive::Rar and finding out how to pass options to the underlying rar executable and specify the target directory there.

Re: Help with Archive::Rar
by CountZero (Bishop) on Apr 10, 2012 at 21:35 UTC
    Archive::Unrar has the output_dir_path parameter.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics

      IT has a prerequisite of unrar.dll being installed

        Hardly surprising, Archive::Rar has an external dependency also you know.

        Yes, but it is well explained how to do it.

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

        My blog: Imperial Deltronics