in reply to Re: A metaclosure? Howto?
in thread A metaclosure? Howto?

Hmm. While the idea is interesting the implementation scares the willies out of me. Lets hope that a real version would check to make sure that $name is of a legal value. Imagine what would happen if $name was 'precompare' for a simple example. Or open()....

Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.

Replies are listed 'Best First'.
Re: Re: Re: A metaclosure? Howto?
by educated_foo (Vicar) on May 13, 2002 at 14:15 UTC
    I suppose it could refuse to redefine a sub that already exists, instead of just complaining. On the other hand, "package::open" wouldn't trounce "CORE::open", it would just lead to unexpected behavior (or maybe a warning). And if you redefined "precompare", you wouldn't be able to use it any more. But then again, if you did this, you probably wouldn't deserve to use "precompare" in the first place... Perl has a lot of chainsaws, and it's great fun to use them with reckless abandon.

    /s

      Well, "unexpected behaviour" in the module would include files not opening, and there would be no apparent reason for it. I would say that without some defensive code using this technique would be well beyond "reckless abandon", more like "reckless negligence".

      But its true... danger can be fun. ;-)

      YIKES! This was my 500th post. :-)

      Yves / DeMerphq
      ---
      Writing a good benchmark isnt as easy as it might look.

        well beyond "reckless abandon", more like "reckless negligence".
        But its true... danger can be fun. ;-)
        And it's only a crime if you get caught...