Return-Path: X-Original-To: apmail-perl-modperl-archive@www.apache.org Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2514A1847D for ; Thu, 16 Jul 2015 00:13:07 +0000 (UTC) Received: (qmail 82149 invoked by uid 500); 16 Jul 2015 00:13:06 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 82110 invoked by uid 500); 16 Jul 2015 00:13:06 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 82099 invoked by uid 99); 16 Jul 2015 00:13:06 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 16 Jul 2015 00:13:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id F2C91182815 for ; Thu, 16 Jul 2015 00:13:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 4.001 X-Spam-Level: **** X-Spam-Status: No, score=4.001 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, KAM_LAZY_DOMAIN_SECURITY=1, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id jDsNIAMXFJtf for ; Thu, 16 Jul 2015 00:12:52 +0000 (UTC) Received: from mail-oi0-f44.google.com (mail-oi0-f44.google.com [209.85.218.44]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTPS id 0A44B20D76 for ; Thu, 16 Jul 2015 00:12:51 +0000 (UTC) Received: by oige126 with SMTP id e126so40008124oig.0 for ; Wed, 15 Jul 2015 17:12:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=nrmBPs7j8+aEwJGECAG+3XiRgJMKVbiFcGZOBBxRxr8=; b=AJ9iDHM3VgO5h/IWZbt9E2kl0H4UF+P0Kbsq7cRjDeFy0F9Ded2QB1vvwI7lMARgpP 8jI8nFBAWfTJj0OjMHqSNW7HXEvAkc0oP9W6fSMFc9qr8Wu+ZAbr4mF4IcePHnnxXUy/ PB+wz97mAGm1wUW6KgcZCcODuviONITWeYn0PCErcH+Aeh6HUMLkgJxecFnb3KHrNDTE wJTEk+QQmldHLvsa/lJoiYKJAYN/hdeenoza1JR1BrKw+r7bQsGPAC4WH8bkOCBNJ8uT 8o0Hamuq71B3/7HrHRSBuj2J5ryrX7kkOAcdBY58o6xw+4pK59CWB8I9cAdvMkbswfrv qsug== X-Gm-Message-State: ALoCoQmvUWP9o/hq3Z95H8G8+hPzTBT+0I2NSgTMKrnAQUOvdVss279yfPRV/Uguo8z2zGylkhJm MIME-Version: 1.0 X-Received: by 10.182.135.202 with SMTP id pu10mr6350562obb.52.1437005570924; Wed, 15 Jul 2015 17:12:50 -0700 (PDT) Received: by 10.202.4.207 with HTTP; Wed, 15 Jul 2015 17:12:50 -0700 (PDT) In-Reply-To: References: <55A6F5D8.505@jhmg.net> Date: Wed, 15 Jul 2015 20:12:50 -0400 Message-ID: Subject: Re: PerlSetVar inside doesn't seem to work From: John Dunlap To: jhg@acm.org Cc: mod_perl list Content-Type: multipart/related; boundary=089e0129400498dfa2051af2ee47 --089e0129400498dfa2051af2ee47 Content-Type: multipart/alternative; boundary=089e0129400498df9e051af2ee46 --089e0129400498df9e051af2ee46 Content-Type: text/plain; charset=UTF-8 *within a On Wed, Jul 15, 2015 at 8:12 PM, John Dunlap wrote: > I'm also using a virtual host, though I place my PerlSetVar without a > . This is the code that I use to extract them: > > foreach my $apache_key (CORE::keys %{$apache->dir_config}) { > $literals{$apache_key} = $apache->dir_config->{$apache_key}; > } > > In this example, $apache is an instance of Apache2::RequestRec > > On Wed, Jul 15, 2015 at 8:07 PM, Jim Garrison wrote: > >> I have the following config >> >> >> > >> > >> > ... >> > >> > PerlOptions +Parent >> > PerlSwitches -T -w -I/home/pdxep/gallery >> > >> > PerlModule Apache2::Reload >> > PerlModule Album >> > PerlModule env >> > >> > >> > >> > PerlInitHandler Apache2::Reload >> > >> > PerlSetVar app_dir /var/webapp >> > PerlSetVar template_dir /templates >> > PerlSetVar albums_dir /albums >> > PerlSetVar static_url /static >> > PerlSetVar albums_url /albums >> > >> > SetHandler perl-script >> > PerlResponseHandler Album >> > >> > >> > >> > >> > SetHandler perl-script >> > PerlResponseHandler env >> > >> > >> > >> >> My handler script (Album.pm) retrieves the variables with >> >> my $s = Apache2::ServerUtil->server; >> my $app_dir = $s->dir_config('app_dir'); >> my $template_dir = $app_dir . $s->dir_config('template_dir'); >> >> However it's getting empty strings for the values. This was working >> when the PerlSetVar directives were outside the VirtualHost block. >> >> According to the documentation >> >> >> https://perl.apache.org/docs/2.0/user/config/config.html#mod_perl_Directives_Argument_Types_and_Allowed_Location >> >> PerlSetVar is scoped "DIR" meaning it can appear in Directory, >> Location or Files blocks. What am I doing wrong? >> >> -- >> Jim Garrison (jhg@acm.org) >> PGP Keys at http://www.jhmg.net RSA 0x04B73B7F DH 0x70738D88 >> > > > > -- > John Dunlap > *CTO | Lariat * > > *Direct:* > *john@lariat.co * > > *Customer Service:* > 877.268.6667 > support@lariat.co > -- John Dunlap *CTO | Lariat * *Direct:* *john@lariat.co * *Customer Service:* 877.268.6667 support@lariat.co --089e0129400498df9e051af2ee46 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
*within a <Directory>

On Wed, Jul 15, 2015 at 8:12 PM, John Dunl= ap <john@lariat.co> wrote:
I'm also using a virtual host, though I place my PerlSet= Var without a <Directory>. This is the code that I use to extract the= m:

=C2=A0 =C2=A0 =C2=A0 =C2=A0 foreach my $apache_k= ey (CORE::keys %{$apache->dir_config}) {
$literals{$apache_key} =3D $apache->dir_config= ->{$apache_key};
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }

In this example, $apache is an instance of=C2=A0Apache2::Re= questRec

<= div class=3D"gmail_quote">On Wed, Jul 15, 2015 at 8:07 PM, Jim Garrison <jhg@jh= mg.net> wrote:
I have the f= ollowing config


>=C2=A0 =C2=A0 =C2=A0<VirtualHost [redacted]:80>
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0...
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PerlOptions +Parent
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PerlSwitches -T -w -I/home/pdxep/gall= ery
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PerlModule Apache2::Reload
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PerlModule Album
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PerlModule env
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<Location /gallery>
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PerlInitHandler Apache2= ::Reload
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PerlSetVar app_dir=C2= =A0 =C2=A0 =C2=A0 /var/webapp
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PerlSetVar template_dir= /templates
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PerlSetVar albums_dir= =C2=A0 =C2=A0/albums
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PerlSetVar static_url= =C2=A0 =C2=A0/static
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PerlSetVar albums_url= =C2=A0 =C2=A0/albums
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0SetHandler perl-script<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PerlResponseHandler Alb= um
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</Location>
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<Location /env>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0SetHandler perl-script<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0PerlResponseHandler env=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</location>
>
>=C2=A0 =C2=A0 =C2=A0</VirtualHost>

My handler script (Album.pm) retrieves the variables with

=C2=A0 =C2=A0 my $s =3D Apache2::ServerUtil->server;
=C2=A0 =C2=A0 my $app_dir=C2=A0 =C2=A0 =C2=A0 =3D $s->dir_config('ap= p_dir');
=C2=A0 =C2=A0 my $template_dir =3D $app_dir . $s->dir_config('templa= te_dir');

However it's getting empty strings for the values.=C2=A0 This was worki= ng
when the PerlSetVar directives were outside the VirtualHost block.

According to the documentation

https://perl.apache.org/docs/2.0/user/config/config.html#mod_pe= rl_Directives_Argument_Types_and_Allowed_Location

PerlSetVar is scoped "DIR" meaning it can appear in Directory, Location or Files blocks.=C2=A0 What am I doing wrong?

--
Jim Garrison (jhg@acm.org<= /a>)
PGP Keys at
http://www.jhmg.net RSA 0x04B73B7F DH 0x70738D88



--
John Dunlap
CTO |=C2=A0Lariat=C2=A0

=
Direct:

Customer Service:



--
John Dunlap
CTO |=C2=A0Lariat=C2=A0

<= span style=3D"color:rgb(153,153,153);font-family:tahoma,sans-serif;font-sty= le:normal">Direct:

Customer Service:
--089e0129400498df9e051af2ee46-- --089e0129400498dfa2051af2ee47 Content-Type: image/png; name="100x60.png" Content-Disposition: inline; filename="100x60.png" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: ii_hwm90qu91_146b4d583171a8e6 iVBORw0KGgoAAAANSUhEUgAAAGQAAAA8CAYAAACQPx/OAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz AAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAffSURB VHic7Zx/cFTVFcc/5+6+TQJECVZpBUZERmcQpWKnSrV2tDOdgUl/hLC0ZBcqpdmo1VpApTNiFVtb i6MRY0WSYFAI2izp0jqd0hla+4cjVloGOoIULVOwPyydseVHDHlv953+QQPZ3bfJ5seG98f7zOzM 23PuPffsft+779y7LxFVJcA/mPOdQEA2gSA+IxDEZwSC+IxAEJ8RCOIzAkF8RiCIzwgE8RmBID4j EMRnBIL4jEAQnxF2WuM35hqtC+3dRDsy5yOhkcbeEJ8hIS7oa7Mc/TN3tv+nFON1dnZenRap7Gsz mczb0Wj0VDH9w6q6K8/aNbYK+O/IpHh+UaPPoXyur80OaU0EtpdiPBfZaFRuyLKFQnOAN4vpH0xZ PiMQxGcEgviMURUkmUxOSiaTFaM5pjE8oK7O7fuy3fAbo5lDLsnkL6YX8oVHI4FNmzaVj7tg/H2Y 0HdxM9OB7tEYF8Ba1v5Wrq1stAYvhGSakttSGTfEiq/W1BzKcvU01+U95RCxIlXc3jYiVda2bamo Ck8AlwGo8BI5ghgl7ar+AzFHEfeoZDKHotHoB3nBmuIX9JSzNqsv6lj17ffQuLDCHmetRJiH8gnQ tkj91kd7WupWgLkyq48r662Gzft6WuLVQPXAn0JVkGMietRVjhDmcNnS9sNeLZM/S/0B5frs7qTU cKz3rSjzgCmAoyrPiDrfj0ajx6GEV0gyuf2TGF2HcEtfuyhLctsqICJnjlTAhNPJztQz9unyNbHY 3BO97bpC9hgLqyGnb09326K1oXHWa8AV9J5ewrT/H3xJ0KyyV8XdAewT1U8hZMUrjKIKApAGuzWW zITclRV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