Re: Adding support for PAR

Bruno Postle <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.petal
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.