[Israel.pm] attaching a big data section/file to a script

Roey Almog (Infoneto Ltd) almog at infoneto.co.il
Mon Sep 14 05:43:56 PDT 2009


Hi,

The __DATA__ method is excellent  as long as the text file content is constant.

If the text file contains information that can be changed from time to
time you can encrypt it using Crypt::RC4 or similar module. this way
you will have your "executable" script and an extra encrypted file.
the encryption key will be hidden inside the executable file so it
will not be easy to find. Whenever you need to update the text file
just encrypt it and put it in the same directory of the executable. no
need to recreate all the application. Use FindBin module to find where
is the executable (this works with ActiveState's perlapp not sure when
using other tools).

One more problem with __DATA__  - when using perlapp with modules
containing __DATA__ section we had some problems -
you must use Module::__DATA__ syntax or something similar or you'll
get an error.

Roey

On Mon, Sep 14, 2009 at 8:48 AM, Yossi Itzkovich
<Yossi.Itzkovich at ecitele.com> wrote:
>
> Hi,
>
> I have a script that needs a 400k (55k zipped) text file to come with it. The script reads this file in one of his modules.
> How can I "attach" the text file to the script ?
>
> Another question: Can I encrypt it in some way, so only the script can "read/understand" it ?
>
> BTW: I intend to make the script an executable, if it matters to the answers.
>
> Thanks for your help
>
> Yossi
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://mail.perl.org.il/mailman/listinfo/perl


More information about the Perl mailing list