Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: What happens when you load the same module twice?

by weierophinney (Pilgrim)
on Feb 10, 2005 at 18:54 UTC ( #429872=note: print w/replies, xml ) Need Help??


in reply to Re^2: What happens when you load the same module twice?
in thread What happens when you load the same module twice?

Because calling 'use File::Basename();' tells the compiler to import an empty list -- in other words, do not import anything. The issue at hand is that File::Basename and File::Basename are both trying to import subroutines into the main:: namespace by default.
  • Comment on Re^3: What happens when you load the same module twice?

Replies are listed 'Best First'.
Re^4: What happens when you load the same module twice?
by eric256 (Parson) on Feb 10, 2005 at 19:39 UTC

    So the import is the part that is creating redifined errors not the processing of the module file?


    ___________
    Eric Hodges
Re^4: What happens when you load the same module twice?
by Anonymous Monk on Feb 11, 2005 at 09:42 UTC
    No. It has nothing at all to do with importing names twice. Not convinced? Run this code:
    #!/usr/bin/perl use strict; use warnings; use File::Basename (); # Not calling import! BEGIN {delete $INC{"File/Basename.pm"}}; use File::Basename (); # Not calling import! __END__ Subroutine fileparse_set_fstype redefined at /usr/lib/perl5/lib/5.8.6/ +File/Basename.pm line 157. Subroutine fileparse redefined at /usr/lib/perl5/lib/5.8.6/File/Basena +me.pm line 171. Subroutine basename redefined at /usr/lib/perl5/lib/5.8.6/File/Basenam +e.pm line 238. Subroutine dirname redefined at /usr/lib/perl5/lib/5.8.6/File/Basename +.pm line 251.
    Can we now please stop this myth that redefining subroutines has anything to do with import?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2020-12-04 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (58 votes). Check out past polls.

    Notices?