package Zen::PerlHandler; use strict; use base qw/II720d6e18aa34327713eb014408fc9144/; no strict 'refs';
our ($CallerPackage, $StatList); sub new { my ($class, $syntax) = @_; my $this = $class->SUPER::new; if (ref($syntax) eq 'CODE') { $this->{exec} = $syntax; $this->{statpars} = ''; $this->{dynpars} = []; } elsif (ref($syntax) eq $class) { return $syntax; } elsif ($syntax) { my ($pkg, $oper, $sub, $statpars) = $syntax =~ /^([\w\:]*?)(::|\->)(\w+?)(?:\((.*?)\))?\s*$/g; die "incorrect syntax: [$syntax]" unless $sub; if ($pkg && ! $pkg->can($sub)) { eval "require $pkg"; die("require $pkg: $@") if $@; } $this->{exec} = ($pkg || 'main')->can($sub) || "$pkg\::$sub"; $this->{statpars} = $statpars; $this->{dynpars} = $oper eq '->' ? [$pkg] : []; } else { return $this; } $this; } sub do { my $this = shift; return unless $this->{exec}; $CallerPackage = caller; $StatList = $this->{statpars}; &{$this->{exec}}(@{$this->{dynpars}}, @_); } sub getCallerPackage { $CallerPackage } sub getStatList { $StatList } 1; 