From a8f0ac11903209389f25bb3707f19e8d874c2546 Mon Sep 17 00:00:00 2001 From: "ian%hixie.ch" Date: Wed, 25 Feb 2004 17:41:30 +0000 Subject: [PATCH] Don't try to load the Exporter module. Don't try to load modules without a __DATA__ section. Don't try to evaluate the block if trying to read it failed. --- webtools/PLIF/PLIF.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/webtools/PLIF/PLIF.pm b/webtools/PLIF/PLIF.pm index 7d72cbc7562..eb4316e053f 100644 --- a/webtools/PLIF/PLIF.pm +++ b/webtools/PLIF/PLIF.pm @@ -119,22 +119,27 @@ sub bless { sub load { my $self = shift; my($package) = @_; + if (defined $MODULES{$package}) { syntaxError "$package->create() called despite failing to load package" if $MODULES{$package} == 0; return; } + $MODULES{$package} = -1; foreach (eval "\@$package\::ISA") { - $self->load($_) unless $_ eq __PACKAGE__; + $self->load($_) unless $_ eq __PACKAGE__ || $_ eq 'Exporter'; } + $MODULES{$package} = 1; + + # bail early if there is no __DATA__ section + return unless defined fileno("$package\::DATA"); + local $/ = undef; my $data = "package $package;use strict;" . eval "<$package\::DATA>"; - evalString $data, "${package} on-demand section"; + evalString $data, "${package} on-demand section" unless $@; if ($@) { $self->error(1, "Error while loading '$package': $@"); $MODULES{$package} = 0; - } else { - $MODULES{$package} = 1; } }