in reply to Turn your script into binary without a compiler! :-P

I like your idea. Here are my comments.

I think recompiling a perl is overkill in your case. I had similar solution, and I suggest you can get a couple ideas from my node: perl scripts executor on Win32

I think if we'll mix both ideas, we could get much simplier and flexible solution.

Now improvements that I want to suggest to your idea and code.

Courage, the Cowardly Dog.

Replies are listed 'Best First'.
Re: Re: Turn your script into binary without a compiler! :-P
by gmpassos (Priest) on Jul 24, 2002 at 19:38 UTC
    I made in this way, with string to change inside the 
    binary, because if this string are not changed, starting 
    with #, the binary will work like the normal perl.exe
    
    Since this is made for HWXperl, when I delivery hwxperl I 
    can get any binary of the release and turn into a script! I 
    made this with miniperl.exe too, where you don't need the 
    perllib in the same directory.
    
    I don't understand what you means with 
    "I don't think you need my @ARGS = @ARGV. Just work 
    directly with @ARGV". Are you talking about the 'char argv' 
    on the C code? If is about this, I just made in the most 
    simple and portable way, because some compilers don't deal 
    with argv equally.
    
    about '$^O=~/(msw|win|dos)/', yes is not very pretty, but 
    here, when the binary can't find it self, I will put all 
    the options to fix this in any OS, here are only for Win32.
    I saw one time a vendor with 'MSwin' in the $^O, but I 
    think this is too old. Seeing again the table, I will 
    change this line...
    
        OS            $^O        $Config{'archname'}
        --------------------------------------------
        MS-DOS        dos
        PC-DOS        dos
        OS/2          os2
        Windows 95    MSWin32    MSWin32-x86
        Windows 98    MSWin32    MSWin32-x86
        Windows NT    MSWin32    MSWin32-x86
        Windows NT    MSWin32    MSWin32-ALPHA
        Windows NT    MSWin32    MSWin32-ppc
    
    I will see your code on 'perl scripts executor on Win32'. 
    Thanks for the link, and the reply...
    
    "The creativity is the expression of the liberty".