May 6th, 2003

Zoner en fuego!


Orange Sunkist soda isn't as refreshing when spilled in your lap as it is when you drink it.

That is all.
  • Current Music
Zoner en fuego!

Perl questions on 'use' inheritance

I've been out of serious Perl coding for a while, and I started in Perl 4 (require) days, and never had to do anything too fancy with 'use' before, so I'm seeking wisdom. OK, for the existing ASP and ColdFusion versions of the code, we have a global 'include' file that includes the various files, then each script need only include that file to access the functions, etc.

Collapse )

I discovered that doing a similar thing in Perl, with 'use', does not work. If I 'use' the function files in a global file, like '', then 'use pcGlobal' in other files, the namespace isn't inherited, so I can't just call functions from the function files in the current file without explicitly specifying the package name - which makes the include file pointless. Right now I'm just doing a 'use' on each function file every place it is needed instead. But, for purposes of keeping each implementation as much like the others as possible, if I can find the magic to make the include file work, I'll take it.

The other problem I have is that neither ASP nor CF seem to have a problem with recursion. Say a routine in pcFunctions is used in Merchant, and a routine in Merchant is used in pcFunctions. In ASP and CF, both of these files are included in pcInclude, and both of them them include pcInclude. So no problem, the functions are all in a flat namespace and the calls work just dandy.

Perl got REALLY unhappy when I tried to do 'use Merchant' in pcFunctions, and 'use pcFunctions' in Merchant - it recurses. The work around for now is doing 'use pcFunctions' in Merchant, and then using the explicit package name on the calls in pcFunctions (Merchant::*) instead of doing the include. Is this the best way to handle it?

  • Current Music
    office buzz
Zoner en fuego!

Got any nice XML::LibXML examples?

I'm one of those people for whom a good example can gel something faster than an entire book. I've dug up a few examples of XML::LibXML from Google, but I thought I'd throw out the net and see if anyone has a prefered example set that I should check out. Thanks.
  • Current Music
    quiet office