| 1 | #!/usr/local/bin/perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use XUL::Image; | ||
| 7 | use Getopt::Long; | ||
| 8 | |||
| 9 | my ($help, $outdir, $count, $title, $delay, $reset); | ||
| 10 | GetOptions ( | ||
| 11 | 'help' => \$help, | ||
| 12 | 'outdir=s' => \$outdir, | ||
| 13 | 'count=i' => \$count, | ||
| 14 | 'title=s' => \$title, | ||
| 15 | 'delay=f' => \$delay, | ||
| 16 | 'reset' => \$reset, | ||
| 17 | ) or help(1); | ||
| 18 | |||
| 19 | help(0) if $help; | ||
| 20 | |||
| 21 | if (!$count) { | ||
| 22 | die "You must specify the slide count via the --count option.\n"; | ||
| 23 | } | ||
| 24 | |||
| 25 | my $conv = XUL::Image->new( | ||
| 26 | outdir => $outdir, | ||
| 27 | count => $count, | ||
| 28 | title => $title, | ||
| 29 | delay => $delay, | ||
| 30 | ); | ||
| 31 | $conv->go(reset => $reset); | ||
| 32 | |||
| 33 | sub help { | ||
| 34 | my $code = shift; | ||
| 35 | warn <<'_EOC_'; | ||
| 36 | usage: xul2img [options] | ||
| 37 | |||
| 38 | options: | ||
| 39 | --help print this message | ||
| 40 | --outdir s use s as the output directory | ||
| 41 | (defaults to ./xul_img) | ||
| 42 | --count i set the count of slides | ||
| 43 | --title s set the slide title | ||
| 44 | (a substring is okay) | ||
| 45 | --reset whether reset the slides to the | ||
| 46 | first page. | ||
| 47 | _EOC_ | ||
| 48 | exit($code); | ||
| 49 | } |