Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Apr 2003
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Regular Coder
    Join Date
    Sep 2003
    Posts
    290
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    eval { require CGI; };
    print $@ ? 'sad face' : 'hurray';

  • #3
    New Coder
    Join Date
    Apr 2003
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •