here is the another packagepackage Tools; sub new { my ($caller, %args) = @_; my $caller_is_obj = ref($caller); my $class = $caller_is_obj || $caller; my $self = bless [], $class; return $self; } sub DIRUtil { my $self = shift; my ($path, $dirname, $option) = @_; if ($option eq "-c") { print $path."\n"; chdir($path) or die "$!"; mkdir ("xxx") or die "$!"; } }
here is the plpackage Agent my $Utils = new Tools; sub new { my ($caller, %args) = @_; my $caller_is_obj = ref($caller); my $class = $caller_is_obj || $caller; my $self = bless [], $class; return $self; } sub checkPackage { my $this = shift; my $package = "SB"; opendir(DIR, "D:/\box/\/\somthing/\SB") or $Utils->DIRUtil( "D:\/b +ox\/something", "SB", "-c"); }
ok, what i'm doing here, if there'nt a folder called SB, then the DIRUtil will create one, what i want to know is after creating the folder, i want the DIRUtil to callback the invoking function, here it is checkPackage, i don't want to hard code the checkPackage inside the DIRUtil, is there any way to call back the invoking function ?, there may be other functions calling the DIRUtil. note: im aware of typo error or any mis-spelled words/sentence, and well any lexicals, plz ingore those errors. thanks.$agent->checkPackage();
In reply to re-calling called functions by opensourcer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |