in reply to Detecting modules in use?
come to think of it, you can just do the following: exists $::{'DBI::'} to check if HTTP::Request is loaded, do the following: exists $::{'HTTP::'} && exists $HTTP::{'Request::'} i think you can do this too:
so, to conclude here is code that loads DBI unless DBI is already loaded (or someone else has a package called DBI, or someone is screwing with the symbol table, or someone is blindly creating variables in the main namespace from CGI variables, etc. don't anyone say i didn't warn them.) unless (defined %DBI::) { use DBI; }$DBI_loaded = defined %DBI::; # or $HTTP_Request_Loaded = defined %HTTP::Request::;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Detecting modules in use?
by KM (Priest) on May 29, 2000 at 23:51 UTC | |
|
RE: Re: Detecting modules in use?
by BBQ (Curate) on May 29, 2000 at 07:51 UTC | |
by t0mas (Priest) on May 29, 2000 at 13:44 UTC | |
by mdillon (Priest) on May 29, 2000 at 08:13 UTC |