You've already been told about the eval/require dance, which I won't repeat. Instead, I'll tell you about a similar problem I had recently and how I solved it. It involves an app I'm writing for the Palm, which needs a lot of data to work with. I'm writing my app in C, but fetching the data and mangling it into an appropriate format using perl.
I did briefly consider using my perl script to mangle the data into C source code and then #include it into my C program. That would certainly make the task easier as I wouldn't have to mess around with databases. However, it would mean that users would have to rebuild the program to update the data, and would also lead to resource "issues". Instead, I did The Right Thing, and my perl script instead spews out a few PDBs using Palm::Raw (which whilst it is listed on CPAN and downloadable through a browser, CPAN.pm didn't want to install for me, but that's irrelevant here). And my C code opens those databases and uses them.
Of course, most of the reasons for me using PDBs are irrelevant to your perl program, but you might like to consider using something like dbm files instead. It seems somehow more elegant :-)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.