Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2016-12-10 07:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (160 votes). Check out past polls.