Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Runtime module use and sub definitions

by derby (Abbot)
on Apr 03, 2002 at 20:47 UTC ( [id://156433]=note: print w/replies, xml ) Need Help??


in reply to Runtime module use and sub definitions

Well, not too much more elegant but you could use autouse

#!/usr/bin/perl # # Bad code - will not work # use strict; use warnings; if ($^O eq 'MSWin32') { use autouse 'MyMod_W32' => qw( bar ); } else { use autouse 'MyMod' => qw( bar ); } bar();

update: Well that's what happens when you post untested code! This will not work. Duh. The 'use' happens at compile time. The last bar defined is the first one used.

-derby

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-16 04:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found