Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

pragma and typeglobs

by shmem (Chancellor)
on Aug 08, 2017 at 20:08 UTC ( #1197036=perlquestion: print w/replies, xml ) Need Help??
shmem has asked for the wisdom of the Perl Monks concerning the following question:

There's a facility to resolve lexical function/method lookup via %^H at runtime - pragma. Subroutine dispatching can be handled e.g. via inspection of %^H inside an AUTOLOAD block. Is there such a way for lookup of other typeglob entries? If not, shouldn't that be implemented, if only for the sake of orthogonality?

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re: pragma and typeglobs
by stevieb (Abbot) on Aug 08, 2017 at 21:46 UTC

    I'm intrigued. I've never run into the need, nor have I ever read that doc before. For that reason (ie. lack of insight/knowledge), do you have any example use cases for doing this with other typeglobs that you could share that you think could be useful?

    Perhaps with some scenarios, the less-knowledgeable monks in this area may have some thoughts on your latter question.

      This is about an attempt to make packages lexically scoped. See RFC: pragma pragmatic; follow-ups there please ;-)

      perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1197036]
Approved by marto
Front-paged by marto
and cookies bake in the oven...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2018-07-19 19:44 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (417 votes). Check out past polls.