[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: exceptions.pl
File is not writable. Editing disabled.
# exceptions.pl # tchrist@convex.com # # This library is no longer being maintained, and is included for backward # compatibility with Perl 4 programs which may require it. # # In particular, this should not be used as an example of modern Perl # programming techniques. # # # Here's a little code I use for exception handling. It's really just # glorfied eval/die. The way to use use it is when you might otherwise # exit, use &throw to raise an exception. The first enclosing &catch # handler looks at the exception and decides whether it can catch this kind # (catch takes a list of regexps to catch), and if so, it returns the one it # caught. If it *can't* catch it, then it will reraise the exception # for someone else to possibly see, or to die otherwise. # # I use oddly named variables in order to make darn sure I don't conflict # with my caller. I also hide in my own package, and eval the code in his. # # The EXCEPTION: prefix is so you can tell whether it's a user-raised # exception or a perl-raised one (eval error). # # --tom # # examples: # if (&catch('/$user_input/', 'regexp', 'syntax error') { # warn "oops try again"; # redo; # } # # if ($error = &catch('&subroutine()')) { # catches anything # # &throw('bad input') if /^$/; sub catch { package exception; local($__code__, @__exceptions__) = @_; local($__package__) = caller; local($__exception__); eval "package $__package__; $__code__"; if ($__exception__ = &'thrown) { for (@__exceptions__) { return $__exception__ if /$__exception__/; } &'throw($__exception__); } } sub throw { local($exception) = @_; die "EXCEPTION: $exception\n"; } sub thrown { $@ =~ /^(EXCEPTION: )+(.+)/ && $2; } 1;
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server05.hostinghome.co.in
Server IP: 192.168.74.40
PHP Version: 7.4.33
Server Software: Apache
System: Linux server05.hostinghome.co.in 3.10.0-962.3.2.lve1.5.81.el7.x86_64 #1 SMP Wed May 31 10:36:47 UTC 2023 x86_64
HDD Total: 1.95 TB
HDD Free: 691.83 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Disabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: itsweb
User ID (UID): 1619
Group ID (GID): 1621
Script Owner UID: 1619
Current Dir Owner: N/A