Re: Apache::DBI
How about DBIx::Connector? On Tue, Aug 2, 2011 at 6:30 AM, Feng He wrote: > Hi, > > I just want to develop a modperl application. > It's a handler, the database is Mysql. > Shall I use Apache::DBI, or DBI is just fine ? > > Thank u. > Regards. > -- Your clothes may be the latest in style but you aint completely dressed until you wear a smile! Keep smiling : )
Re: Single PerlResponseHander for Web Application
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 wrote: > On Mon, Jul 18, 2011 at 6:02 PM, Jerry Pereira > 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 : )
Single PerlResponseHander for Web Application
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 - SetHandler modperl PerlResponseHandler MyPackage::MyHandler PerlAuthenHandler MyPackage::MyAuthHandler 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
Re: Best approach to store Application Configuration
please correct me if I am wrong, I should be using tool like YAML/Config::General for application configuration storage and reteieval, and load them on startup using startup.pl script? That would mean i will have to store the name of configuration file some where (probabaly in mod_perl configuration block in httpd.conf). On Mon, Jul 11, 2011 at 2:26 PM, McCarrell, Jeff wrote: > Hi Jerry. > > I went through a couple of different approaches before settling on using > YAML files to describe configuration. > There are several nice properties of YAML IMO, not least of which is > arbitrary nesting so the config can closely match the software being > configured. > Here is a sanitized example of my production config: > > # -*- mode: perl -*- > # configuration file for XXX > config: { version: 1 } > > # XYZ configuration > # across the entire XXX tier > xyz: { > # enable / disable all ... > feature_X_enabled: true, > > # name of cookie(s) to emit: [xx, yy, zz] > emit_cookies: [ xx ] > > # substructure configuration > sub_structures: { > disabled: { > foo: [], > bar: [], > baz: [], > } > } > } > > There are several YAML readers available; I preferred YAML::XS because of > its speed and correctness. > My apps need to run a long time, so they poll the configuration file every > n seconds, and reload it if needed. > Overall, I was pretty happy with this approach, and so were the operations > folks who have to configure the settings in production. > > HTH, > -- jeff > > From: Jerry Pereira > Date: Mon, 11 Jul 2011 16:07:58 -0500 > To: "modperl@perl.apache.org" > > Subject: Best approach to store Application Configuration > > Hi All, > > I am new to mod_perl (a java developer). I would like to know the best > approach to store and retrieve Applicaiton configurations that is accessible > to all packages in my mod_perl application. > > My application configuration includes - Database details, Template mapping, > LDAP configuration details etc. I would like my to load all these > configuratoins when my application starts and then on, i should be able to > access these configuration from anywhere. > > For Example: > my $dbDetails = ConfigUtil->getDBDetails(); //returns reference to hash > my dbUser = dbDetails->user; > > I belive PerlSetVar only allows strings variables. I would like to get some > suggestions on how configuration management in mod_perl applications. > > Thanks, > Jerry > -- Your clothes may be the latest in style but you aint completely dressed until you wear a smile! Keep smiling : )
Best approach to store Application Configuration
Hi All, I am new to mod_perl (a java developer). I would like to know the best approach to store and retrieve Applicaiton configurations that is accessible to all packages in my mod_perl application. My application configuration includes - Database details, Template mapping, LDAP configuration details etc. I would like my to load all these configuratoins when my application starts and then on, i should be able to access these configuration from anywhere. For Example: my $dbDetails = ConfigUtil->getDBDetails(); //returns reference to hash my dbUser = dbDetails->user; I belive PerlSetVar only allows strings variables. I would like to get some suggestions on how configuration management in mod_perl applications. Thanks, Jerry
Re: Changing browser URL based on condition
Thanks Guys!!! I will go ahead with Redirect approach. I was more interested in building a generic framework for my application that would handle such scenarios (login was just one of them). On Mon, Jul 11, 2011 at 12:42 PM, Szekeres, Edward < edward.szeke...@perkinelmer.com> wrote: > It seems to be just an attempt to do what is already done in > Apache2::AuthCookie (CPAN), which encapsulates a server side authentication. > > > -Original Message- > From: MK [mailto:m...@cognitivedissonance.ca] > Sent: Monday, July 11, 2011 3:37 PM > To: modperl@perl.apache.org > Subject: Re: Changing browser URL based on condition > > On Mon, 11 Jul 2011 11:48:09 -0700 > Jerry Pereira wrote: > > 1. User types the URL - www.example.com, this will display the login > > page. > > 2. Once the user enters the credentials and hits submit, the request > > is posted to www.example.com/login action. > > 3. If the credentials entered by the user is valid then i would like > > to show the home page..uri > > 4. I am able to show the homw page, but the URL does not change to > > www.example.com/home, instead it remains the same (i.e. > > www.example.com/login). > > One important reason to do something like that is because you do not > want the user to bookmark or otherwise pass on an url with completely > ambiguous content -- /login should refer to the login page, /home should > refer to the home page, they are two different things. Having /login > refer to both is no good. So I think your desire is justified. > > IMO, this is best handled client-side: you return your login data via > an AJAX call. If the login succeeds, the client loads /home. If the > login has failed, the client displays a message to that effect. You > need to prevent spoofed access to /home, but of course you have to do > that anyway (via cookies or whatever method you are already using). > > -- > "Enthusiasm is not the enemy of the intellect." (said of Irving Howe) > "The angel of history[...]is turned toward the past." (Walter Benjamin) > > -- Your clothes may be the latest in style but you aint completely dressed until you wear a smile! Keep smiling : )
Re: Changing browser URL based on condition
Hi Edward, I have the following design: A single PerlResponseHandler for all requests. This handler based on the path decides the action to be taken For example, if the user submits to www.example.com/login, then the handler delegates the request to authentication module, which will then either display the home page (throug home page template) or login page again, based on the success/failure of authentication mechanism. Since i am rendering the page via template, i am able to generate the content of home page which i then send back to the client, but the URL on the browser remails the same (i.e. www.example.com/login), which is not true. Any suggestions to handle this scenario will be great. Thanks, Jerry On Mon, Jul 11, 2011 at 12:03 PM, Szekeres, Edward < edward.szeke...@perkinelmer.com> wrote: > If you are looking to do this for “cosmetic reasons”, I do this be simply > using frame sets and doing redirects in the child frame. The URL displayed > in the location bar will always be constant for the parent frame. I don’t > think there is any way to do this at the core level or it would be a > spoofers windfall. The browser will always have the actual location in the > info panel.**** > > ** ** > > *From:* Jerry Pereira [mailto:online.je...@gmail.com] > *Sent:* Monday, July 11, 2011 2:48 PM > *To:* modperl@perl.apache.org > *Subject:* Changing browser URL based on condition > > ** ** > > Hi All, > > I would like to know if there is a way to change the URL displayed on > browser without using Redirect option. The URL visible on client browser > must be based on some condition that is evaluated in my mod_perl handler.* > *** > > For example - > > 1. User types the URL - www.example.com, this will display the login page. > 2. Once the user enters the credentials and hits submit, the request is > posted to www.example.com/login action. > 3. If the credentials entered by the user is valid then i would like to > show > the home page..uri > 4. I am able to show the homw page, but the URL does not change to > www.example.com/home, instead it remains the same (i.e. > www.example.com/login). I am using Template toolkit to render my pages. I > tried $req->url('/home'), but that does not change the browser URI. > > Any help will be appreciated. > > > Thanks, > Jerry > -- Your clothes may be the latest in style but you aint completely dressed until you wear a smile! Keep smiling : )
Changing browser URL based on condition
Hi All, I would like to know if there is a way to change the URL displayed on browser without using Redirect option. The URL visible on client browser must be based on some condition that is evaluated in my mod_perl handler. For example - 1. User types the URL - www.example.com, this will display the login page. 2. Once the user enters the credentials and hits submit, the request is posted to www.example.com/login action. 3. If the credentials entered by the user is valid then i would like to show the home page..uri 4. I am able to show the homw page, but the URL does not change to www.example.com/home, instead it remains the same (i.e. www.example.com/login). I am using Template toolkit to render my pages. I tried $req->url('/home'), but that does not change the browser URI. Any help will be appreciated. Thanks, Jerry