The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

USAGE

   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>]

EXAMPLES

   # 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>'

DESCRIPTION

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

  • 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.

OPTIONS

--data | --text | -d data

set the data that will be embedded. Works for actions add and modularize.

--file | --filename | -f filename

set the filename where the data will be taken. Works for actions add and modularize.

--help

print a somewhat more verbose help, showing usage, this description of the options and some examples from the synopsis.

--man

print out the full documentation for the script.

--name | -n name

set the name of the section to be added. Works for action add.

--output | -o filename

set the name of the output file. Works for actions extract and modularize.

--output-from-package | --auto-output | -a

set the output filename from the package name (overrides any other output command line option). Works for action modularize.

--package | -p | --module | -m name

set the name of the package for generating a module. Works for action modularize.

--usage

print a concise usage line and exit.

--version

print the version of the script.

CONFIGURATION AND ENVIRONMENT

data-embed requires no configuration files or environment variables.

DEPENDENCIES

Nothing that Data::Embed does not already require.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests through http://rt.cpan.org/

AUTHOR

Flavio Poletti polettix@cpan.org

LICENCE AND COPYRIGHT

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.

DISCLAIMER OF WARRANTY

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.