Does a <Perl> section know where it is?

Does a <Perl> section know where it is?

am 23.02.2006 00:43:32 von Tyler MacDonald

I've been poking around in the documentation but I can't seem to
find this... Is there any way for a section in a httpd.conf file to
know what file it's been evaluated out of? Ideally I'd like to be able to do
something similar to this for packaging mod_perl handlers and apache
configuration together:


use File::Basename ();
use File::Spec ();
my $me = Apache2::PerlSections->filename;
unshift @INC, File::Spec::catfile(File::Basename::dirname($me), "perl5lib");


Thanks,
Tyler

Re: Does a <Perl> section know where it is?

am 23.02.2006 01:19:44 von jonathan vanasco

is this what you want?
$apr->location()


On Feb 22, 2006, at 6:43 PM, Tyler MacDonald wrote:

> I've been poking around in the documentation but I can't seem to
> find this... Is there any way for a section in a httpd.conf
> file to
> know what file it's been evaluated out of? Ideally I'd like to be
> able to do
> something similar to this for packaging mod_perl handlers and apache
> configuration together:
>
>
> use File::Basename ();
> use File::Spec ();
> my $me = Apache2::PerlSections->filename;
> unshift @INC, File::Spec::catfile(File::Basename::dirname($me),
> "perl5lib");
>

>
> Thanks,
> Tyler
>

Re: Does a <Perl> section know where it is?

am 23.02.2006 01:28:58 von jonathan vanasco

Correction:

$apr->location

no ()

its not a method. sorry about that.

On Feb 22, 2006, at 7:19 PM, Jonathan Vanasco wrote:

>
> is this what you want?
> $apr->location()

Re: Does a <Perl> section know where it is?

am 23.02.2006 01:32:58 von Tyler MacDonald

Jonathan Vanasco wrote:
>
> is this what you want?
> $apr->location()


What class is that method a part of? I didn't see anything about
"location" in PerlSections...

Apache2::Directive seems to have what I'm after (filename and
line_num methods), if I cold only get a Apache2::Directive object
representing the current section..

- Tyler

Re: Does a <Perl> section know where it is?

am 23.02.2006 01:43:31 von jonathan vanasco

its part of Apache Request

it should be the location container

i misinterpreted yoru question though. sorry about that .. its not
what you needed. i thought you meant what directory mapping its
being evaluated from.

you're looking for the mod_perl equivalent of the php scriptname or
whatever its called. that i don't know.

sorry for the confusion.



On Feb 22, 2006, at 7:32 PM, Tyler MacDonald wrote:

> What class is that method a part of? I didn't see anything about
> "location" in PerlSections...
>
> Apache2::Directive seems to have what I'm after (filename and
> line_num methods), if I cold only get a Apache2::Directive object
> representing the current section..
>
> - Tyler
>

Re: Does a <Perl> section know where it is?

am 23.02.2006 01:47:33 von Tyler MacDonald

You know what?

The mod_perl people are freaking geniuses.

This works:


warn __FILE__, " - ", __LINE__, "\n";


crackerjack:/home/faraway/dev# apache2ctl stop
/home/faraway/dev/test.conf - 5


That is sooooooooo slick!

- Tyler




Jonathan Vanasco wrote:
>
> its part of Apache Request
>
> it should be the location container
>
> i misinterpreted yoru question though. sorry about that .. its not
> what you needed. i thought you meant what directory mapping its
> being evaluated from.
>
> you're looking for the mod_perl equivalent of the php scriptname or
> whatever its called. that i don't know.
>
> sorry for the confusion.
>
>
>
> On Feb 22, 2006, at 7:32 PM, Tyler MacDonald wrote:
>
> > What class is that method a part of? I didn't see anything about
> >"location" in PerlSections...
> >
> > Apache2::Directive seems to have what I'm after (filename and
> >line_num methods), if I cold only get a Apache2::Directive object
> >representing the current section..
> >
> > - Tyler
> >
>

Re: Does a <Perl> section know where it is?

am 23.02.2006 23:18:57 von gozer

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig29AA9D0425219DCEC17D30C6
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Tyler MacDonald wrote:
> You know what?
>
> The mod_perl people are freaking geniuses.
>
> This works:
>
>
> warn __FILE__, " - ", __LINE__, "\n";
>


That's a feature, actually. I am afraid it isn't documented
anywhere though, so +1 for finding this solution ;-)

A bonus point would be awarded for a documentation patch ;-)

------------------------------------------------------------ --------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

--------------enig29AA9D0425219DCEC17D30C6
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFD/jTRyzKhB4jDpaURA4UOAKDBkfQ7tzdMTWRe8bPcUG1HjH+OtQCe O/6/
EthHKiNmEekb+CBM9zfnLiY=
=zccG
-----END PGP SIGNATURE-----

--------------enig29AA9D0425219DCEC17D30C6--