opensourcer has asked for the wisdom of the Perl Monks concerning the following question:
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();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: re-calling called functions
by brian_d_foy (Abbot) on Oct 28, 2006 at 19:40 UTC | |
|
Re: re-calling called functions
by tsee (Curate) on Oct 28, 2006 at 18:42 UTC | |
|
Re: re-calling called functions
by GrandFather (Saint) on Oct 28, 2006 at 19:34 UTC |