App-Staticperl
view release on metacpan or search on metacpan
staticperl mkperl -MConfig_heavy.pl # build a perl that supports -V
staticperl mkperl -MAnyEvent::Impl::Perl -MAnyEvent::HTTPD -MURI -MURI::http
# build a perl with the above modules linked in
staticperl mkapp myapp --boot mainprog mymodules
# build a binary "myapp" from mainprog and mymodules
DESCRIPTION
This script helps you to create single-file perl interpreters or
applications, or embedding a perl interpreter in your applications.
Single-file means that it is fully self-contained - no separate shared
objects, no autoload fragments, no .pm or .pl files are needed. And when
linking statically, you can create (or embed) a single file that
contains perl interpreter, libc, all the modules you need, all the
libraries you need and of course your actual program.
With uClibc and upx on x86, you can create a single 500kb binary that
contains perl and 100 modules such as POSIX, AnyEvent, EV, IO::AIO, Coro
and so on. Or any other choice of modules (and some other size :).
To see how this turns out, you can try out smallperl and bigperl, two
pre-built static and compressed perl binaries with many and even more
modules.
You get even more useful variants of this method by first selecting
everything, and then excluding stuff you are reasonable sure not to
need - bigperl <http://staticperl.schmorp.de/bigperl.html> uses this
approach.
Getting rid of netdb functions
The perl core has lots of netdb functions ("getnetbyname",
"getgrent" and so on) that few applications use. You can avoid
compiling them in by putting the following fragment into a
"preconfigure" hook:
preconfigure() {
for sym in \
d_getgrnam_r d_endgrent d_endgrent_r d_endhent \
d_endhostent_r d_endnent d_endnetent_r d_endpent \
d_endprotoent_r d_endpwent d_endpwent_r d_endsent \
d_endservent_r d_getgrent d_getgrent_r d_getgrgid_r \
d_getgrnam_r d_gethbyaddr d_gethent d_getsbyport \
d_gethostbyaddr_r d_gethostbyname_r d_gethostent_r \
bin/staticperl view on Meta::CPAN
staticperl mkperl -MAnyEvent::Impl::Perl -MAnyEvent::HTTPD -MURI -MURI::http
# build a perl with the above modules linked in
staticperl mkapp myapp --boot mainprog mymodules
# build a binary "myapp" from mainprog and mymodules
=head1 DESCRIPTION
This script helps you to create single-file perl interpreters
or applications, or embedding a perl interpreter in your
applications. Single-file means that it is fully self-contained - no
separate shared objects, no autoload fragments, no .pm or .pl files are
needed. And when linking statically, you can create (or embed) a single
file that contains perl interpreter, libc, all the modules you need, all
the libraries you need and of course your actual program.
With F<uClibc> and F<upx> on x86, you can create a single 500kb binary
that contains perl and 100 modules such as POSIX, AnyEvent, EV, IO::AIO,
Coro and so on. Or any other choice of modules (and some other size :).
To see how this turns out, you can try out smallperl and bigperl, two
pre-built static and compressed perl binaries with many and even more
bin/staticperl view on Meta::CPAN
creating bundles without having to worry about forgetting any modules.
You get even more useful variants of this method by first selecting
everything, and then excluding stuff you are reasonable sure not to need -
L<bigperl|http://staticperl.schmorp.de/bigperl.html> uses this approach.
=item Getting rid of netdb functions
The perl core has lots of netdb functions (C<getnetbyname>, C<getgrent>
and so on) that few applications use. You can avoid compiling them in by
putting the following fragment into a C<preconfigure> hook:
preconfigure() {
for sym in \
d_getgrnam_r d_endgrent d_endgrent_r d_endhent \
d_endhostent_r d_endnent d_endnetent_r d_endpent \
d_endprotoent_r d_endpwent d_endpwent_r d_endsent \
d_endservent_r d_getgrent d_getgrent_r d_getgrgid_r \
d_getgrnam_r d_gethbyaddr d_gethent d_getsbyport \
d_gethostbyaddr_r d_gethostbyname_r d_gethostent_r \
d_getlogin_r d_getnbyaddr d_getnbyname d_getnent \
staticperl.pod view on Meta::CPAN
staticperl mkperl -MAnyEvent::Impl::Perl -MAnyEvent::HTTPD -MURI -MURI::http
# build a perl with the above modules linked in
staticperl mkapp myapp --boot mainprog mymodules
# build a binary "myapp" from mainprog and mymodules
=head1 DESCRIPTION
This script helps you to create single-file perl interpreters
or applications, or embedding a perl interpreter in your
applications. Single-file means that it is fully self-contained - no
separate shared objects, no autoload fragments, no .pm or .pl files are
needed. And when linking statically, you can create (or embed) a single
file that contains perl interpreter, libc, all the modules you need, all
the libraries you need and of course your actual program.
With F<uClibc> and F<upx> on x86, you can create a single 500kb binary
that contains perl and 100 modules such as POSIX, AnyEvent, EV, IO::AIO,
Coro and so on. Or any other choice of modules (and some other size :).
To see how this turns out, you can try out smallperl and bigperl, two
pre-built static and compressed perl binaries with many and even more
staticperl.pod view on Meta::CPAN
creating bundles without having to worry about forgetting any modules.
You get even more useful variants of this method by first selecting
everything, and then excluding stuff you are reasonable sure not to need -
L<bigperl|http://staticperl.schmorp.de/bigperl.html> uses this approach.
=item Getting rid of netdb functions
The perl core has lots of netdb functions (C<getnetbyname>, C<getgrent>
and so on) that few applications use. You can avoid compiling them in by
putting the following fragment into a C<preconfigure> hook:
preconfigure() {
for sym in \
d_getgrnam_r d_endgrent d_endgrent_r d_endhent \
d_endhostent_r d_endnent d_endnetent_r d_endpent \
d_endprotoent_r d_endpwent d_endpwent_r d_endsent \
d_endservent_r d_getgrent d_getgrent_r d_getgrgid_r \
d_getgrnam_r d_gethbyaddr d_gethent d_getsbyport \
d_gethostbyaddr_r d_gethostbyname_r d_gethostent_r \
d_getlogin_r d_getnbyaddr d_getnbyname d_getnent \
( run in 0.775 second using v1.01-cache-2.11-cpan-b16cb0d3907 )