Slight patch to Perlbal.pm

Eamon Daly edaly at nextwavemedia.com
Tue Jan 15 22:21:52 UTC 2008


While writing a plugin to allow multiple config files, I
noticed that Perlbal::load_config uses a typeglob filehandle
rather than a locally-scoped one, which means it'll throw
warnings if called recursively. This (trivial) patch fixes
that:

--- /usr/lib/perl5/site_perl/5.8.5/Perlbal.pm   2007-10-23 
23:09:08.000000000 -0500
+++ /var/www/lib/Perlbal.pm     2008-01-15 14:49:22.000000000 -0600
@@ -1135,14 +1135,14 @@

 sub load_config {
     my ($file, $writer) = @_;
-    open (F, $file) or die "Error opening config file ($file): $!\n";
+    open(my $fh, $file) or die "Error opening config file ($file): $!\n";
     my $ctx = Perlbal::CommandContext->new;
     $ctx->verbose(0);
-    while (my $line = <F>) {
+    while (my $line = <$fh>) {
         $line =~ s/\$(\w+)/$ENV{$1}/g;
         return 0 unless run_manage_command($line, $writer, $ctx);
     }
-    close(F);
+    close($fh);
     return 1;
 }

____________________________________________________________
Eamon Daly





More information about the perlbal mailing list