develooper Front page | perl.perl6.language | Postings from February 2001

Re: End-of-scope actions: Toward a hybrid approach.

Thread Previous | Thread Next
From:
Simon Cozens
Date:
February 20, 2001 06:19
Subject:
Re: End-of-scope actions: Toward a hybrid approach.
Message ID:
20010220141918.A3700@pembro26.pmb.ox.ac.uk
On Tue, Feb 20, 2001 at 01:49:45AM -0500, schwern@pobox.com wrote:
> On Tue, Feb 20, 2001 at 02:14:52AM +0000, Simon Cozens wrote:
> > > Yes.  And the modules on CPAN that already do this are interesting too.
> > 
> > Oh, bother. Oh well, I've got builtinify (which was actually the point of the
> > exercise) and they haven't, so I'm happy. :)
> 
> Something like Function::Override then? 

Sort of. What I really wanted to do was to be able to say

sub foo { ... }
builtinify(foo);

package bar;
foo(); # Refers to main::foo
package baz;
foo(); # Refers to main::foo

(this is so that the forthcoming Safety::First module can produce exported
functions available throughout the program) which is easily done if you mess
with UNIVERSAL::AUTOLOAD, but what if the user has their own
UNIVERSAL::AUTOLOAD? You need to make sure your version runs first, optionally
passing on control to theirs, which you can to be adding a pre-hook. So I had
to implement pre-hooks. :)

> Want to merge implementations?

I'm open to offers. Take a look at S::V and tell me what you think.

-- 
Jenkinson's Law:
	It won't work.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About