Re: Site Host Providers that Support mod_perl?

2002-03-07 Thread Brett W. McCoy

On Thu, 7 Mar 2002, Fran Fabrizio wrote:

 My ideal setup would be to be able to colocate one of my servers and
 just use the ISP's bandwidth, but those plans are all pretty pricey.
 So, I'd really like to have a good ISP that supports mod_perl that I can
 afford because I'd enjoy being able to play around and create sites that
 use mod_perl outside of work.  Of course, I can do it at home, but it's
 not the best place to host a web app, it'd have an audience of one. =)

If you had something like Speakeasy DSL or a similar provider that allows
you to run your own servers, you can run a server out of your house and
use mod_perl and have fun.

-- Brett
  http://www.chapelperilous.net/

What the scientists have in their briefcases is terrifying.
-- Nikita Khrushchev




Re: statINC or startINC ??

2002-03-01 Thread Brett W. McCoy

On Fri, 1 Mar 2002, Dermot Paikkos wrote:

 So I guess I need to know how to make the PERL5LIB variable
 available to Apache from its first initialisation (would that be the
 startuppl or the UID of the httpd process?) I also need to make sure
 that this is variable persists

PerlSetVar PERL5LIB path

should accomplish this

You can also do

use lib 'path';

in your scripts to have them search the correct path to modules that
aren't in INC  I also use Apache::Reload  See the appropriate
documentation (it talks about using Apache::Reload as a drop-in for
StatINC)

-- Brett
  http://wwwchapelperilousnet/

My mother wants grandchildren, so I said, Mom, go for it!
-- Sue Murphy





Re: module errors

2002-02-07 Thread Brett W. McCoy

On Thu, 7 Feb 2002, GsuLinuX wrote:

 we wroted a perl code to fetch some information we want from a web site. The code is 
as below:

 #!/usr/bin/perl
 use LWP::Simple;
 use HTML::Parse;

snippage

 We have the debug error:

 Can't locate HTML/Parse.pm in @INC(@INC contains:
 /usr/lib/perl5/5.6.0/i386-linux
 /usr/lib/...
 ) at
 /usr/local/plesk/apache/vhosts/loop10.com/httpdocs/DDdeneme/parite2.cgi line
 3

 Begin Failed-compilation aborted at
 /usr/local/plesk/apache/vhosts/loop10.com/httpdocs/DDdeneme/parite2.cgi line
 3
 

Are you sure you don't mean HTML::Parser (they are two differenty
modules)?

-- Brett
  http://www.chapelperilous.net/

Where do I find the time for not reading so many books?
-- Karl Kraus




Re: mod_perl version for Tomcat

2002-02-06 Thread Brett W. McCoy

On Wed, 6 Feb 2002, Chuck Goehring wrote:

 Is there anyone out there working on a mod_perl version for Tomcat?
 We currently have Apache running for mod_perl and Tomcat running for a
 purchased servlet library.  I primarily user mod_perl as a speedup for
 cgi programs.  I need ssl capabilities and have had problems trying to
 get it working.  Tomcat has an option for ssl from sun that may not have
 the issues on our platform.

Why would you need mod_perl with Tomcat?  You can use Tomcat with Apache
using mod_jk, and get the best of both worlds.

-- Brett
  http://www.chapelperilous.net/

What's the matter with the world?  Why, there ain't but one thing wrong
with every one of us -- and that's selfishness.
-- The Best of Will Rogers




Re: weird problem. Lost of the POST data

2002-02-04 Thread Brett W. McCoy

On Mon, 4 Feb 2002, Oscar Serrano wrote:

 some days ago I wrote to ask for this problem: The CGI.pm (sometimes) could
 not receive the POST data. I tried all you recomended me here in the list.
 But I still had the problem. Finally I decide to kick out CGI.pm and start
 to use the old cgi-lib.pl. But I still had the same problem. Then I turnet
 to Apache::Request, and since I use it, I've never had the same problem.
 I just tell you because perphaps somebody may have the same problem. I
 don't really understan if the problem is in mod_perl, in Apache, in Templat
 Toolkit, in my ultrasecure patched kernel, in CGI.pm, but the point is that
 Apache::Request seems not to loose any post data :-?

I had a similar problem a few days ago with a form processing engine I
developed with mod_perl  Text::Template.  It takes a sequence of states
out of a database and generates a 'wizard' to lead a user through a set of
forms for, say, an employment application, membership application, etc.
It uses a combination of CGI.pm for some of the high-level front end
stuff, and uses the Apache::* modules for the lower level stuff (cookies,
session management, etc).  Anyway, I had this wierd bug that instead of
the straight sequence of forms, it would do the first form, then the
second, the the first again, then the third, then the first again, then
the fourth, and so on.  POST data was either missing, or incomplete, or
was picking up values from several pages back.

I discovered what the problem was: I had a hash in one of my top-level
class files (the system is object-oriented) that was being used as a
global variable, a hash that had data that changed a lot.  Bad juju with
mod_perl!  Moving the hash into the class constructor and making sure it
got properly blessed into that class fixed the problem.

Another issue that can cause problems, especially using the OOP interface
to CGI.pm under mod_perl, is using a global CGI object and using it inside
of subroutines:

my $cgi = new CGI;

...

sendmail('A message');

...

sub send_mail {

my $msg = shift;
print $cgi-h1('Something');
print $cgi-p;
...
}

This will cause some wierd problems.  The solution is to not use globals
inside your subroutine, but pass what you need into it:

sendmail($cgi, 'A Message');

sub send_mail {
my $q = shift;
my $msg = shift;
...
}
  http://www.chapelperilous.net/

When the wind is great, bow before it;
when the wind is heavy, yield to it.




RE: email attachments; was modperl growth

2002-02-02 Thread Brett W. McCoy

On Sun, 3 Feb 2002, Jonathan M. Hollin wrote:

 Er, that's not strictly true.  Outlook handles encrypted and/or signed
 email as well as any other client.  Outlook displays the signed email
 with a unique icon to identify it as such.  The attachment contains the
 actual PGP info (in case you want to see it).  I think that's fair
 enough isn't it?

To be fair, it showed up as an attachment in Pine under Linux also
(although identified as a PGP signature).

-- Brett
  http://www.chapelperilous.net/

You will pay for your sins.  If you have already paid, please disregard
this message.




Re: perl with java

2001-12-09 Thread Brett W. McCoy

On Fri, 7 Dec 2001, nookala nagaraju wrote:

 I'm a java programmer. I don't know anything about
 perl. I just want to know whether it's possible to
 call servlets from perl scripts after validating some
 data provided by the user. Thank you very much.

Sure -- if you have a servlet engine, like Tomcat running.  They can
behave just like CGI scripts and be the action of a form.

There are also some ways of calling Java directly in Perl, using the
Java.pm or Inline.pm modules, but I don't think they can handle servlets.

-- Brett
  http://www.chapelperilous.net/

Life is a concentration camp.  You're stuck here and there's no way
out and you can only rage impotently against your persecutors.
-- Woody Allen




Re: User customisable website application?

2001-12-09 Thread Brett W. McCoy

On Thu, 6 Dec 2001, Russell Matbouli wrote:

 Just to clarify what I mean by customisable - the user can log in and
 change their colour scheme, font, ordering of components, choose a
 theme... The sort of thing you see on some commercial websites.

There are some websites out there that are user customizable --
www.perlmonks.org, for instance, has some customizable features.  It
shouldn't be too difficult to do what you are shooting for, especially if
you use a modular/component based architecture like Mason or AxKit.

-- Brett
  http://www.chapelperilous.net/

Agree with them now, it will save so much time.




Re: Creating an installable web site.

2001-12-06 Thread Brett W. McCoy

On Thu, 6 Dec 2001, Luciano Miguel Ferreira Rocha wrote:

 * have on cd apache with mod_perl and postgresl in installable form with
   your data. Or have them already installed on the cd. The problem here is
   that the source for your entire site will have to be distributed too
   and available for everybody's eyes to see. You'll also have to have
   different apaches and postgres for every architecture your clients use,
   and you should configure them to use different ports than the normal
   ones and above 1024, so that they don't conflict with already running
   web servers and rdbms. Also, they will have to be configured without
   absolute paths, and without any creation or writting to files (the cd
   medium is read-only, of course).

As someone who currently helps maintain and develop similar installation
software for the company I work for, this is not at all a trivial problem
-- we have to install *everything*, Perl, Java, Apache, database software,
as well as configure networking options, make sure they get properly
reflected in the Apache configuration, turn on SSL if the client wants it.
You can't make any assumptions about the system you are deploying on,
other than the basics like having an installed OS, a shell, and a network
card.  Luckily we only deply on Solaris, which makes things a little
easier.  Having to support multiple platforms would be a PITA, especially
since we have some custom-built C++ software (not to mention some C++
classes that get used with JNI).

-- Brett
  http://www.chapelperilous.net/

Resisting temptation is easier when you think you'll probably get
another chance later on.




Re: CGI.pm 2.78 and mod_perl 1.26 troubles

2001-12-06 Thread Brett W. McCoy

On 6 Dec 2001, David Shrewsbury wrote:

 Solved it... apparently, if you upgrade CGI.pm while your web
 server is running, a restart is not good enough. You have to
 shutdown completely and then start it back up.

yeah, especially if you're using mod_perl and have pre-loaded modules at
server start up.

-- Brett
  http://www.chapelperilous.net/

It is better to live rich than to die rich.
-- Samuel Johnson




Re: ASP.NET Linux equivalent?

2001-12-05 Thread Brett W. McCoy

On Mon, 3 Dec 2001, Vsevolod Ilyushchenko wrote:

 Is anyone aware of a Linux product equivalent to ASP.NET from MS? Its most
 attractive feature is the GUI construction of Web forms and the automatic
 connection of their fields to a database. Since I am getting sick and tired
 of writing over and over the code to process user input and store it in the
 database, a similar product would be a huge help. (PHPLens does something
 similar, but it only presents data in the table format.)

If you are writing the same code over and over again, that's a good sign
you need to start creating modules and using those.

One thing you may want to look at is Mason, which is a component based
architecture for building web sites.  See http://masonhq.com.  But it's
not point and click GUI stuff -- you still need to do some coding.

-- Brett
  http://www.chapelperilous.net/

Poverty must have its satisfactions, else there would not be so many poor
people.
-- Don Herold




Re: Forking problem with mod_perl...

2001-12-02 Thread Brett W. McCoy

On Sun, 2 Dec 2001, Brian wrote:

 I'm writing a script that will run under mod_perl.  Right now, if I
 disable mod_perl the script runs fine.  When I turn mod_perl back on, it
 stops working.  Here's the lowdown.

Forking under mod_perl isn't a good idea.  Did you read this?

http://perl.apache.org/guide/performance.html#Forking_and_Executing_Subprocess

-- Brett
  http://www.chapelperilous.net/

America may be unique in being a country which has leapt from barbarism
to decadence without touching civilization.
-- John O'Hara




Re: Upgrade Perl to 5.6.1and mod_perl still see 5.6.0

2001-11-27 Thread Brett W. McCoy

On Fri, 23 Nov 2001, Hans Poo wrote:

 I've just installed a redhat 7.2 machine.

 I the installed Apache::ASP using CPAN, and ended upgrading to perl 5.6.1.

 After restarting httpd. i noticed that mod_perl is still int he old libraries.

Did you rebuild mod_perl?  If not, it's still the 5.6.0 version fo the
interpreter.

-- Brett
  http://www.chapelperilous.net/

Alden's Laws:
(1)  Giving away baby clothes and furniture is the major cause
 of pregnancy.
(2)  Always be backlit.
(3)  Sit down whenever possible.




Re: IBM patents Template Systems?

2001-10-17 Thread Brett W. McCoy

On Wed, 17 Oct 2001, Ged Haywood wrote:

 An only slightly less casual reading indicates that anyone who writes

 use strict;

 or

 html

 isn't at risk of violating this patent.

It looks to me that products like Zope or Midgard are more going to be in
violation, but since they are Python and PHP based, it is of no concern.
:-)

-- Brett
  http://www.chapelperilous.net/

You know you've landed gear-up when it takes full power to taxi.




Re: Mod_perl component based architecture

2001-10-16 Thread Brett W. McCoy

On Tue, 16 Oct 2001, Gargi Bodke wrote:

   i have been asked to suggest an architecture to seperate the
 business logic from the html. how is this done in modperl? i guess by
 using functions for the business logic. is there any other way?

There are several solutions you can explore, that are optimized for
mod_perl.  I personally favor Mason (http://masonhq.com), which uses a
component-based architecture with some object-oriented extensions, but
there are others like EmbPerl and various templating solutions that
achieve similar goals.

You can start here for more information (most, if not all, of these are
also open source/free software):

http://perl.apache.org/#appservers

-- Brett
  http://www.chapelperilous.net/

I'm always looking for a new idea that will be more productive than its cost.
-- David Rockefeller




Re: Mod_perl component based architecture

2001-10-16 Thread Brett W. McCoy

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.

-- Brett
  http://www.chapelperilous.net/

Perfection is reached, not when there is no longer anything to add, but
when there is no longer anything to take away.
-- Antoine de Saint-Exupery




Re: Mod_perl component based architecture

2001-10-16 Thread Brett W. McCoy

On Tue, 16 Oct 2001, Michael wrote:

  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.

Mason has a content management suite, and I think Smart Worker may also
have something along these lines.  I can't speak for the other ones, as I
have not used them.

-- Brett
  http://www.chapelperilous.net/

Your lucky number is 3552664958674928.  Watch for it everywhere.




Re: modperl/ASP and MVC design pattern

2001-04-20 Thread Brett W. McCoy

On Fri, 20 Apr 2001, Francesco Pasqualini wrote:

 an interesting feature of JSP is the possibility to use the MVC design
 pattern (INPUT/OUTPUT/LOGIC separation) This is obtained with the
 "forward" instruction. How the MVC design pattern can be implemented
 in the mod_perl (and specifically Apache::ASP) architecture ?

MVC isn't dependent on any particular language, it's a top level design
for your application.  I have used something similar to the MVC model
using just CGI.pm  DBI/DBD.  The basic idea is to decouple your data
model from the display of that data.  It's probably not textbook accurate
MVC, but it borrows heavily from the architecture.

I created a wrapper class for by database functionality (didn't sub-class
DBI, but encapsulated it and the specifics of my data retrieval in the
class).  This class had hogh-level methods like $data-get_id,
$data-list_ids, etc. I have used this same class with both PostgreSQL and
MySQL, and the top-level interface didn't have to change, even though the
underlying data structures did because of differences between PostgreSQL
and MySQL (for instance, I could't use views or referential integrity
contraints in MySQL).

Then I created a display class that handled displaying stuff on the
browser -- also encapsulating the CGI module in high-level methods like
$disp-registration_form, $disp-error_page, etc.  Again, here, I used
this class where I had a newer version of CGI, but had to retrofit the
class to a system that used an older version of CGI, so I had to recode a
couple of methods using raw HTML and here docs, since the older system
didn't have CGI methods available in the newer version.

Finally, my top-level layer was a simple script (this wasn't a class per
se) that was a 'driver' for the everything else -- I actually use a
modified form of Recipe 19.12 in the Perl cookbook.  I maintain state
between page access through a single state variable, and have a hash that
manages my data class and the display class, and the state variable is
used to determine what 'page' to display, and handles top-level error
handling.

-- Brett
   http://www.chapelperilous.net/btfwk/

genealogy, n.:
An account of one's descent from an ancestor
who did not particularly care to trace his own.
-- Ambrose Bierce





Re: Java.pm

2001-04-10 Thread Brett W. McCoy

On Tue, 10 Apr 2001, cbell wrote:

 Hello everyone, has anyone had any experience with Java.pm?  There
 doesn't seem to be much info in the mail archives.  I'm trying to access
 a JAR from within perl using the Java.pm, but I always receive the
 error: 'java.lang.ClassNotFoundException'.  I can access the jar from a
 Java script at the command line, so the problem is from within Perl
 itself.

 I've tried the following two methods but always end up with the same
 results...

 my $class = $java-java_lang_Class("forName","Test");
 my $return_value =
 $java-static_call("MyStaticClass","function_name",@params);

I don't know if Java.pm is capable of directly using jar files. I have
gotten it to directly use .class files with no problem.  Did you try
emailing the author?  I emailed him with some questions and he was very
responsive (answer in just a couple of hours).  he can probably give you
the best support.

-- Brett
   http://www.chapelperilous.net/btfwk/

Begathon, n.:
A multi-day event on public television, used to raise money so
you won't have to watch commercials.




Re: CGI - mod_perl 101

2001-04-06 Thread Brett W. McCoy

On Fri, 6 Apr 2001, Paul Lombardo wrote:

 What is the best way (Is there a reference source)  to move cgi scripts to
 perl modules so they run under mod_perl?

http://perl.apache.org/dist/cgi_to_mod_perl.html

-- Brett
   http://www.chapelperilous.net/btfwk/

When in doubt, do it.  It's much easier to apologize than to get permission.
-- Grace Murray Hopper




Re: perl session management

2001-03-27 Thread Brett W. McCoy

On 27 Mar 2001, tom joseph wrote:

 Hello there..
 Could u suggest a way to update a session variable.
 At present it is not possible for me to update a session variable from
 any other page.  I thought it would be automatically updated when i do a new
 insertion into the session variable which in my case is a hash.  Is there any
 other way. Could anyone please help.

 I am using the module Apache::Session::MYSQL.

How about some code so we can see where things might not be working?

-- Brett
   http://www.chapelperilous.net/btfwk/

The star of riches is shining upon you.