I'm an idiot.  "De-reference", how stupid!?!  The
problem was I was improperly accessing parameters
inside the subroutine.

Well, here's my GetSubName code, to make up for my
idiotic bandwidth hogging:

sub GetSubName
  { 
  my @callerPath = split(/::/, shift(@_)); 
  return $callerPath[$#callerPath];
  }

G

--- George Jempty <[EMAIL PROTECTED]> wrote:
> Though a newbie to both CGI::Application and OO, I
> intend a pretty sophisticated application, for
> instance using one regular expression as the naming
> convention for both my subroutines and templates. 
> So
> in setup() I am declaring:
> 
> $self->param
>   ('nameConv' => 
>   '(Insert|Update)?(Page)([1-9]\d*)(.*\.html)?'
>   );
> 
> Then, from each run mode subroutine, I want to call
> a
> custom helper subroutine that will match the name of
> the subroutine against the naming convention,
> _ideally_ as follows:
> 
> sub InsertPage1
>   {
>   my $self = shift;
>   my $callee = GetSubName((caller(0))[3]); 
>     #Another 'helper' subroutine
>     #$callee now holds "InsertPage1"
>   my ($dbMode, $prefix, $pageNum, $suffix) =
>     NameConvMatcher($callee);
> 
>   _etcetera_
> 
> However, I cannot assign $self->param('nameConv') to
> a
> lexical inside NameConvMatcher() because $self is
> out
> of scope.  And I can't just modify NameConvMatcher()
> to take a second argument and then pass
> $self->param('nameConv'), but rather I'd first have
> to
> "de-reference" into another variable as follows:
> 
> my $nameConv = $self->param('nameConv');
> 
> and then pass $nameConv.  It's bad enough, but
> unavoidable, that I have to assign $callee at the
> top
> of every run mode subroutine.  Is there a _good_ way
> (I can think of bad ones) I can at least avoid also
> having to de-reference $self-param('nameConv') into
> $nameConv at the top of every run mode sub, only to
> pass it to my custom helper subroutine?
> 
> Am I even making sense? ;)
> 
> Thanks in advance for any advice or tips, again
> bearing in mind that I'm a newbie with this module,
> and with OO.  Finally, please _personally_ copy me,
> as
> well as the group address, as I am subscribing only
> to
> the daily digest.
> 
> =====
> George M. Jempty
> Database Admin/Intranet Architect
> Regional West Medical Center
> Scottsbluff, Nebraska
> [EMAIL PROTECTED][EMAIL PROTECTED]
> 
> __________________________________________________
> Do You Yahoo!?
> Send your FREE holiday greetings online!
> http://greetings.yahoo.com
> 


__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to