3 helper script to make life for PerlCE easier.
5 There are different modes for running this script:
6 perl comp.pl --run [any-command-line-arguments]
8 perl comp.pl --do [any-command-line-arguments]
10 perl comp.pl --copy pc:[pc-location] ce:[ce-location]
12 --run executes this build of perl on CE device with arguments provided
13 --run=test will display a predefined messagebox that say everything is ok.
15 --do Executes on local computer command that is presented by arguments
16 immediately following after --do
17 Most reason why you may want to execute script in this mode is that
18 arguments preprocessed to replace [p] occurences into current perl
19 location. Typically it is handy to run
20 perl comp.pl --do cecopy pc:..\lib\Exporter.pm ce:[p]\lib
22 --copy copies file to CE device
23 here also [p] will be expanded to corrent PerlCE path, and additionally
24 when --copy=compact specified then, if filename looks like perl module,
25 then POD will be stripped away from that file
35 # edit value of $inst_root variable to reflect your desired location of
37 my $inst_root = $Config{prefix};
40 # %known_opts enumerates allowed opts as well as specifies default and initial values
47 my %specified_opts = (
48 (map {/^--([\-_\w]+)=(.*)$/} @ARGV), # --opt=smth
49 (map {/^no-?(.*)$/i?($1=>0):($_=>1)} map {/^--([\-_\w]+)$/} @ARGV), # --opt --no-opt --noopt
52 die "option '$_' is not recognized" for grep {!exists $known_opts{$_}} keys %specified_opts;
53 @ARGV = grep {!/^--/} @ARGV;
56 s/\[p\]/$inst_root/g for @ARGV;
59 elsif ($opts{'run'}) {
60 if ($opts{'run'} eq 'test') {
61 system("ceexec","$inst_root\\bin\\perl","-we","Win32::MessageBox(\$].qq(\n).join'','cc'..'dx')");
64 system("ceexec","$inst_root\\bin\\perl", map {/^".*"$/s?$_:"\"$_\""} @ARGV);
67 elsif ($opts{'copy'}) {
68 if ($opts{'copy'} eq 'compact') {
71 s/\[p\]/$inst_root/g for @ARGV;
72 if ($ARGV[0]=~/^pc:/i) {system("cedel",$ARGV[1])}
73 system("cecopy",@ARGV);
82 Author Vadim Konovalov.