[Po4a-devel]Fix error reporting bug in Chooser.pm

Francois Gouget fgouget@codeweavers.com
Wed, 25 May 2005 02:34:00 +0200


This is a multi-part message in MIME format.
--------------080003060000010105020308
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit


When Chooser.pm fails to load a plugin all it prints is:

    Module loading error:

That is, it does not print the reason why it failed to load the plugin.
The reason for this is that '$@' gets clobbered at some time between the 
error and when if finally gets printed. Storing it in an intermediate 
variable solves the issue.


Changelog:

  * lib/Locale/Po4a/Chooser.pm

    Francois Gouget <fgouget@codeweavers.com>
    Store '$@' in an intermediate variable so it does not get clobbered 
before we report the plugin-load error.

-- 
Francois Gouget
fgouget@codeweavers.com


--------------080003060000010105020308
Content-Type: text/plain;
 name="po4a-20050524-chooser.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="po4a-20050524-chooser.diff"

Index: lib/Locale/Po4a/Chooser.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Chooser.pm,v
retrieving revision 1.25
diff -u -p -r1.25 Chooser.pm
--- lib/Locale/Po4a/Chooser.pm	27 Feb 2005 23:32:02 -0000	1.25
+++ lib/Locale/Po4a/Chooser.pm	24 May 2005 17:45:50 -0000
@@ -41,9 +41,10 @@ sub new {
     if (! UNIVERSAL::can("Locale::Po4a::$modname", 'new')) {
         eval qq{use Locale::Po4a::$modname};
         if ($@) {
+            my $error=$@;
             warn wrap_msg(gettext("Unknown format type: %s."), $module);
 	    warn wrap_mod("po4a::chooser",
-		gettext("Module loading error: %s"), $@)
+		gettext("Module loading error: %s"), $error)
 	      if defined $options{'verbose'} && $options{'verbose'} > 0;
             list(1);
         }

--------------080003060000010105020308--