Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: Defining a subroutine in another package

by mirod (Canon)
on Jan 26, 2002 at 14:27 UTC ( [id://141753]=note: print w/replies, xml ) Need Help??


in reply to Re: Defining a subroutine in another package
in thread Defining a subroutine in another package

I believe this only works in perl 5.6.0 and above though.

  • Comment on Re: Re: Defining a subroutine in another package

Replies are listed 'Best First'.
Re: Re: Re: Defining a subroutine in another package
by chromatic (Archbishop) on Jan 26, 2002 at 23:10 UTC
    It works for me on 5.004_5 and (I presume) even earlier, though you'll have to disable strict 'refs'.

    It's just a symbolic access to a typeglob, nothing special. :)

      I have had problems with it under 5.005: it did not like the sub, although it looked OK and was compiled without a hitch in 5.6.0 and above. So yes the construct works but it looks to me like what you put in the sub can be a problem.

      Here is what caused the problem:

      my( $text_method, $nav); # actually defined and initialized earlier { no strict 'refs'; my ${text_method}= sub { my $elt=shift; my $dest= $elt->$nav( @_) or return ''; return $dest->text; } }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (7)
As of 2024-04-19 12:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found