Go Back   CodingForums.com > :: Server side development > Perl/ CGI

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-14-2003, 04:14 PM   PM User | #1
chrisbragg
New Coder

 
Join Date: Apr 2003
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
chrisbragg is an unknown quantity at this point
testing a module's loading ability

Hello

Let's say I want to load the module [use CGI;]. How can I make a test that will let me know whether that module can load successfully or not?

Something like:

if (use CGI){print 'hurray';}
else{print 'sad face';}

... but something that actually works.


thank you!
__________________
- nothing
chrisbragg is offline   Reply With Quote
Old 11-14-2003, 07:05 PM   PM User | #2
Jeff Mott
Regular Coder

 
Join Date: Sep 2003
Posts: 290
Thanks: 0
Thanked 0 Times in 0 Posts
Jeff Mott is an unknown quantity at this point
Code:
eval { require CGI; };
print $@ ? 'sad face' : 'hurray';
Jeff Mott is offline   Reply With Quote
Old 11-14-2003, 08:54 PM   PM User | #3
chrisbragg
New Coder

 
Join Date: Apr 2003
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
chrisbragg is an unknown quantity at this point
Excellent.

I had tried the eval statement like this [eval(require CGI)] but didn't realise it could be used with the brakets [eval{1;}]

Thank you!
__________________
- nothing
chrisbragg is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:35 AM.


Advertisement
Log in to turn off these ads.