Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: conditional enable use bytes for a whole module at compiletime?

by broquaint (Abbot)
on Nov 19, 2004 at 15:49 UTC ( #409019=note: print w/ replies, xml ) Need Help??


in reply to conditional enable use bytes for a whole module at compiletime?

Since you simply want to conditionally include a lexically scoped module at compile-time it sounds like the if module will do the job. If adapted to your example code it looks to work just fine:

BEGIN { $Y::VERSION = 0.1 } { package X; use if ( $Y::VERSION < 1 ), "bytes"; sub l { return length shift } } no bytes; print X::l( chr 3456 ); __output__ 3
HTH

_________
broquaint


Comment on Re: conditional enable use bytes for a whole module at compiletime?
Download Code
Replies are listed 'Best First'.
Re^2: conditional enable use bytes for a whole module at compiletime?
by borisz (Canon) on Nov 19, 2004 at 16:03 UTC
    Thats what I searched for!. Thanks.
    Boris

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2015-07-30 03:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls