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

Re^2: including modules during runtime and dealing with OS specific (constants) code block

by armstd (Friar)
on Aug 02, 2011 at 17:26 UTC ( #918110=note: print w/ replies, xml ) Need Help??


in reply to Re: including modules during runtime and dealing with OS specific (constants) code block
in thread including modules during runtime and dealing with OS specific (constants) code block

First, the functions, SetAttributes and GetAttributes, must be specifically requested:
use Win32::File qw(:DEFAULT SetAttributes GetAttributes);

That would not actually make any difference here. The only difference it would make is allowing this syntax:

GetAttributes()

Instead of this:

Win32::File::GetAttributes()

...which is not being attempted here. That specification just tells import() what to bring into the current package namespace from the module.

The issue in play here is the 'eval', which gives the compiler no idea what will be available at runtime. So it fails at compile time. In your 'fixed' example, it's working not because of your added imports, its working because you removed the 'eval'.

--Dave


Comment on Re^2: including modules during runtime and dealing with OS specific (constants) code block
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2014-07-29 04:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (211 votes), past polls