[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgiapp] Re: Correction in Wrapper Script Example


Hi again,

> > Could Eric or someone provide some examples of how we could take advantage 
> > of this new method? What modules do you use?

While trying to write a wrapper class for my own module, I realized that the
example code I sent this morning had a big goof in it.

The example wrapper class looked like this:

>  sub param {
>      my $self         = shift;
>      my @params       = @_;
>      my $cgi_base_obj = $self->query;
> 
>      return $cgi_base_obj->var( @params );
>  }

The line "my $cgi_base_obj = $self->query;" is unnecessary.  I wrote this
thinking that $self was a CGI::Application object, which is incorrect.  $self
is a query object -- in this case, a CGI::Base object.  So instead, that
function should look like:

  sub param {
      my $self   = shift;
      my @params = @_;

      return $self->var( @params );
  }

And the header function should look something like:

  sub header {
      my $self   = shift;
      my @params = @_;

      return $self->SendHeaders( @params );
  }

Again, this isn't tested as I'm not using CGI::Base.  But this should bring it
a bit closer to working, as the previous code was blatently incorrect :-)

Hope I didn't throw anyone too far off the track :-)
  -Eric


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.