Flavio Poletti > Template-Perlish > tptree

Download:
Template-Perlish-1.06.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

tptree - a very humble imitation of ttree from TT2

VERSION ^

Ask the version number to the script itself, calling:

   shell$ tptree --version

USAGE ^

   tptree [--usage] [--help] [--man] [--version]

   tptree [--source|--src|-s directory] [--dest|--dst|-d directory]
      [--process|-p regex] [--verbose|-v] [--variables|-V]
      [--define|-D item] [--edefine|--eval-define|-E item]
      [--hdefine|--hex-define|-H|-X item] 
      [--sdefine|--storable-define|-S item]
      [--sstdin|--storable-stdin|-i]

EXAMPLES ^

   shell$ tptree

   shell$ tptree --src source --dst /path/to/dst --define ciao='a tutti'

DESCRIPTION ^

This simple script tries to capture what I've personally found to be 90% of the useful functionality in TT2: recursing into a given file tree, apply the transformations with the templating system, and put the result into a directory tree analogous to the starting one, but where I desire.

As a minimum, you have to provide a source directory and a destination. Every output directory that's not already there will be created, so the destination directory needs not to be previously created.

During processing, you can decide which files should be included by providing a selection regular expression through --process|-p.

One aspect where tptree goes quite on its own way is variable passing. While TT2's ttree is bound to simple variable=value paradigm, tptree offers a wide variety for both escaping/encoding the variables, or get them via standard input (<--sstdin|--storable-stdin|-i>).

OPTIONS ^

Parameter passing options are discussed in a section by themselves, to be found later in this document.

--dest | --dst | -d directory

set the destination directory root.

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

--process | -p regex

set the given regex as a regular expression to be matched on each filename found in the hierarchy. If matches, the file is "executed", otherwise.

--source | --src | -s directory

set the source directory for directory root.

--usage

print a concise usage line and exit.

--variables | -V

print a dump of the configured variables.

--verbose | -v

output some debug messages during execution.

--version

print the version of the script.

Variable Passing

There are three variables-setting facilities that can be used on the command line:

--define | -D name=value

set name as value

--edefine | --eval-define | -E name=expression

evaluate expression and set name to the result. So, for example you can say:

   name='[qw(ciao a tutti)]'

and get name set to an anonymous array containing three elements (guess which?)

--hdefine | --hex-define | -H | -X name=hexvalue

convert hexvalue back to unencoded form, using pack's template 'H*', then set as the value of variable name.

--sdefine | --storable-define | -S name=storable-hex

convert storable-hex back into binary data (using 'H*'), then retrieve a value using Storable.

Last, but not least, a set of variables embedded into a hash ref encoded with Storable can be read from the standard input:

--sstdin | --storable-stdin | -i!

get configuration from standard input, decoding it using Storable.

CONFIGURATION AND ENVIRONMENT ^

tptree requires no configuration files or environment variables.

DEPENDENCIES ^

None, apart Template::Perlish. Unless it has been embedded in this very file.

BUGS AND LIMITATIONS ^

No bugs have been reported.

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

AUTHOR ^

Flavio Poletti flavio@polettix.it

LICENCE AND COPYRIGHT ^

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.

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.

NEGAZIONE DELLA GARANZIA ^

Poiché questo software viene dato con una licenza gratuita, non c'è alcuna garanzia associata ad esso, ai fini e per quanto permesso dalle leggi applicabili. A meno di quanto possa essere specificato altrove, il proprietario e detentore del copyright fornisce questo software "così com'è" senza garanzia di alcun tipo, sia essa espressa o implicita, includendo fra l'altro (senza però limitarsi a questo) eventuali garanzie implicite di commerciabilità e adeguatezza per uno scopo particolare. L'intero rischio riguardo alla qualità ed alle prestazioni di questo software rimane a voi. Se il software dovesse dimostrarsi difettoso, vi assumete tutte le responsabilità ed i costi per tutti i necessari servizi, riparazioni o correzioni.

In nessun caso, a meno che ciò non sia richiesto dalle leggi vigenti o sia regolato da un accordo scritto, alcuno dei detentori del diritto di copyright, o qualunque altra parte che possa modificare, o redistribuire questo software così come consentito dalla licenza di cui sopra, potrà essere considerato responsabile nei vostri confronti per danni, ivi inclusi danni generali, speciali, incidentali o conseguenziali, derivanti dall'utilizzo o dall'incapacità di utilizzo di questo software. Ciò include, a puro titolo di esempio e senza limitarsi ad essi, la perdita di dati, l'alterazione involontaria o indesiderata di dati, le perdite sostenute da voi o da terze parti o un fallimento del software ad operare con un qualsivoglia altro software. Tale negazione di garanzia rimane in essere anche se i dententori del copyright, o qualsiasi altra parte, è stata avvisata della possibilità di tali danneggiamenti.

Se decidete di utilizzare questo software, lo fate a vostro rischio e pericolo. Se pensate che i termini di questa negazione di garanzia non si confacciano alle vostre esigenze, o al vostro modo di considerare un software, o ancora al modo in cui avete sempre trattato software di terze parti, non usatelo. Se lo usate, accettate espressamente questa negazione di garanzia e la piena responsabilità per qualsiasi tipo di danno, di qualsiasi natura, possa derivarne.

syntax highlighting: