Philippe M. Chiasson wrote:
On Mon, 2003-12-15 at 16:09, Stas Bekman wrote:

Philippe M. Chiasson wrote:

On Sun, 2003-12-14 at 18:33, Stas Bekman wrote:


The following is yet another attempt to avoid collisions between Apache::compat and the real mp2 APIs.

[...]


+}
+EOI
+
+    'Apache::RequestRec::finfo' => <<'EOI',
+{
+    require APR::Finfo;
+    my $finfo_sub = *APR::Finfo::finfo{CODE};
+    sub Apache::RequestRec::finfo {
+        my $r = shift;
+        stat $r->filename;
+        \*_;
+    }
+    $finfo_sub;
+}
+EOI
+);


Why make this code a SCALAR, instead of creating an anonymous sub right
there?

What do you mean?


I meant:

'Apache::RequestRec::finfo' => sub {
require APR::Finfo;
my $finfo_sub = *$APR::Finfo::finfo{CODE};
*Apache::RequestRec::finfo{CODE} = sub { my $r = shift;
stat $r->filename;
\*_;
}
return $finfo_sub;
} }


That way, in mp2_override_api() you don't have to do that extra eval,
and can just call this anonsub directly, no ?

That's not the same thing. If you do that than you need to run this anon sub to get the CODE ref. So why not just eval that code. I can't see how it better than just having a string of code to be evaled only if it's ever going to be used.




__________________________________________________________________
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