I find that 'chdir' does not seem to work (at least regarding
Win32::File::MoveFileEx) in a compiled app. The following script works as
expected when run as a script no matter which drive or directory is current
when it is run. When run as an EXE, it does not work unless run from
"C:\temp":

        #!c:/Programs/perl5.6/bin/perl -w
        use strict;
        use Win32API::File 0.02 qw( :MOVEFILE_  MoveFileEx );
        use Win32;

        chdir "c:\\temp" || die "Cannot chdir: $!";


        print "working directory now:", Win32::GetCwd, "\n";


        my @files = glob( "*" );
        die "No files in c:\\temp!\n"
            unless $#files >= 0;

        print "Files are:\n\t";
        print join( "\n\t", @files), "\n";

        # now try to move the first file in the list
        MoveFileEx( $files[0], $files[0].".xxxx",
                    MOVEFILE_REPLACE_EXISTING | 
                    MOVEFILE_COPY_ALLOWED |
                    MOVEFILE_WRITE_THROUGH )
            or  die "Can't move $files[0] to $files[0].xxxx: $^E\n";

        print "Just moved $files[0] to $files[0].xxxx\n";

This is Perl 5.6.1 (build 628) and Perlapp 2.1 (build 2.1.0.210)

Administrivia: Should I submit this as a bug or should I assume that someone
from ActiveState will do so if they decide it is a bug?

thanks,
hank

--
Hank Barta
At The Hull Group, Chicago
(312) 655-4636


_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl

Reply via email to