[Petal] 0.63 Released / BUG: Petal & Autoload

Kurt Stephens kstep@pepsdesign.com
Mon, 2 Sep 2002 18:01:23 -0400


Hi Jean-Michel,

Thanks for the quick response on the Autoload bug.  I checked the fixed code
against my original code using CGI.pm and it seems to work well.  I
intentionally broke the fix by calling query/foobar and the code died
gracefully in the process() method, as expected.

I noticed that there is a second call to UNIVERSAL::can() at line 104 of
Petal/Hash/VAR.pm.  I imagine that this needs to be changed as well.

File: Petal/Hash/VAR.pm. (Version 0.63)

094:     if (scalar @path == 0 and scalar @args > 0)
095:     {
096:  confess "Cannot invoke $next on $argument"
097:      unless ($current->can ($next) or $current->can ('AUTOLOAD'));
098:
099:  $current = $current->$next (@args);
100:     }
101:
102:     else
103:     {
104:  if ($current->can ($next))  ### AUTOLOAD BUG STIKES AGAIN!
105:  {
106:      $current = $current->$next (@args);
107:  }

The following patch should fix this:

104c104
<         if ($current->can ($next))
---
>         if ($current->can ($next) or $current->can ('AUTOLOAD'))

Again, thanks for the quick response.

Best Regards,

Kurt Stephens
kstep@pepsdesign.com