Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Creating packages on the fly

by Jouke (Curate)
on Jun 06, 2006 at 09:16 UTC ( #553776=note: print w/replies, xml ) Need Help??


in reply to Re: Creating packages on the fly
in thread Creating packages on the fly

First of all, thanks! This is indeed what I want to achieve. The UNIVERSAL::AUTOLOAD sub will of course do more checking than just this to implement what I want.

However, like you said, this may not be a good idea. What if more people start using this scheme? Then things will break immediately. I'm pretty sure I can catch that by checking if UNIVERSAL::AUTOLOAD has already been defined (right?).

nevertheless this may just be the push in the right direction I need


Jouke Visser
Using Perl to enable the disabled: pVoice

Replies are listed 'Best First'.
Re^3: Creating packages on the fly
by gellyfish (Monsignor) on Jun 06, 2006 at 09:22 UTC

    Yeah, I can't see any reason why you couldn't (say in the import() of the module that defines this) save any existing UNIVERSAL::AUTOLOAD and then call that at some point in your version, of course you might be stuffed if (as some more normal AUTOLOAD subroutines do) it does goto &{$AUTOLOAD};. However I don't actually know of anything that uses this hack in the wild.

    /J\

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://553776]
help
Chatterbox?
[shmem]: Discipulus: the <<>> operator is quite new, it is in perl5.24 for instance
[Discipulus]: ah! thanks shmem it works in strawberry 5.24
[shmem]: ah. Introduced in 5.22.0, see perl5220delta
[Discipulus]: if so the previous error is a bit misleading, anyway
[shmem]: well, previous to that << was always treated as the left-shift operator
[Eily]: or the here-doc operator
[Eily]: which is actually how it is parsed in this case
[shmem]: older versions of perl can't guess that "use of <<>> may be implemented someday" :D
Discipulus how much wise my brothers are? ;=)

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2017-07-21 09:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (320 votes). Check out past polls.