From: Mark Addison Date: Wed, 18 May 2005 22:34:10 +0000 (+0000) Subject: Fixed error propogation when loading filters. X-Git-Tag: v0.11008~565 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=017580f4b79076a4323fdcb9738b6ab53eeb4e14;hp=7f2b8f37ef5d60aed89a499711f42bbe9c0f9f56;p=dbsrgits%2FSQL-Translator.git Fixed error propogation when loading filters. --- diff --git a/lib/SQL/Translator.pm b/lib/SQL/Translator.pm index 36270fc..2227908 100644 --- a/lib/SQL/Translator.pm +++ b/lib/SQL/Translator.pm @@ -1,7 +1,7 @@ package SQL::Translator; # ---------------------------------------------------------------------- -# $Id: Translator.pm,v 1.65 2005-05-13 07:35:58 allenday Exp $ +# $Id: Translator.pm,v 1.66 2005-05-18 22:34:10 grommit Exp $ # ---------------------------------------------------------------------- # Copyright (C) 2002-4 The SQLFairy Authors # @@ -27,7 +27,7 @@ use base 'Class::Base'; require 5.004; $VERSION = '0.07'; -$REVISION = sprintf "%d.%02d", q$Revision: 1.65 $ =~ /(\d+)\.(\d+)/; +$REVISION = sprintf "%d.%02d", q$Revision: 1.66 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; $ERROR = ""; @@ -231,7 +231,7 @@ sub filters { else { $self->debug("Adding $name filter. Args:".Dumper($args)."\n"); my $code = _load_sub("$name\::filter", "SQL::Translator::Filter"); - return $self->error("ERROR:".$self->error) unless $code; + return $self->error(__PACKAGE__->error) unless $code; push @$filters, [$code,$args]; } } @@ -713,8 +713,8 @@ sub _list { # MODULE - is the name of the module to load. # # PATH - optional list of 'package paths' to look for the module in. e.g -# If you called load(Bar => 'Foo', 'My::Modules') it will try to load the mod -# Bar then Foo::Bar then My::Modules::Bar. +# If you called load('Super::Foo' => 'My', 'Other') it will +# try to load the mod Super::Foo then My::Super::Foo then Other::Super::Foo. # # Returns package name of the module actually loaded or false and sets error. # @@ -736,7 +736,8 @@ sub load { eval { require $file }; next if $@ =~ /Can't locate $file in \@INC/; eval { $file->import(@_) } unless $@; - return __PACKAGE__->error("Error loading $name as $module : $@") if $@ && $@ !~ /"SQL::Translator::Producer" is not exported/; + return __PACKAGE__->error("Error loading $name as $module : $@") + if $@ && $@ !~ /"SQL::Translator::Producer" is not exported/; return $module; # Module loaded ok } @@ -753,7 +754,6 @@ sub load { sub _load_sub { my ($tool, @path) = @_; - # Passed a module name or module and sub name my (undef,$module,$func_name) = $tool =~ m/((.*)::)?(\w+)$/; if ( my $module = load($module => @path) ) { my $sub = "$module\::$func_name";