RE: Mod_perl component based architecture

2001-10-16 Thread Henigan, Timothy
Title: RE: Mod_perl component based architecture





You should really check out OpenInteract (http://www.openinteract.org).  It sounds like it has a lot of the hooks you're looking for (user management, templates, online content editing, etc) as well as a few you'll be looking for later (security, session management).  It is built on mod_perl and the Template Toolkit as well as many other standard CPAN modules.

Tim



-Original Message-
From: Michael [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 16, 2001 3:55 PM
To: [EMAIL PROTECTED]
Subject: Re: Mod_perl component based architecture



> On Tue, 16 Oct 2001, Dominique Quatravaux wrote:
> 
> >   As for the remaining of the question, I've been wondering for myself if
> > there is a MVC (model-view-controller) framework for WWW publishing in
> > Perl ? I gather there exist quite a few for Java, but I couldn't find
> > anything significant under Perl.
> 
> Quite a few, as the other posts in thread have already made
> reference to. In addition, there is also CGI::Application, which
> supports templating via HTML::Template and uses an MVC architecture
> as well.
> 
Are any of the packages mentioned particularly suited to client 
content management packages where the client can manage some 
limeted page content text/graphics but not really mess with the 
overall page layout and site content. I'm about to start researching 
this but would like input from the "experts".


Michael





Re: how to pass data in internal redirects?

2002-02-26 Thread Henigan, Timothy

I am also implementing a MVC pattern under mod_perl for an internal project
at work.  The app collects process data from our manufacturing processes and
makes it available on the internal network.  Here's a quick overview of the
way I've done it.

Model:
  The model consists of a backend database (MySQL) and a set of perl classes
that interact with it.  Each perl class encapsulates the data and methods
associated with an entity in the application (like an Assembly, Company,
etc).  These classes know nothing of mod_perl.  The only other thing worth
mentioning is that each entity has a method called "to_hash" that creates a
hash representation of itself that can be plugged directly into a HTML
template (see View below).

View:
  The view consists of a set of templates developed using the Template
Toolkit.  I strongly believe that templates should only display data, not
generate it (no dbase calls).  The controller creates the dynamic data,
stuffs it into the template, and sends it back to the user.

Controller:
  The core controller (an Apache handler) is responsible for authorization,
gathering user input, performing any actions, and returning the appropriate
view to the user.Whenever it performs an action, the controller needs to
create and monkey with a rather large set of Entity classes.  To simplify
the code in the controller, I developed a set of Facade classes that are
responsible for chunks of related actions.  So, the controller instantiates
a Facade and calls it's methods.  The results are plugged directly into a
template.

Only Entity classes speak SQL.  Only templates speak HTML.  Everything else
works with object methods or hashes.

Whenever I need an internal redirect, I use CGI encoded URLs, just as Dom
mentioned in his email.

I don't know if this is the best design, but it works for this application.
If you made it this far into the email, you might be interested in some
sample code...let me know.  If you have comments, please speak up.  I'm the
only developer on the project, so if I've gone off the deep end, I might not
notice.

Thanks,
Tim


On Tue, 26 Feb 2002, F. Xavier Noria wrote:

> As an exercise studying mod_perl I am trying to see how could the MVC
> pattern be implemented.  I've thought a possible approach would be to
> write the model using normal Perl classes, and controllers and views
> with Apache modules.
>
> I suppose that controllers would use internal redirects to call the
> views, is there a way to pass Perl data this way?  For example, in the
> hangman game in O'Reilly's book a controller would load a session from
> the cookie, process user's guest, modify the state and redirect the
> request internally to the view.  Ideally the view shouldn't read the
> data to display from the database again... could it be passed somehow by
> the first content handler



RE: Document Caching

2002-03-06 Thread Henigan, Timothy



Rasoul Hajikhani wrote:
> 
> Robert Landrum wrote:
> > 
> > At 12:28 PM -0800 3/6/02, Rasoul Hajikhani wrote:
> > >Hello People,
> > >Need your advise on how to cache a template under 
> mod_perl... Any ideas?
> > >Thanks in advance
> > >-r
> > 
> > #startup.pl
> > 
> > open(FILE," > $MY::TEMPLATE .= while();
> > close(FILE);
> > 
> > Provided that you never change $MY::TEMPLATE, this should work fine.
> > 
> > --
> > When I used a Mac, they laughed because I had no command 
> prompt. When
> > I used Linux, they laughed because I had no GUI.
> Thanks... But I use Template Toolkit to generate a dynamic file. How
> would the above code work in that situation?!
> -r
> 

The Template Toolkit package includes it's own caching mechanism.  Check out
the pod for Template::Provider on your system.  I'm not sure how it works
under mod_perl, but it should be a good place for you to start.

Tim



RE: Document Caching

2002-03-06 Thread Henigan, Timothy



> Timothy Henigan wrote:
> At Wednesday, March 06, 2002 4:23 PM
> 
> 
> Rasoul Hajikhani wrote:
> > 
> > Robert Landrum wrote:
> > > 
> > > At 12:28 PM -0800 3/6/02, Rasoul Hajikhani wrote:
> > > >Hello People,
> > > >Need your advise on how to cache a template under 
> > mod_perl... Any ideas?
> > > >Thanks in advance
> > > >-r
> > > 
> > > #startup.pl
> > > 
> > > open(FILE," > > $MY::TEMPLATE .= while();
> > > close(FILE);
> > > 
> > > Provided that you never change $MY::TEMPLATE, this should 
> work fine.
> > > 
> > > --
> > > When I used a Mac, they laughed because I had no command 
> > prompt. When
> > > I used Linux, they laughed because I had no GUI.
> > Thanks... But I use Template Toolkit to generate a dynamic file. How
> > would the above code work in that situation?!
> > -r
> > 
> 
> The Template Toolkit package includes it's own caching 
> mechanism.  Check out
> the pod for Template::Provider on your system.  I'm not sure 
> how it works
> under mod_perl, but it should be a good place for you to start.
> 
> Tim
> 

Slashdot caches templates under mod_perl in their system.  For an example,
download the latest version of slashcode (2.2.5) and take a look at the
/slash/Slash/Display/Provider/Provider.pm module.

http://sf.net/project/showfiles.php?group_id=4421&release_id=73958

Tim



httpd looking for httpd.conf in wrong path

2001-10-08 Thread Henigan, Timothy
Title: httpd looking for httpd.conf in wrong path





I'm attempting to build/install Apache and mod_perl from source (running as root).


I can build Apache stand-alone with no trouble using the following commands:
    - cd /my/src/dir/apache_1.3.20
    - ./configure --prefix=/home/apache
    - make && make test && make install


With the above config, I can start httpd and view pages normally.


The trouble begins when I try to compile Apache with mod_perl.  I try the following commands:
    - cd ../mod_perl-1.26
    - perl Makefile.PL APACHE_PREFIX=/home/apache/
    - make && make test && make install
    - cd ../apache_1.3.20
    - make install


The build completes successfully (I know this becuase there are no error messages, the tests complete successfully, and the timestamps on the executable file in the /home/apache/bin directory have changed).  When "make install" finishes, it tells me to try starting apache with /home/apache/bin/apachectl start.  However, when I try it I get the following message:

    "fopen: No such file or directory"
    "httpd: could not open document config file /usr/local/apache/conf/httpd.conf"
    "/home/apache/bin/apachectl start: httpd could not be started"


Any ideas why httpd is looking for httpd.conf in /usr/local/apache/conf when I specifically built it using APACHE_PREFIX=/home/apache/?  I didn't see any similar problems while looking through the mail archives on Geocrawler.  Any assistance would be appreciated.

== Version info =
OS:     Linux 2.2.14, Intel
Perl:       v5.005_03 built for i386-linux
mod_perl:   v1.26
Apache: v1.3.20
=


Thanks,
Tim






RE: httpd looking for httpd.conf in wrong path

2001-10-08 Thread Henigan, Timothy
Title: RE: httpd looking for httpd.conf in wrong path





Thanks for the tips.


I found another way to correct the problem.  If I create a "makepl_args.mod_perl" file in my mod_perl-1.26 directory with APACHE_PREFIX defined as "/home/apache/", the build runs normally and I am able to start the server with just "/home/apache/bin/apachectl start".

The use of "makepl_args.mod_perl" files is described in the INSTALL file of the mod_perl source tarball.


I'm going to keep looking at this though...I don't understand why it didn't accept APACHE_PREFIX from the command line.


Tim



-Original Message-
From: Luciano Miguel Ferreira Rocha [mailto:[EMAIL PROTECTED]]
Sent: Monday, October 08, 2001 1:28 PM
To: Henigan, Timothy
Cc: [EMAIL PROTECTED]
Subject: Re: httpd looking for httpd.conf in wrong path



I don't know why the APACHE_PREFIX isn't being honored for the configuration
files (it's been a long time since I last compiled mod_perl). But
you can resolve the problem by creating a symbolic link of /usr/local/apache
to /home/apache or by specifying the root directory with -d /home/apache or 
-f  /home/apache/conf/httpd-conf.


Also, make sure you defined DO_HTTPD=1 (and USE_APACI=1) and make install
only in the mod_perl directory.


hugs
Luciano Rocha


On Mon, Oct 08, 2001 at 12:41:33PM -0400, Henigan, Timothy wrote:
> I'm attempting to build/install Apache and mod_perl from source (running as
> root).
> 
> I can build Apache stand-alone with no trouble using the following commands:
>   - cd /my/src/dir/apache_1.3.20
>   - ./configure --prefix=/home/apache
>   - make && make test && make install
> 
> With the above config, I can start httpd and view pages normally.
> 
> The trouble begins when I try to compile Apache with mod_perl.  I try the
> following commands:
>   - cd ../mod_perl-1.26
>   - perl Makefile.PL APACHE_PREFIX=/home/apache/
>   - make && make test && make install
>   - cd ../apache_1.3.20
>   - make install
> 
> The build completes successfully (I know this becuase there are no error
> messages, the tests complete successfully, and the timestamps on the
> executable file in the /home/apache/bin directory have changed).  When "make
> install" finishes, it tells me to try starting apache with
> /home/apache/bin/apachectl start.  However, when I try it I get the
> following message:
>   "fopen: No such file or directory"
>   "httpd: could not open document config file
> /usr/local/apache/conf/httpd.conf"
>   "/home/apache/bin/apachectl start: httpd could not be started"
> 
> Any ideas why httpd is looking for httpd.conf in /usr/local/apache/conf when
> I specifically built it using APACHE_PREFIX=/home/apache/?  I didn't see any
> similar problems while looking through the mail archives on Geocrawler.  Any
> assistance would be appreciated.
> 
> == Version info =
> OS:       Linux 2.2.14, Intel
> Perl:     v5.005_03 built for i386-linux
> mod_perl: v1.26
> Apache:   v1.3.20
> =
> 
> Thanks,
> Tim
> 
> 


-- 
Luciano Rocha, [EMAIL PROTECTED]


The trouble with computers is that they do what you tell them, not what
you want.
    -- D. Cohen