Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

w2ksp4.exe, WwwxxXdbf, procmail "FROM_MAILER" patch, Use of assignment to $[ is deprecated at /usr/local/sbin/apxs line 86. , wwwxxx vim, mysql closing table and opening table, 800c5000, setgid operation not permitted, pciehp: acpi_pciehprm on IBM, WWWXXX.DBF

Links

XODOX
Impressum

#1: Single PerlResponseHander for Web Application

Posted on 2011-07-19 00:02:47 by Jerry Pereira

--bcaec52154fdddf1db04a85f28dd
Content-Type: text/plain; charset=ISO-8859-1

Hi,

I am new to mod_perl and would like to get some suggestion on my current
application design.

Following is the design:

Single PerlResponseHandler for my application, all requests will be
submitted to this handler, the handler will then dispatch the request to
appropriate sub-handlers based on the URI path.
Note: My path and handler mapping will be stored in a configuration file.

My configuration will look as follows -

<Location /app>
SetHandler modperl
PerlResponseHandler MyPackage::MyHandler
PerlAuthenHandler MyPackage::MyAuthHandler
</Location>


Psudocode in MyPackage::MyHandler:

------------------------------------

sub handler {
.....
.....

//Get the handler based on path
$sub_handler = getHandler($uripath) //e.g. /app/users
$sub_handler->handle($r, $session);
}

Please let me know of your views. I am not planning to use Catalyst or
existing frameworks as of now. I also thought of using Apache2::Dispatch,
but i believe it requires that each path has its own handler configured in
httpd.conf file (please correct me if I am wrong)

Thanks,
Jerry

--bcaec52154fdddf1db04a85f28dd
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Hi,<br><br>I am new to mod_perl and=A0 would like to get some suggestion on=
my current application design. <br><br>Following is the design:<br><br>Sin=
gle PerlResponseHandler for my application, all requests will be submitted =
to this handler, the handler will then dispatch the request to appropriate =
sub-handlers based on the URI path. <br>
Note: My path and handler mapping will be stored in a configuration file. <=
br>
<br>My configuration will look as follows - <br><br>&lt;Location /app&gt;<b=
r>  =A0 SetHandler modperl<br>  =A0 PerlResponseHandler MyPackage::=
MyHandler<br>  =A0 PerlAuthenHandler MyPackage::MyAuthHandler<br>&lt;/L=
ocation&gt;<br>
<br><br>Psudocode in MyPackage::MyHandler:<br><br>-------------------------=
-----------<br><br>sub handler {<br>  =A0 .....<br>  =A0 .....<br><=
br>  =A0 //Get the handler based on path <br>  =A0 $sub_handler =3D=
getHandler($uripath) //e.g. /app/users<br>
  =A0 $sub_handler-&gt;handle($r, $session);<br>}<br><br>Please let me =
know of your views. I am not planning to use Catalyst or existing framework=
s as of now. I also thought of using Apache2::Dispatch, but i believe it re=
quires that each path has its own handler configured in httpd.conf file (pl=
ease correct me if I am wrong)<br>
<br>Thanks,<br>Jerry<br>

--bcaec52154fdddf1db04a85f28dd--

Report this message

#2: Re: Single PerlResponseHander for Web Application

Posted on 2011-07-19 00:27:58 by Perrin Harkins

On Mon, Jul 18, 2011 at 6:02 PM, Jerry Pereira <online.jerry@gmail.com> wrote:
> Single PerlResponseHandler for my application, all requests will be
> submitted to this handler, the handler will then dispatch the request to
> appropriate sub-handlers based on the URI path.

Sounds like Apache2::Dispatch to me.

> I also thought of using Apache2::Dispatch,
> but i believe it requires that each path has its own handler configured in
> httpd.conf file (please correct me if I am wrong)

You're confused about this one. Eliminating the need to add each
class to httpd.conf is the main reason that Dispatch exists.

- Perrin

Report this message

#3: Re: Single PerlResponseHander for Web Application

Posted on 2011-07-19 11:55:44 by Dave Hodgkinson

On 18 Jul 2011, at 23:02, Jerry Pereira wrote:

> Please let me know of your views. I am not planning to use Catalyst or =
existing frameworks as of now.=20

Any reason? There are lightweight ones that play well with modern =
approaches
to plugins and multi-server environments.=

Report this message

#4: Re: Single PerlResponseHander for Web Application

Posted on 2011-07-19 18:55:39 by Jerry Pereira

--bcaec5215ab74c7d2704a86efc2f
Content-Type: text/plain; charset=ISO-8859-1

I agree, but isn't the Handler tightly coupled to the URI? rather if i can
configure the mapping of URI and sub-handlers in a different configuration
file or database, it will be easier to handle URI changes.


On Mon, Jul 18, 2011 at 3:27 PM, Perrin Harkins <perrin@elem.com> wrote:

> On Mon, Jul 18, 2011 at 6:02 PM, Jerry Pereira <online.jerry@gmail.com>
> wrote:
> > Single PerlResponseHandler for my application, all requests will be
> > submitted to this handler, the handler will then dispatch the request to
> > appropriate sub-handlers based on the URI path.
>
> Sounds like Apache2::Dispatch to me.
>
> > I also thought of using Apache2::Dispatch,
> > but i believe it requires that each path has its own handler configured
> in
> > httpd.conf file (please correct me if I am wrong)
>
> You're confused about this one. Eliminating the need to add each
> class to httpd.conf is the main reason that Dispatch exists.
>
> - Perrin
>



--
Your clothes may be the latest in style but you aint completely dressed
until you wear a smile!
Keep smiling : )

--bcaec5215ab74c7d2704a86efc2f
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

I agree, but isn&#39;t the Handler tightly coupled to the URI? rather if i =
can configure the mapping of URI and sub-handlers in a different configurat=
ion file or database, it will be easier to handle URI changes.<br><br><br>
<div class=3D"gmail_quote">On Mon, Jul 18, 2011 at 3:27 PM, Perrin Harkins =
<span dir=3D"ltr">&lt;<a href=3D"mailto:perrin@elem.com">perrin@elem.com</a=
>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 =
0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class=3D"im">On Mon, Jul 18, 2011 at 6:02 PM, Jerry Pereira &lt;<a hre=
f=3D"mailto:online.jerry@gmail.com">online.jerry@gmail.com</a>&gt; wrote:<b=
r>
&gt; Single PerlResponseHandler for my application, all requests will be<br=
>
&gt; submitted to this handler, the handler will then dispatch the request =
to<br>
&gt; appropriate sub-handlers based on the URI path.<br>
<br>
</div>Sounds like Apache2::Dispatch to me.<br>
<div class=3D"im"><br>
&gt; I also thought of using Apache2::Dispatch,<br>
&gt; but i believe it requires that each path has its own handler configure=
d in<br>
&gt; httpd.conf file (please correct me if I am wrong)<br>
<br>
</div>You&#39;re confused about this one. =A0Eliminating the need to add ea=
ch<br>
class to httpd.conf is the main reason that Dispatch exists.<br>
<font color=3D"#888888"><br>
- Perrin<br>
</font></blockquote></div><br><br clear=3D"all"><br>-- <br>Your clothes may=
be the latest in style but you aint completely dressed until you wear a sm=
ile!<br>Keep smiling : )<br>

--bcaec5215ab74c7d2704a86efc2f--

Report this message

#5: Re: Single PerlResponseHander for Web Application

Posted on 2011-07-19 19:46:21 by Perrin Harkins

On Tue, Jul 19, 2011 at 12:55 PM, Jerry Pereira <online.jerry@gmail.com> wrote:
> I agree, but isn't the Handler tightly coupled to the URI?

Yes.

> rather if i can
> configure the mapping of URI and sub-handlers in a different configuration
> file or database, it will be easier to handle URI changes.

I don't see any advantage to doing it in a different config file or
database over just putting it in httpd.conf. Are you thinking you
would avoid restarts? You'd probably want to restart anyway when you
deploy new code.

- Perrin

Report this message

#6: Re: Single PerlResponseHander for Web Application

Posted on 2011-07-19 21:21:52 by Perrin Harkins

On Tue, Jul 19, 2011 at 2:02 PM, Jerry Pereira <online.jerry@gmail.com> wrote:
> Thats right, i was thinking of avoiding restarts and having single place for
> mapping URIs to classes.

You can get that to some degree if you use Apache2::Reload and avoid
doing anything too strange in your code. The thing is, your best
defense against memory bloat is copy-on-write, and that will get
crushed if you do a lot of reloading code without a restart. Maybe
not an issue for you, depending on how big your site is.

- Perrin

Report this message