Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: CGI::Application for complex web applications?

by cees (Curate)
on Jul 28, 2005 at 01:40 UTC ( [id://478780]=note: print w/replies, xml ) Need Help??


in reply to CGI::Application for complex web applications?

Have a look at CGI::Application::Dispatch. It works pretty much exactly like you describe. It can be used as a mod_perl handler if you use mod_perl, or it can be used in a simple CGI script if you don't use mod_perl.

As for the three questions at the bottom:

  • will URLs like www.site.com/index.pl/admin/members/ call that index.pl in root where I will be able to extract the rest of path

    Yes

  • if previous is yes, will post/get work (www.site.com/index.pl/admin/members/?run_mode=something)

    Yes

  • How would all this URLs work with mod_perl - as if it works out with this project I might use same/similar for web sites based on CGI:App.

    It will work exactly the same under mod_perl, although you can hook the handler in a location that doesn't have a file extension, so you could have www.site.com/myapp/admin/members?param=1. That makes for nicer looking URLs

    • Comment on Re: CGI::Application for complex web applications?

Replies are listed 'Best First'.
Re^2: CGI::Application for complex web applications?
by techcode (Hermit) on Jul 28, 2005 at 06:33 UTC
    Thanks for pointing it out to me :)

    I don't know if there is something I'm missing about/on CPAN? Can I simply browse to see all the CGI::Application modules (the folder CGI/Application/ and it's sub-folders)?

    I still have to check if it will work with AutoRunmode plug in as it's not mentioned in the docs. But I did spotted authors words that module is written because he's lazy and didn't wanted to write same code over and over - so there are good chances it will work :)

    Almost forgot - if I want to use several CGI::Application::Plugin(s) - say this AutoRunmode and Sessions - how do I do that?

    Thanks.

      I use CGI::Application::Plugin::AutoRunmode with CGI::Application::Dispatch all the time. They work really well together.

      for most of the plugins, you just have to use them in your module

      package My::App; use base qw(CGI::Application); use CGI::Application::Plugin::AutoRunmode; use CGI::Application::Plugin::Session;

      As for finding all the plugins, since many of the plugins are written by different authors, you can't easily see a list of all of them on one page. Your best bet is just to use search.cpan.org and search for CGI::Application. You will have to page through cause there are quite a few of them. Another way to find them all quickly is to look in the 02packages.details.txt.gz file in your local CPAN directory:

      zcat $HOME/.cpan/modules/02packages.details.txt.gz | grep 'CGI::Applic +ation'

      That will quickly give you a list, although you won't get you much information.

        Thanks cees!

        I don't know how/why but for some reason I was reading "use base 'CGI::Application::Plugin::Session';' instead of just simple "use CGI::Application::Plugin::Session;" on all those plug ins.

        Guess I made it in my mind that those are sub-classes of CGI::App for some strange reason. Probably because Perl's OOP is a bit different on those matters than what they are forcing on university (Java, C# ...).

      I don't know if there is something I'm missing about/on CPAN? Can I simply browse to see all the CGI::Application modules (the folder CGI/Application/ and it's sub-folders)?
      You can browse the directory structure for CGI::Application *, but that only shows the modules that are in the default C::A install. There are several extensions on CPAN that you need to install seperately.

      Just use search.cpan.org to search for related modules that are not in the default distribution.

      * update: you can also walk the "modules by name" list on cpan, but IMO search.cpan.org is a lot easier to use.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://478780]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-25 11:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found