On Sun, Dec 21, 2014 at 11:36 AM, Bagdevi <bagdevi.mis...@gmail.com> wrote:

> Hello Pradeep and Angan,
> I had a similar situation, where I was calling a perl script (B) from the
> compiled executable (A) and, as it is happening with you, it did ...
> 1// first I compiled the perl code (B) individually and make the
> executable.
> 2// from perl script (A) I called the executable for (B) (not the perl
> code (B)).
> 3// I packed the executable (B) along with (A) while compiling (A).
> This, at the end, takes up much space as it bundles up most of the needed
> packages twice, but at least it works that's way.
>

You can bundle multiple Perl scripts inside the generated executable. Make
the base name of the executable the same as the primary script. (If a.pl is
the primary, then name the executable a (or a.exe for MS Windows).)

You can invoke b.pl from a.pl with:

    my $progb = $0;
    $0 =~ s/a\.pl/b\.pl/;
    do $progb;

Also, FYI, in a Linux/Unix/POSIX environment, you can create links to the
executable, each one named for the bundled script to be executed. Example:

    ln -s a b
    # run a
    a
    # run b
    b

In a MS Windows environment, you have to make additional copies of the
executable, however, the same behavior applies: Whichever name the
executable is invoked by, that is the script that will run.

Reply via email to