Dirk80 has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
I want to tag all my emacs files. Here is my first version.
#!/usr/bin/perl use strict; use warnings; use File::Find; # tag "~/.emacs" system("etags \"C:/Documents and Settings/dirk/Application Data/.emacs +\""); # tag all .el files of "C:\Program Files\Emacs" find(\&tagEmacsFiles, "C:/Program Files/Emacs"); sub tagEmacsFiles() { if( -f $_ ) { if( $_ =~ m/\.[eE][lL]$/ ) { # option -a means append to TAGS file system("etags -a \"$File::Find::name\""); } } }
The tagging within the find function is not working. Why???
Here is the second version. This one is working.
#!/usr/bin/perl use strict; use warnings; use File::Find; my @file_list; # tag "~/.emacs" system("etags \"C:/Documents and Settings/dirk/Application Data/.emacs +\""); # tag all .el files of "C:\Program Files\Emacs" find(\&addEmacsFilesToList, "C:/Program Files/Emacs"); for my $file (@file_list) { system("etags -a $file"); } sub addEmacsFilesToList() { if( -f $_ ) { if( $_ =~ m/\.[eE][lL]$/ ) { push(@file_list, "\"$File::Find::name\""); } } }
Would be really interesting for my me why the first version is not working.
Thank you.
Greetings,
Dirk
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: etags not working within function called by find
by ikegami (Patriarch) on Apr 30, 2010 at 16:15 UTC | |
by Dirk80 (Pilgrim) on May 03, 2010 at 08:50 UTC | |
|
Re: etags not working within function called by find
by jethro (Monsignor) on Apr 30, 2010 at 15:54 UTC |