| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | # ABSTRACT: embedd and escape template content | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | |||
| 8 | |||
| 9 | use Shotenjin::Embedder; | ||
| 10 | |||
| 11 | use Cwd; | ||
| 12 | use File::Find::Rule; | ||
| 13 | use Path::Class; | ||
| 14 | use Getopt::LL::Simple qw( | ||
| 15 | --keep_whitespace|--kw | ||
| 16 | --relative_cwd|--cwd | ||
| 17 | ); | ||
| 18 | |||
| 19 | |||
| 20 | my $strip_whitespace = $ARGV{'--strip_whitespace'}; | ||
| 21 | my $relative_cwd = $ARGV{'--relative_cwd'} || $ARGV{'--absolute'}; | ||
| 22 | my $param = $ARGV[0]; | ||
| 23 | |||
| 24 | |||
| 25 | if ($param && -d $param) { | ||
| 26 | |||
| 27 | Shotenjin::Embedder->process_dir($param, $strip_whitespace, $relative_cwd ? cwd() : undef); | ||
| 28 | |||
| 29 | } elsif ($param && -e $param) { | ||
| 30 | |||
| 31 | Shotenjin::Embedder->process_file($param, $strip_whitespace, $relative_cwd ? cwd() : undef); | ||
| 32 | |||
| 33 | } else { | ||
| 34 | die "Can't find input files to process, specify it as 1st argument\n(either single file or directory to scan)\n" | ||
| 35 | } | ||
| 36 | |||
| 37 | |||
| 38 | package shotenjin_embed; | ||
| 39 | BEGIN { | ||
| 40 | $shotenjin_embed::VERSION = '0.06'; | ||
| 41 | } #just to satisfy PodWeaver | ||
| 42 | |||
| 43 | 1; | ||
| 44 | __END__ |