Slight patch to Perlbal.pm

dormando dormando at rydia.net
Tue Jan 15 23:15:35 UTC 2008


Scoped filehandles are an addition in perl 5.6, so this'll break compat 
with 5.05 and friends...

... I guess the question is, does perlbal actually work with perl 
pre-5.6 right now? I have no idea :) If not, and no one cares, we can 
probably merge after a quick test.

-Dormando

Eamon Daly wrote:
> 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