ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/App-Staticperl/staticperl.pod
(Generate patch)

Comparing App-Staticperl/staticperl.pod (file contents):
Revision 1.36 by root, Fri Feb 11 01:05:37 2011 UTC vs.
Revision 1.37 by root, Thu Feb 24 07:01:46 2011 UTC

20 20
21Typical Examples: 21Typical Examples:
22 22
23 staticperl install # fetch, configure, build and install perl 23 staticperl install # fetch, configure, build and install perl
24 staticperl cpan # run interactive cpan shell 24 staticperl cpan # run interactive cpan shell
25 staticperl mkperl -M '"Config_heavy.pl"' # build a perl that supports -V 25 staticperl mkperl -MConfig_heavy.pl # build a perl that supports -V
26 staticperl mkperl -MAnyEvent::Impl::Perl -MAnyEvent::HTTPD -MURI -MURI::http 26 staticperl mkperl -MAnyEvent::Impl::Perl -MAnyEvent::HTTPD -MURI -MURI::http
27 # build a perl with the above modules linked in 27 # build a perl with the above modules linked in
28 staticperl mkapp myapp --boot mainprog mymodules 28 staticperl mkapp myapp --boot mainprog mymodules
29 # build a binary "myapp" from mainprog and mymodules 29 # build a binary "myapp" from mainprog and mymodules
30 30
252 252
253 # first make sure we have perl and the required modules 253 # first make sure we have perl and the required modules
254 staticperl instcpan AnyEvent::HTTPD 254 staticperl instcpan AnyEvent::HTTPD
255 255
256 # now build the perl 256 # now build the perl
257 staticperl mkperl -M'"Config_heavy.pl"' -MAnyEvent::Impl::Perl \ 257 staticperl mkperl -MConfig_heavy.pl -MAnyEvent::Impl::Perl \
258 -MAnyEvent::HTTPD -MURI::http \ 258 -MAnyEvent::HTTPD -MURI::http \
259 --add 'eg/httpd httpd.pm' 259 --add 'eg/httpd httpd.pm'
260 260
261 # finally, invoke it 261 # finally, invoke it
262 ./perl -Mhttpd 262 ./perl -Mhttpd
381 381
382=over 4 382=over 4
383 383
384=item C<--use> F<module> | C<-M>F<module> 384=item C<--use> F<module> | C<-M>F<module>
385 385
386Include the named module and trace direct dependencies. This is done by 386Include the named module or perl library and trace direct
387C<use>'ing the module from a fresh package in a subprocess and tracing 387dependencies. This is done by loading the module in a subprocess and
388which other modules and files it actually loads. 388tracing which other modules and files it actually loads.
389 389
390Example: include AnyEvent and AnyEvent::Impl::Perl. 390Example: include AnyEvent and AnyEvent::Impl::Perl.
391 391
392 staticperl mkbundle --use AnyEvent --use AnyEvent::Impl::Perl 392 staticperl mkbundle --use AnyEvent --use AnyEvent::Impl::Perl
393 393
394Sometimes you want to load old-style "perl libraries" (F<.pl> files), 394Sometimes you want to load old-style "perl libraries" (F<.pl> files), or
395or maybe other weirdly named files. To do that, you need to quote 395maybe other weirdly named files. To support this, the C<--use> option
396the name in single or double quotes (this is because F<staticperl> 396actually tries to do what you mean, depending on the string you specify:
397I<literally> just adds the string after the C<require> - which acts 397
398different when confronted with quoted vs. unquoted strings). When given on 398=over 4
399the command line, you probably need to quote once more to avoid your shell 399
400interpreting it. Common cases that need this are F<Config_heavy.pl> and 400=item a possibly valid module name, e.g. F<common::sense>, F<Carp>,
401F<utf8_heavy.pl>. 401F<Coro::Mysql>.
402
403If the string contains no quotes, no F</> and no F<.>, then C<--use>
404assumes that it is a normal module name. It will create a new package and
405evaluate a C<use module> in it, i.e. it will load the package and do a
406default import.
407
408The import step is done because many modules trigger more dependencies
409when something is imported than without.
410
411=item anything that contains F</> or F<.> characters,
412e.g. F<utf8_heavy.pl>, F<Module/private/data.pl>.
413
414The string will be quoted and passed to require, as if you used C<require
415$module>. Nothing will be imported.
416
417=item "path" or 'path', e.g. C<"utf8_heavy.pl">.
418
419If you enclose the name into single or double quotes, then the quotes will
420be removed and the resulting string will be passed to require. This syntax
421is form compatibility with older versions of staticperl and should not be
422used anymore.
423
424=back
425
426Example: C<use> AnyEvent::Socket, once using C<use> (importing the
427symbols), and once via C<require>, not importing any symbols. The first
428form is preferred as many modules load some extra dependencies when asked
429to export symbols.
430
431 staticperl mkbundle -MAnyEvent::Socket # use + import
432 staticperl mkbundle -MAnyEvent/Socket.pm # require only
402 433
403Example: include the required files for F<perl -V> to work in all its 434Example: include the required files for F<perl -V> to work in all its
404glory (F<Config.pm> is included automatically by this). 435glory (F<Config.pm> is included automatically by the dependency tracker).
405 436
406 # bourne shell 437 # shell command
407 staticperl mkbundle --use '"Config_heavy.pl"' 438 staticperl mkbundle -MConfig_heavy.pl
408 439
409 # bundle specification file 440 # bundle specification file
410 use "Config_heavy.pl" 441 use Config_heavy.pl
411 442
412The C<-M>module syntax is included as a convenience that might be easier 443The C<-M>module syntax is included as a convenience that might be easier
413to remember than C<--use> - it's the same switch as perl itself uses 444to remember than C<--use> - it's the same switch as perl itself uses
414to load modules. Or maybe it confuses people. Time will tell. Or maybe 445to load modules. Or maybe it confuses people. Time will tell. Or maybe
415not. Sigh. 446not. Sigh.
681Example: create a standalone perl binary called F<./myexe> that will 712Example: create a standalone perl binary called F<./myexe> that will
682execute F<appfile> when it is started. 713execute F<appfile> when it is started.
683 714
684 staticperl mkbundle --app myexe --boot appfile 715 staticperl mkbundle --app myexe --boot appfile
685 716
717=item C<--ignore-env>
718
719Generates extra code to unset some environment variables before
720initialising/running perl. Perl supports a lot of environment variables
721that might alter execution in ways that might be undesirablre for
722standalone applications, and this option removes those known to cause
723trouble.
724
725Specifically, these are removed:
726
727C<PERL_HASH_SEED_DEBUG> and C<PERL_DEBUG_MSTATS> can cause underaible
728output, C<PERL5OPT>, C<PERL_DESTRUCT_LEVEL>, C<PERL_HASH_SEED> and
729C<PERL_SIGNALS> can alter execution significantly, and C<PERL_UNICODE>,
730C<PERLIO_DEBUG> and C<PERLIO> can affect input and output.
731
732The variables C<PERL_LIB> and C<PERL5_LIB> are always ignored because the
733startup code used by F<staticperl> overrides C<@INC> in all cases.
734
735This option will not make your program more secure (unless you are
736running with elevated privileges), but it will reduce the surprise effect
737when a user has these environment variables set and doesn't expect your
738standalone program to act like a perl interpreter.
739
686=item C<--static> 740=item C<--static>
687 741
688Add C<-static> to F<bundle.ldopts>, which means a fully static (if 742Add C<-static> to F<bundle.ldopts>, which means a fully static (if
689supported by the OS) executable will be created. This is not immensely 743supported by the OS) executable will be created. This is not immensely
690useful when just creating the bundle files, but is most useful when 744useful when just creating the bundle files, but is most useful when
1130 1184
1131Some functionality in the utf8 module, such as swash handling (used 1185Some functionality in the utf8 module, such as swash handling (used
1132for unicode character ranges in regexes) is implemented in the 1186for unicode character ranges in regexes) is implemented in the
1133C<"utf8_heavy.pl"> library: 1187C<"utf8_heavy.pl"> library:
1134 1188
1135 -M'"utf8_heavy.pl"' 1189 -Mutf8_heavy.pl
1136 1190
1137Many Unicode properties in turn are defined in separate modules, 1191Many Unicode properties in turn are defined in separate modules,
1138such as C<"unicore/Heavy.pl"> and more specific data tables such as 1192such as C<"unicore/Heavy.pl"> and more specific data tables such as
1139C<"unicore/To/Digit.pl"> or C<"unicore/lib/Perl/Word.pl">. These tables 1193C<"unicore/To/Digit.pl"> or C<"unicore/lib/Perl/Word.pl">. These tables
1140are big (7MB uncompressed, although F<staticperl> contains special 1194are big (7MB uncompressed, although F<staticperl> contains special

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines