OK, I'm a newbie; so please don't laugh too loud or flame me here, but this one is driving me crazy.
The goal here is to be able to pass /? to my perl app as a command line arg and have it return the text that follows __DATA__. To save space, I've only listed the pertinent code. And yes, I've tested this portion only with the same results.
The following code works:
use strict;
package SAR;
&get_args (@ARGV);
sub get_args {
my @help = <DATA>;
($ARGV[0] eq "/?") && (die @help);
}
return 1;
__DATA__
testing 1
testing 2
testing 3
When ran as c:>test.pl /?
It returns:
testing 1
testing 2
testing 3
as expected.
However, after turning it into an exe with perlapp it no longer works. Running c:>test.exe /? will return "Died at test.pl line 8." unless I wrap the @help array in quotes, then it just returns a few blank lines and goes back to the prompt.
I've tried including the package (i.e. SAR::DATA) thinking it might have something to do with the fact that perlapp is adding a lot of other modules and maybe it's getting confused about which module to pull DATA from, but that didn't work. It gives the same results.
I promise I've done my homework. I searched this website, activestates documentation, perldoc, and several books on perl. I just can't find an answer anywhere. Any insight here would be greatly appreciated.
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.