18a19,20 > S> > S> 21a24,25 > S> > S> 99a104,111 > =item B<-g>, B<--glob> > > Use Perl's builtin C function to pre-parse @ARGV. Useful for shells that don't provide their own shell globbing. (eg, cmd.exe) > > =item B<-I>, B<--include-directory> > > Prepend directory to search path ("@INC") for plugins (see C<-p>) and other modules. > 115a128,135 > =item B<-p>, B<--plugin> > > ... > > =item B<-r>, B<--reverse-file-order> > > Process filenames in reverse (last to first) order. > 155a176,184 > my %plugin_hooks = ( 'pre' => [ ], 'post' => [ ] ); > > sub run_hooks { > my($type) = @_; > > for my $hook ( @{ $plugin_hooks{$type} } ) { > $hook->(); > } > } 164a194,195 > 'g|glob' => \my $opt_glob, > 'I|include-path=s' => sub { unshift @INC, $_[1] }, 168a200,216 > 'p|plugin|macro=s' => sub { > return if $_[1] !~ /\A(\w+(::\w+)*)\z/; > > require File::Spec; > > my $plugin_name = "Rename::$1"; > my $plugin_file = File::Spec->catfile( split /::/, $plugin_name ) . '.pm'; > > require $plugin_file; > > for my $type ( keys %plugin_hooks ) { > if ( my $coderef = $plugin_name->can( $type . "_hook" ) ) { > push @{ $plugin_hooks{$type} }, $coderef; > } > } > }, > 'r|reverse-file-order' => \my $opt_reverse_order, 178c226 < 'z|sanitize' => sub { push @perlexpr, 's/[!"$&()=?`*\';<>|_[:cntrl:][:blank:]]+/_/g' }, --- > 'z|sanitize' => sub { push @perlexpr, 's/[!"\$&()=?`*\';<>|_[:cntrl:][:blank:]]+/_/g' }, 184c232 < if(@ARGV) { push @perlexpr, shift } --- > if(@ARGV and ! -e $ARGV[0]) { push @perlexpr, shift } 212a261,263 > if ($opt_glob) { @ARGV = map glob($_), @ARGV; } > if ($opt_reverse_order) { @ARGV = reverse @ARGV; } > 220a272 > run_hooks('pre'); 221a274 > run_hooks('post');