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

When convert the below perl script into exe. It shows: 1. "Attempt to reload DynaLoader.pm aborted." 2. "Compilation failed in require at PERL2EXE_STORAGE/win32.pm line 8." 3. "Compilation failed in require at PERL2EXE_STORAGE/Cwd.pm line 763."
use Cwd 'abs_path'; $dir=abs_path($0); opendir (DIR, $dir) or die $!; my @html_files = grep(/\.html$/, readdir DIR); closedir DIR; foreach my $html_files(@html_files) { $pathName=substr($html_files,0,length($html_files)-4); open(DATA, "<${pathName}html") or die "Couldn't open file file +.txt, $!"; while(<DATA>) { $line.=$_; } . . . open(DATA, ">${pathName}html") or die "Couldn't open file file.txt, $! +"; print DATA $line; $line=""; } closedir(DIR);

Replies are listed 'Best First'.
Re: Compilation Error.
by marto (Cardinal) on Dec 02, 2014 at 12:01 UTC

    Are you sure this is all of your code? IMHO perl2exe is messy, regardless I don't see you using it properly, there's nothing in your code which tells it which modules to include. I suggest you either read the manual (because it's obvious that you have not) or use pp (Super Search for research, use  pp -x, read the documentation) to package your script and it's dependencies.

Re: Compilation Error.
by ww (Archbishop) on Dec 02, 2014 at 12:46 UTC

    Perhaps augmenting marto's on-point observation, please note:
          opendir takes a directory name, not a filename. But with $0, what you get is full\path\to\filename.

    Using strict and warnings is a good idea -- in fact, damn near mandatory unless you have a very specific and knowledgeable reason to omit either or both. They're there to help, and in this case would have advised you "Invalid argument at (your opendir or readdir lines)."