| description | A module to bundle modules inside a script |
| owner | flavio@polettix.it |
| last change | Wed, 7 Sep 2011 05:50:49 +0000 |
| URL | git://repo.or.cz/mobundle.git |
| http://repo.or.cz/r/mobundle.git | |
| Push URL | ssh://repo.or.cz/srv/git/mobundle.git |
| Content tags: |
mobundle - bundle modules inside your scripts
Ask the version number to the script itself, calling:
shell$ mobundle --version
mobundle [--usage] [--help] [--man] [--version]
mobundle [--autoscan|--scan|-a] [--body|-b <body>]
[--body-from|--script|--program|-B <filename>]
[--head|-h <head>] [--head-from|-H <filename>]
[--head-from-body|-S <n>] [--head-from-paragraph|-P]
[--module|-m <name>] [--modules-from|-M <filename>]
[--output|-o <filename>] [--standard-head|-s]
shell$ mobundle -m Template::Perlish -B yourscript.pl
shell$ mobundle -m Template::Perlish --head '#!/path/to/perl' -B yourscript.pl
shell$ mobundle -m Acme::Laugh --head-from-paragraph -B laugh.pl
mobundle lets you bundle Perl modules inside your Perl script, in order
to ship a single script instead of N separate files.
The underlying logic is simple: all modules are included in the generated script, and the module loading mechanism is tweaked in order to let you load the bundled modules. See the documentation for perlfunc/require to understand how.
The generated script will be compound of three main parts: a head,
a section with the bundled modules and the logic to load them, and
a body. Briefly speaking:
this is where you should put your shabang and the uses that you would
like to happen before the module loading mechanism is tweaked.
The head is guaranteed to start at the very first octet in the result,
so you can put a shabang.
this part is generated automatically based on your instructions about which modules should be bundled.
this is the body of your script, i.e. what your script is supposed to do.
It will likely contain either uses or requires that need the modules
that are bundled in the modules section.
PAR is fantastic: lets you bundle all the needed components of your application inside a single executable, and ship it. But... there's a niche that it's not able to cover, at least looking at the documentation.
In particular, there seem to be two different operation modes, depending on your needs
either you're willing to bundle the interpreter as well, in which case PAR (or, better, pp) will generate a super-executable bundling all necessary stuff
or you have to be sure that PAR is installed in the target directory.
My need was somewhere in between: on the one side I wasn't willing to bundle the interpreter, on the other I couldn't ensure that PAR was available.
In particular, this kind of need arises every time that my programs only need Pure-Perl modules, that do not need any platform-specific installation process. In this case, bundling the interpreter means restricting the applicability to one (or more, at some cost) platform only; the other way is simply not acceptable in some environments.
Flavio Poletti flavio@polettix.it
Copyright (c) 2008, Flavio Poletti flavio@polettix.it. All rights reserved.
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic and perlgpl.
Questo script รจ software libero: potete ridistribuirlo e/o modificarlo negli stessi termini di Perl stesso. Vedete anche perlartistic e perlgpl.
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
| 2011-09-07 | Flavio Poletti | Merge branch 'linode' master | commit | commitdiff | tree | snapshot (tar.gz zip) |
| 2011-09-07 | Flavio Poletti | merged version in linode with local one linode | commit | commitdiff | tree | snapshot (tar.gz zip) |
| 2011-09-07 | Flavio Poletti | added -I|--include and inclusion markers | commit | commitdiff | tree | snapshot (tar.gz zip) |
| 2009-11-24 | Flavio Poletti | Corrected a bug in the examples | commit | commitdiff | tree | snapshot (tar.gz zip) |
| 2009-11-24 | Flavio Poletti | Initial import | commit | commitdiff | tree | snapshot (tar.gz zip) |
| 5 months ago | master | log | tree |
| 5 months ago | linode | log | tree |