Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: Docs-dev

Method Handler

 

 

ModPerl docs-dev RSS feed   Index | Next | Previous | View Threaded


margol at beamartyr

Jun 2, 2003, 7:36 AM

Post #1 of 2 (980 views)
Permalink
Method Handler

(Half-comment, half-doc change below)

I don't have a specific patch (yet), but as I just used method handlers for
the first time, studying from the v1 guide, I thought I should point out
that the guide does not go out of it's way to remind the poor users about
mod_perl's namespace mess. Example:

If in mod_perl_start.pl you declare:
$obj=Object->new;

or even

our $obj=Object->new;

(in httpd.conf)

<Perl>
warn "Object is ".ref($obj);
</Perl>

$obj will be out of scope. Rememdy for non-experts is: ALWAYS FULLY DECLARE
OBJECTS TO BE USED WITH METHOD HANDLERS

Solution:

(mod_perl_start.pl).

$PermanentNamespace::Obj=Object->new

After writing all that, it occured to me that a better alternative is in one
of the existing examples on the page which use $My::Obj, simply specifically
point out that the "My::" prefix is for a namespace and should not be
confused with my $obj

Issac


---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe [at] perl
For additional commands, e-mail: docs-dev-help [at] perl


stas at stason

Jun 2, 2003, 5:02 PM

Post #2 of 2 (888 views)
Permalink
Re: Method Handler [In reply to]

Issac Goldstand wrote:
> (Half-comment, half-doc change below)
>
> I don't have a specific patch (yet), but as I just used method handlers for
> the first time, studying from the v1 guide, I thought I should point out
> that the guide does not go out of it's way to remind the poor users about
> mod_perl's namespace mess. Example:
>
> If in mod_perl_start.pl you declare:
> $obj=Object->new;
>
> or even
>
> our $obj=Object->new;
>
> (in httpd.conf)
>
> <Perl>
> warn "Object is ".ref($obj);
> </Perl>
>
> $obj will be out of scope. Rememdy for non-experts is: ALWAYS FULLY DECLARE
> OBJECTS TO BE USED WITH METHOD HANDLERS
>
> Solution:
>
> (mod_perl_start.pl).
>
> $PermanentNamespace::Obj=Object->new
>
> After writing all that, it occured to me that a better alternative is in one
> of the existing examples on the page which use $My::Obj, simply specifically
> point out that the "My::" prefix is for a namespace and should not be
> confused with my $obj

Good points Issac, patches are very welcome ;)

__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas [at] stason http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: docs-dev-unsubscribe [at] perl
For additional commands, e-mail: docs-dev-help [at] perl

ModPerl docs-dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.