Forum Discussion
Charles_Harris
Nimbostratus
Jan 13, 2006Perl Scripting (iControl) error handling...
Hi All,
I'm currently writting my first iControl based app using perl to monitor / react to a very simple scenario but I've come across a problem and I'm stumped.....
How can I handle errors, without the perl script stopping? - I need to be able to output friendly error messages and log them for further investigation....
eg. Wrong login credentials supplied etc.....
Thanks in advance!
-=ChaZ=-
- The only way I know how to do is is by wrapping the code with an eval
---------------------------------------------------------------------------- listPools ---------------------------------------------------------------------------- sub listPools() { eval { $soapResponse = $Pool->get_list(); }; if ( $@ ) { print "Error occurred\n"; print "Error details: $@\n"; } else { &checkResponse($soapResponse); my @pool_list = @{$soapResponse->result}; print "Available Pools:\n"; foreach $pool (@pool_list) { print " $pool\n"; } } }
- Charles_Harris
Nimbostratus
Hi Joe, - Charles_Harris
Nimbostratus
Hi again...... - I gave you an example in my post above. You wrap an eval around the method call.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects