1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/usr/bin/perl use strict; use warnings; use File::Util; my $fu = File::Util->new(); my $dir = '/usr/bin/'; for my $file ($fu->list_dir($dir, qw(--files-only --recurse))) { my $fileName = $fu->atomize_path($file); #my ($fileName) = ($file) =~ m/\/([^\/]+$)/; # so geht's! print "$fileName\n"; }
1
2
3
4
Can't locate auto/File/Util/atomize_pat.al in @INC (@INC contains:
/etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2
/usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14
/usr/local/lib/site_perl .) at test_atomize.pl line 14
2013-04-12T19:42:29 payx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#... sub autoload_sub { my $sub = shift; my $filename = AutoLoader::find_filename( $sub ); my $save = $@; local $!; # Do not munge the value. eval { local $SIG{__DIE__}; require $filename }; if ($@) { if (substr($sub,-9) eq '::DESTROY') { no strict 'refs'; *$sub = sub {}; $@ = undef; } elsif ($@ =~ /^Can't locate/) { # The load might just have failed because the filename was too # long for some old SVR3 systems which treat long names as errors. # If we can successfully truncate a long name then it's worth a go. # There is a slight risk that we could pick up the wrong file here # but autosplit should have warned about that when splitting. if ($filename =~ s/(\w{12,})\.al$/substr($1,0,11).".al"/e){ eval { local $SIG{__DIE__}; require $filename }; } } #...
1
2
3
4
5
6
7
8
9
$ cpan
cpan[1]> m /File::Util$/
Reading '/home/linuxer/.cpan/Metadata'
Database was generated on Thu, 11 Apr 2013 22:07:22 GMT
Module < File::Util (TOMMY/File-Util-3.39.tar.gz)
Module < NetHack::Logfile::Util (SARTAK/NetHack-Logfile-1.00.tar.gz)
Module < SHARYANTO::File::Util (SHARYANTO/SHARYANTO-Utils-0.38.tar.gz)
3 items found