Perrin Harkins wrote:
Stas Bekman wrote:

it's not the same. this call is:

Apache::RequestUtil::is_initial_req('Apache::RequestUtil', $r)

Right. That's what it should be, in my opinion. The $r object is not an instance of Apache::RequestUtil, so why would we want to call this method on $r?

but Apache::RequestUtil::is_initial_req expect an object blessed into Apache::RequestRec. So:


$r->is_initial_req();

is fine.

Heh, I guess we have lost the track of who wants what. I started this thread exactly suggesting to eliminate this obscurity and not advocating for it.


I'm for removing the Apache:: stuff you talked about and also clearing up the confusion caused by having classes like Apache::RequestUtil apparently defining methods in Apache::RequestRec.

This seems to be what Boris is complaining about too, i.e. why does he have to load a whole bunch of separate modules if all of them just add things to $r?

that's what I've just suggested (Josh's idea). Though it's better be some other common name which will handle any groups and not Apache::RequestRec, because you don't necessarily need Apache::RequestRec at all.


Huh? Isn't $r an instance of Apache::RequestRec? If not, what is it?

It is. But you are confusing the name of the class 'Apache::RequestRec' with a module Apache/RequestRec.(pm|so). You can perfectly use $r w/o ever loading the module Apache/RequestRec.(pm|so).


Here is an example:

  package MyLog;
  use Apache::Log;
  use Apache::Const -compile => 'OK';
  sub handler {
      my $r = shift;
      $r->log_error("whatever");
      return Apache::OK;
  }

I'm not a big fan of using the import() hooks like that. For one thing, CGI.pm doesn't die if you try to use something that you didn't pre-compile.

to be efficient it needs to do: goto &$AUTOLOAD; after loading Apache::RequestUtil, so it'll happen only once.


It could do that. Actually, within the context of these other classes that add stuff to $r, why can't they be AUTOLOADed? It doesn't seem like it would require a UNIVERSAL::AUTOLOAD, since all the methods are being called on one class.

Where would you install AUTOLOAD? In which class? Any class can be not loaded when you are looking for another method in yet another not yet loaded class.


What if you don't load 'Apache::RequestRec'? Who is going to load that wrapper?

You're confusing me again. Is $r not an instance of Apache::RequestRec?

see above.


What if people do load Apache::RequestUtil:

$r->is_initial_req($self)

now you've sub redefined in either of the two modules.


I'm not following. What is $self in this example?

sorry, copy-n-paste from your wrapper. Should be:


$r->is_initial_req()

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


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



Reply via email to