data-embed - embed/extract files to/from container files
version 0.2_03
This program is a wrapper around the functionalities provided by Data::Embed. It allows embedding data inside files in two ways:
multiple data sections in a container file. To read data from that file, Data::Embed (or data-embed) will be needed
Data::Embed
data-embed
one single data section inside a Perl module. The Perl module contains a package with the code to read the section directly.
Although similar, these two ways address different use cases. The first one is when you want to bring multiple sections in a file - e.g. a Perl script - so that you can access it later. In most cases it is redundant with respect to any archiving software (e.g. tar, zip, etc.) but it can come handy when you want to embed data within some other file.
The second method is when you want to bring some data inside a distribution, and then you want e.g. to embed those modules via Mobundle or FatPack.
data-embed [--usage] [--help] [--man] [--version] data-embed add <target> [--data|--text|-d <data>] [--file|--filename|-f <filename>] [--name|-n <name>] [<filename>] data-embed list <target> data-embed extract <target> <id> [--output|-o <filename>] data-embed modularize [--data|--text|-d <data>] [--file|--filename|-f <filename>] [--output|-o <filename>] [--output-from-package|--auto-output|-a] [--package|-p|--module|-m <packagename>] [<filename>]
# Add one section named "first part" from data on command line shell$ data-embed add container.bin -n 'first part' -d "some data" # same things, with data coming from standard input shell$ echo ciao | data-embed add container.bin -n second # ditto, data from a file shell$ data-embed add container.bin -n third /path/to/input-file # you can be explicit about the file name shell$ data-embed add container.bin -n third -f /path/to/input-file # List a file's contents shell$ data-embed list # Extract a file shell$ data-embed extract 0 # Extract a file to a file shell$ data-embed extract 0 -o /path/to/output # Create a module with a file as contents shell$ data-embed modularize -p ThePack /path/to/file -o ThePack.pm # Read the data in the module shell$ perl -I . -MThePack -e 'print ThePack::get_data()' # Read the data in the module, through filehandle shell$ perl -I . -MThePack -e '$fh=ThePack::get_fh(); print while <$fh>'
set the data that will be embedded. Works for actions add and modularize.
add
modularize
set the filename where the data will be taken. Works for actions add and modularize.
print a somewhat more verbose help, showing usage, this description of the options and some examples from the synopsis.
print out the full documentation for the script.
set the name of the section to be added. Works for action add.
set the name of the output file. Works for actions extract and modularize.
extract
set the output filename from the package name (overrides any other output command line option). Works for action modularize.
output
set the name of the package for generating a module. Works for action modularize.
print a concise usage line and exit.
print the version of the script.
data-embed requires no configuration files or environment variables.
Nothing that Data::Embed does not already require.
No bugs have been reported.
Please report any bugs or feature requests through http://rt.cpan.org/
Flavio Poletti polettix@cpan.org
polettix@cpan.org
Copyright (c) 2014-2015 Flavio Poletti polettix@cpan.org.
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic and 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.
Flavio Poletti <polettix@cpan.org>
Copyright (C) 2014-2015 by Flavio Poletti <polettix@cpan.org>
This module is free software. You can redistribute it and/or modify it under the terms of the Artistic License 2.0.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
To install Data::Embed, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Embed
CPAN shell
perl -MCPAN -e shell install Data::Embed
For more information on module installation, please visit the detailed CPAN module installation guide.