in reply to Another "Find the bug!" Node

I'll reveal my ignorance by saying this is all a bit esoteric for me. What were you trying to do with Package1 and Package2?

Yes, I read the spoilers.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Replies are listed 'Best First'.
Re^2: Another "Find the bug!" Node
by Ovid (Cardinal) on Sep 28, 2006 at 13:33 UTC

    I can't quite say for NDA reasons, but someone wrote a package, Package2, which attempted to provide all of Package1's functionality. They also added an extra subroutine, 'foobar', which could be exported. However, if something in your codebase loads Package2 and later you try to load Package1, it's already loaded and when it tries to export 'foobar', it blows up because it doesn't have it. The solution is to do a deep copy on the arrays. Otherwise, because Package2 has a reference to an array in Package1, modifying the array in Package2 modifies the same array in Package1. Does that make sense?

    I know it sounds a bit convoluted, but there it is :)

    Cheers,
    Ovid

    New address of my CGI Course.

      Yes, now that makes sense .. thanks. That might provide an interesting topic for a Meditation, about the pitfalls surounding the construction of a wrapper for a Perl module.

      Having written TSR's in both assembler and C for DOS, I understand how things can get a little mind-bendingly complicated.

      Alex / talexb / Toronto

      "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds