[Petal] Adding support for PAR

Bruno Postle bruno at mkdoc.com
Wed Mar 9 12:42:40 GMT 2005


On Fri 25-Feb-2005 at 16:38 -0500, William McKee wrote:

> I needed to add support to Petal and MKDoc for use within PAR 
> archives.  It was a pretty simple modification to Petal/Hash.pm 
> and MKDoc/XML/Decode.pm. I've attached a diff for Petal to this 
> email.

The patch applies cleanly and passes the tests (without PAR 
installed), though it doesn't contain any changes to 
MKDoc::XML::Decode?

I have a couple of questions about the patch, basically it does 
this:

foreach my $include_dir (@INC)
{

+  if (ref $include_dir eq 'CODE')
+  {
+    next unless keys %PAR::LibCache; # skip if PAR is not loaded

  [do new PAR specific stuff]

+  }
+  else
+  {

  [do the same as before].

+  }

Shouldn't it be something like this?:

  if (ref $include_dir eq 'CODE' and keys %PAR::LibCache)

You also a moved a '{', this looks like a bugfix?:

>+  }
> 	
> 	foreach my $module (@modules)
> 	{
>@@ -31,7 +52,6 @@
> 	    $@ and warn "Cannot import module $module. Reason: $@";
> 	    $MODIFIERS->{lc ($module) . ':'} = "Petal::Hash::$module";
> 	}
>-    }
> }

-- 
Bruno


More information about the Petal mailing list