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

Am trying to package my diminutive script into an .exe to avoid having to install lots of packages on other machines. 'pp.bat' packs it all into a 4Mb file.

Issue: the resultant .exe runs ok on the dev machine but when put on a diff box it gives several "subroutine <x> redefined" errors for module Win32::Process::List. I do 'use' this module but only via 'use'. I was under the (mistaken) belief that 'use' would throw out duplication attempts for module loads.

Doing a 'grep -ir "Win32::Process::List *" in the unpacked dir shows instances of this module in a .DLL, a .PM and again in a 'inc/' dir.

I tried putting 'no warnings "redefine"' in my code - to no avail.

Suggestions?

Replies are listed 'Best First'.
Re: pp.bat - 'subroutine redefined' errors
by ww (Archbishop) on Aug 25, 2007 at 01:26 UTC

    Perhaps your combo (in your penultimate paragraph) of outer singlequotes and inner doublequotes is merely your idea of an alternative to <c>...</c> tags (Hint: it's NOT!) ...but on the off chance that quoting actually appears in your code, you might want to use
    no warnings 'redefine';.

    BUT when you don't know the cause of a warning (or an error, for that matter), disabling the pragma is NOT the way to go. Find out what's causing the warning before throwing away Perl's attempt to help you.

    You may find it worthwhile to read the thread beginning at subroutines - creating a custom subroutine and 'subroutine redefined' errors... one of many you could have found with Super Search. It may also be helpful to read the replies to Things I don't understand about 'use warnings' from Fletch and friedo.