Curtis Leach wrote:
> I ran into a nasty bug with Archive::Tar under Windows. I want to
> extract the files to a particular location, but whenever I run it,
> instead of putting the results on drive "D:", it put's it on drive
> "C:", where the program is running. After mucking through Tar.pm, I
> found it throws away the drive information. (Which finally allowed
> me to notice where my test program was extracting the files to when
> they were not showing up in the current directory or in the expected
> location.) So my question is this, is there a Perl command to change
> what drive you are on after you start your program? I hate writing
> OS specific code, but this bug is forcing me into this.
>
>
> use strict;
> use Archive::Tar
> my $tar = Archive::Tar->new ("C:\\TAR\\mydata.tar", 0);
> my $tar_dir = "D:\\Results";
> my @names = $tar->list_files ();
> foreach (@names)
> {
> my $file = File::Spec->catfile (($tar_dir), basename ($_));
> print "Found File: $_ ($file)\n";
> my $res = $tar->extract_file ($_, $file);
> print "Result($res)\n";
> }
Have you tried chdir?
chdir('d:/MyDir');
(Perl will convert the slashes for you as necessary)
--
Bowie
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs