Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

RE: Call Subroutines by Approximate Name (poetic license)

by osfameron (Hermit)
on Aug 07, 2000 at 00:13 UTC ( #26447=note: print w/replies, xml ) Need Help??


in reply to Call Subroutines by Approximate Name

--Not at all sure why anyone would want to do this...

How about for Perl poetry? Rename the module to "Poetic" perhaps playing about with the name you give it so that you can declare:

use Poetic ':license';
for example. The mind boggles thinking what else could be exported. Poetic 'anguish' anybody?

On an only slightly more serious note: would it be possible for the module to call core routines by approximate names alse ?

subb teste { prynte "testyng"; }

Osfameron

Replies are listed 'Best First'.
RE: RE: Call Subroutines by Approximate Name (poetic license)
by tilly (Archbishop) on Aug 07, 2000 at 01:48 UTC
    If you check, sub is not a function. OTOH I see no reason why prynte would be particularly hard to do. After all you can find the core functions in the CORE:: namespace...
      Um, yes, getting a bit carried away there methinks...
      How do I get a list of the core functions though? If I do a print join "\n", keys %CORE::; this just gives  GLOBAL:: .

      (Or point me to the relevant documentation...)

      Osfameron

        Ack. Very good question. Never tried that. I seem to have aquired a foot in my mouth.

        You can get to any core function through CORE. For instance if you override print you can still call the real one as CORE::print. OTOH that does seem to be hacked in at a low level. I cannot figure out how to find it.

        Normally, of course, your %package:: would work. But not in this case. :-(

        BTW if you are curious, perlsub says that if you override a function in CORE::GLOBAL you will override the built-in in all namespaces. I didn't know that. I don't think that I particularly wanted to either...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://26447]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2020-02-29 01:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (128 votes). Check out past polls.

    Notices?