Re: Problem configuring and making mod_perl

2003-07-16 Thread C. Jon Larsen

I hit the same error trying to build on a rh9.0 workstation. This solved 
my problem:

CPPFLAGS=-I/usr/kerberos/include
export CPPFLAGS

Than unpack, config, make, etc ...

On Wed, 16 Jul 2003, Richard Kurth wrote:

 I am trying to compile mod_perl-1.28 with apache_1.3.27,openssl-0.9.7b and 
 mod_ssl-2.8.12-1.3.27. When I run configure with the following and then do 
 a make I get all these parse error can anybody tell me way I get this.
 
 THIS IS WHAT I AM RUNNING TO CONFIGURE
 perl Makefile.PL USE_APACI=1 EVERYTHING=1 \
  DO_HTTPD=1 SSL_BASE=/usr/ \
  APACHE_PREFIX=/usr/apache \
  APACHE_SRC=../apache_1.3.27/src \
  APACI_ARGS='--enable-module=rewrite --enable-shared=rewrite \
 --sysconfdir=/etc/httpd/conf --logfiledir=/home/log --manualdir=/home/manual \
 --server-uid=apache --server-gid=apache --enable-module=so 
 --htdocsdir=/home/sites \
 --cgidir=/home/cgi-bin --enable-module=proxy --enable-shared=proxy 
 --enable-module=ssl \
 --enable-shared=ssl --enable-module=access --enable-module=autoindex '
 
 
 THIS IS WHAT I GET WHEN I DO A MAKE IT SEAMS TO HAVE SOMETHING TO DO WITH 
 OPENSSL
 gcc -c -I../.. -I/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE 
 -I../../os/unix -I../../include   -DLINUX=22 -I/usr/include/gdbm 
 -DMOD_SSL=208112 -DMOD_PERL -DUSE_PERL_SSI 
 -D_REENTRANT  -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing 
 -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
 -I/usr/include/gdbm -DUSE_HSREGEX -DEAPI -D_REENTRANT -DTHREADS_HAVE_PIDS 
 -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE 
 -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm `../../apaci` -fpic 
 -DSHARED_MODULE -DSSL_COMPAT -DSSL_USE_SDBM -DSSL_ENGINE -I/usr//include 
 -DMOD_SSL_VERSION=\2.8.12\ mod_ssl.c  mv mod_ssl.o mod_ssl.lo
 In file included from /usr/include/openssl/ssl.h:179,
   from mod_ssl.h:116,
   from mod_ssl.c:65:
 /usr/include/openssl/kssl.h:72:18: krb5.h: No such file or directory
 In file included from /usr/include/openssl/ssl.h:179,
   from mod_ssl.h:116,
   from mod_ssl.c:65:
 /usr/include/openssl/kssl.h:132: parse error before krb5_enctype
 /usr/include/openssl/kssl.h:134: parse error before FAR
 /usr/include/openssl/kssl.h:135: parse error before '}' token
 /usr/include/openssl/kssl.h:147: parse error before kssl_ctx_setstring
 /usr/include/openssl/kssl.h:147: parse error before '*' token
 /usr/include/openssl/kssl.h:148: parse error before '*' token
 /usr/include/openssl/kssl.h:149: parse error before '*' token
 /usr/include/openssl/kssl.h:149: parse error before '*' token
 /usr/include/openssl/kssl.h:150: parse error before '*' token
 /usr/include/openssl/kssl.h:151: parse error before kssl_ctx_setprinc
 /usr/include/openssl/kssl.h:151: parse error before '*' token
 /usr/include/openssl/kssl.h:153: parse error before kssl_cget_tkt
 /usr/include/openssl/kssl.h:153: parse error before '*' token
 /usr/include/openssl/kssl.h:155: parse error before kssl_sget_tkt
 /usr/include/openssl/kssl.h:155: parse error before '*' token
 /usr/include/openssl/kssl.h:157: parse error before kssl_ctx_setkey
 /usr/include/openssl/kssl.h:157: parse error before '*' token
 /usr/include/openssl/kssl.h:159: parse error before context
 /usr/include/openssl/kssl.h:160: parse error before kssl_build_principal_2
 /usr/include/openssl/kssl.h:160: parse error before context
 /usr/include/openssl/kssl.h:163: parse error before kssl_validate_times
 /usr/include/openssl/kssl.h:163: parse error before atime
 /usr/include/openssl/kssl.h:165: parse error before kssl_check_authent
 /usr/include/openssl/kssl.h:165: parse error before '*' token
 /usr/include/openssl/kssl.h:167: parse error before enctype
 In file included from mod_ssl.h:116,
   from mod_ssl.c:65:
 /usr/include/openssl/ssl.h:909: parse error before KSSL_CTX
 /usr/include/openssl/ssl.h:931: parse error before '}' token
 make[5]: *** [mod_ssl.lo] Error 1
 make[4]: *** [all] Error 1
 make[3]: *** [subdirs] Error 1
 make[3]: Leaving directory `/tmp/builldinstall/apache_1.3.27/src'
 make[2]: *** [build-std] Error 2
 make[2]: Leaving directory `/tmp/builldinstall/apache_1.3.27'
 make[1]: *** [build] Error 2
 make[1]: Leaving directory `/tmp/builldinstall/apache_1.3.27'
 make: *** [apaci_httpd] Error 2
 

-- 
+ Jon Larsen: Chief Technology Officer, Richweb, Inc.
+ Richweb.com: Providing Internet-Based Business Solutions since 1995
+ GnuPG Public Key: http://richweb.com/jlarsen.gpg
+ Business: (804) 359.2220 x 101; Mobile: (804) 307.6939



Re: Re-installing 1.99_08 binary or 1.99_05 RPM in Red Hat 8 [mp2]

2003-02-05 Thread Jon
(Just an informational post to round off the thread.)

The following worked for me, I now have a working mod_perl 1.99!

At 15:08 15/01/2003 +0100, Jérôme Augé wrote:


To compile mod_perl-1.99_xx on RedHat 8.0 I used :

$ perl Makefile.PL MP_APXS=/usr/sbin/apxs

First, I removed the original mod_perl-1.99_05 RPMS then I compiled and
installed the newer one.


Many thanks Jérôme, also Stas, and Paul for the advice on ditching the 
RPM's :o)




Re-installing 1.99_08 binary or 1.99_05 RPM in Red Hat 8 [mp2]

2003-01-15 Thread Jon

I'm new to mod_perl, and was having fun tinkering with mod_perl-1.99_05-3 
on Red Hat 8 (Perl 5.8.0 / Kernel 2.4.18-17.8.0 on an i686 / 
Apache/2.0.40), installed from RPM's.

I wanted to get the older Apache:: modules to work, I noted that the ones i 
wanted came with mod_perl-1.27, and made the (*very* bad) decision of 
trying to install the old version and getting mod_perl2 to work in 
'compatibility mode'.  So I tried to install 1.27 from the binary which of 
course required Apache 1.3, which I had - but not the sources.  This 
resulted in a broken mod_perl installation and me only having some of the 
modules I required, which of course mostly fail anyway due to dependency 
issues.

I dont think I can install from mod_perl-1.99_08.tar.gz:  I hunted for a 
value for MP_AP_PREFIX - it's probably due to me having installed Apache 
from an RPM, but there is no path under which the include/ directory with 
Apache C header files can be found that I can find - something a bit more 
concrete to feed into 'slocate' or 'find' might help here.

Apache/2.0.40 Server compiled with
 -D APACHE_MPM_DIR=server/mpm/prefork
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D HTTPD_ROOT=/etc/httpd
 -D SUEXEC_BIN=/usr/sbin/suexec
[snip]

Also now the RPM is broken:

[root@fooTowers public]# rpm -e --nodeps mod_perl-1.99_05-3.i386.rpm
error: package mod_perl-1.99_05-3.i386.rpm is not installed
[root@fooTowers public]# rpm -ivh mod_perl-1.99_05-3.i386.rpm
Preparing...### [100%]
package mod_perl-1.99_05-3 is already installed

Nice.

Essentially I just want to get mod_perl 2 working again and forget using 
the old Apache:: modules, either using the 1.99_08 binary or the 1.99_05-3 
RPM.  Any suggestions much appreciated!

TIA,
Jon




RE: development techniques - specifically debug methods

2003-01-09 Thread C. Jon Larsen

There is a good technique in the mod_perl cookbock that talks about using 
a Debug module with exported constants. If you program to the API where 
all of your code is compiled into bytecode at server startup into 
discrete packages then this means that all of your debug if() sections 
sprinkled throughout the code are not included as part of the run time 
footprint. This can be quite nice if you have largish chunks of code that 
should run only in debug mode.

I guess this might work for registry scripts too, the 1st time the are 
compiled. 

On Thu, 9 Jan 2003 [EMAIL PROTECTED] wrote:

 
  Do you develop with an xterm tailing the logs, an emacs 
  window (or other
  editor) to edit the script and/or the packages (and on some occassions
  httpd.conf), and a web browser (on an alternate virtual 
  desktop)?  
 
 Bingo. :-)
 
 Do you
  pepper code with :
  
  print option: . $option{$foo . br if $debug;
 
 If it's a longer-term debugging option that I might want again later then I
 might make a debug() method where I'll do 
 debug('this worked ok') and the debug() method might examine a flag to see
 whether it should do anything with that message.  
 Or a log() method that recognizes various levels of messages and obeys a
 debug_level setting or something.  I once used a Java package (the name
 escapes me but it was probably something simple like jLog) that worked sort
 of this way, though it also had some xml config files and such... anyways,
 I'm sure there are plenty of perl modules to do something similar, but the
 debug() is a fairly effective 2 minute alternative.  If's it just a quick
 one-time debug, I'll typically just use a warn or similar.  
 
  
  Fairly low tech, huh.
  
  At apachecon, a speaker (who neither bragged nor rambled) 
  mentioned lwp
  use instead of (or to complement) the web browser portion.
  
  Will the use of lwp instead of a browser improve my coding 
  ability (either
  in terms of speed or just improving my perl coding)?  Seems 
  like I'd have
  to spend too much time with the lwp script (tell it to first 
  request the
  page then choose option A and B then hit the submit button ... )
 
 This sounds more like a testing suite than regular old
 debugging-while-you-go.  Probably a place for both.
 
  
  Is there some way to improve this cycle : edit code - 
  refresh browser -
  possibly look at the error log - edit code - ...
 
 Honestly, this method has always been very efficient for us and most of the
 time we don't need anything more sophisticated for devel/debug.  Now for
 more formal testing, that gets trickier for us and we're currently looking
 for a good way to build some automated tests of our code and our web
 interface without it getting too unwieldy.  This will probably be where we
 spend a lot of time in the first part of the year.  Maybe LWP will be handy
 here.
 
 -Fran 
 

-- 
+ Jon Larsen; Chief Technology Officer, Richweb.com
+ GnuPG Public Key http://richweb.com/jlarsen.gpg
+ Richweb.com: Providing Internet-Based Business Solutions since 1995
+ Business Telephone: (804) 359.2220
+ Jon Larsen Cell Phone: (804) 307.6939




win32 testing only?

2002-12-05 Thread Jon Reinsch
At 
http://perl.apache.org/docs/1.0/guide/getwet.html#Installing_mod_perl_for_Window
it says:
we recommend that mod_perl on Windows be used only for testing 
purposes, not in production

Does this apply to mod_perl 1.0 only, or to 2.0 as well? If both, is it 
likely to change anytime soon?

(I reached the page above by going to 
http://perl.apache.org/start/index.html, clicking on Get Your Feet 
Wet, and then on Installing mod_perl for Windows.)



Knowing the connection status

2002-11-07 Thread Jon
Hi list,

I'm currently working on a project that uses a closed source C api. I know the 
functions and what they return but have no clue what happends in the background. To be 
able to use this with mod_perl I've made a module using perlxs that basicly is a 
wrapper around the API's functions. This API connects to a server and can only handle 
one connection at the time so my wrapper needs to know if it is connected and avoid 
connecting again if it allready is connected. There is no reasonable way I can test my 
connection status, ie there is no get_connection_status or equivalent function I can 
call. Trying to fetch or send data if there is no connection will force me to wait for 
the timeout which I can't do since all scripts using the API will be extremly slow 
then. The connect function is very slow too, it takes a few secs to do the connect so 
I don't want to do extra connects either, plus it seems to result in core dumps when I 
try to do connect if I'm allready connected.

I was first thinking about using a global variable in the wrapper's connect function 
but I'm not sure what would happend if the script crashes, will the httpd process die 
and the global variable be reseted or will it be set to CONNECTED when the next 
request comes to that child?

So to stop my ramble and get on with my question, how should I approach this in a way 
that guarantees that I'll only do connect/disconnect if needed and also be able to 
keep track of my status in a safe way? If you're thinking refuse to do it, go to the 
makers of the API and beat them untill they fix it up or snort/strace the API and make 
your own API based of what they send, I've allready thought about it and I've come to 
the conclusion they're not options :)

/Jon



Re: PerlRun and text/xml data: zero bytes

2002-09-20 Thread Jon

On Thu, 19 Sep 2002 09:45:53 -0500
Scott Nelson [EMAIL PROTECTED] wrote:

 I am having problems reading standard input while running under PerlRun. 
 I am trying to use text/xml data POSTed to an url, as opposed to form-data.
 
 I get the data when running in CGI mode, but I get zero bytes when 
 running in PerlRun mode. How do I read the data POSTed to the URL?
 
 I have isolated my problem down to this short script:
 
 #! /usr/bin/perl -w
 
 use strict;
 use diagnostics;
 use XML::LibXML;
 
 my $parser = XML::LibXML-new();
 my @input = ;
 my $input = join(\n, @input);
 #my $doc = $parser-parse_string($input);
 #my $plainText = $doc-toString();
 my $plainText = $input;
 my $length = length($plainText);
 
 print Content-type: text/plain\n;
 print Content-length: $length\n;
 print \n;
 print $plainText;
 
 The content length is 0!


I guess you've checked that $plainText isn't of length 0?

/Jon



Seg Fault with PHP and Perl together

2002-09-04 Thread Jon Harris

Hi

I inherited a very happy cobalt raq3 with 2 sites using embedded Perl 
which work very well. There are about 20 sites on the box. I needed to 
get PHP running on the same box, so I made the module, added it into the 
httpd.conf and PHP was working fine - Except that it broke the perl sites.

The http error log entry is:
child pid 22610 exit signal Segmentation fault (11)

- the client gets a 'page not found error'.

All I have to do get perl working again is to comment out

LoadModule php4_module /usr/lib/apache/libphp4.so
(and)
AddModule mod_php4.c

and restart httpd, it works fine again, obviously minus the php

Bearing in mind, I am on about page 3 of O'Reilly's Apache - The 
definitive Guide does anyone know the simplist way I can get it 
working? I don't need any sites to use both embperl and php together.

This is a virtual site section in httpd.conf for one of the perl sites 
(anonymised) there is also a big Perl chunk in the httpd.conf, not 
sure if that is relevant here.

*
VirtualHost 0.0.0.0
ServerName thedomain.com
ServerAdmin root
DocumentRoot /home/sites/site42/web
ServerAlias thedomain.com
PerlModule Apache::DBI
PerlModule HTML::Embperl
PerlSetEnv EMBPERL_OPTIONS 8208
PerlSetEnv EMBPERL_ESCMODE 0
RewriteEngine on
RewriteCond %{HTTP_HOST}!^0.0.0.0(:80)?$
RewriteCond %{HTTP_HOST}!^www.thedomain.com(:80)?$
RewriteRule ^/(.*)  http://www.thedomain.com/$1 [L,R]
RewriteOptions inherit
#Files *.htm*
#SetHandler perl-script
#PerlHandler HTML::Embperl
#Options ExecCGI
#/Files
AliasMatch ^/~([^/]+)(/(.*))? /home/sites/site42/users/$1/web/$3
AliasMatch ^/users/([^/]+)(/(.*))? /home/sites/site42/users/$1/web/$3
# AddHandler server-parsed .shtml
# AddTypetext/html .shtml
AddHandler cgi-wrapper .cgi
AddHandler cgi-wrapper .pl
/VirtualHost
*

It looks like perl and PHP are getting in each others way, should I try 
and make a new apache? what order should I do things in? Should I look 
for another job? :), I need to get it working quickly and with the 
minimum disruption to the server. Every time I try and do things like 
this on a RAQ something breaks something else, usually its the GUI and I 
get about 50 phone calls.

perl is version 5.005_03, Apache 1.3, PHP 4.21

TIA

Jon Harris
[EMAIL PROTECTED]







Re: Hiding perl code

2002-07-22 Thread Jon

At my former employer's, we built an Enterprise Management System out of
mod_perl. He wants to distribute it to clients w/o risking theft of his
code.

--Jon R.

PGP Key fingerprint = 12 DA FC 06 AB 4C D6 A4  DE 03 E0 77 D6 DE E0 73
PGP public key available by fingering [EMAIL PROTECTED]

On Mon, 22 Jul 2002, Iain Truskett wrote:

 * Jonathon M. Robison ([EMAIL PROTECTED]) [22 Jul 2002 13:03]:
  Anyone know offhand a good way to hide your perl code when using
  mod_perl? Acme::Bleach isn't doing it - httpd is failing to start on
  initial test [...]
 
 Acme::Bleach is a source filter. Source filters will just screw up your
 mod_perl stuff. IIRC, you get similar problems using Switch and so on.
 
  Perhaps perl2exe?
 
 Nope. That does weird compiler stuff that will interfere with the fact
 that Apache's using Perl internally.
 
 
 As far as I know, there's no good way to do it. It is Perl after all.
 And with mod_perl things just get trickier.
 
 Out of interest, why?
 
 
 cheers,
 -- 
 Iain.
 




Re: separating C from V in MVC

2002-06-13 Thread Jon Robison

I just wanted to comment on Number 3, here. Scroll down ;-)


kyle dawkins wrote:
 
 Fran (et al)
 
 I've stayed out of the MVC chitchat for a long time (very interesting
 thread) because it's such a deep topic.  But seeing as how Fran has
 some concrete questions...
 
  3.  How do you prevent a Controller from just becoming another big if
  statement, or is this their purpose in life?
 
 See Jeff's previous mail.  Your structure is crying out for a dispatch
 table; Jeff suggests building this out of a hash that defines what
 actions to perform based on what your query values are.  That's a great
 place to start.   GET RID OF YOUR BIG IF STATEMENT ASAP.
 

If I read this right, then it's something I am already doing and I'll
throw it in here to show:

## My idea of a dispatch table!
my %actions = (
'view' = 'FES::Control::View',
'logout'   = 'FES::Control::Logout',
'edit' = 'FES::Control::Edit',
'notes'= 'FES::Control::Notes',
'save' = 'FES::Control::Save',
'calendar' = 'FES::Util::Calendar',
);
 
sub handler {
my $r = Apache::Request-new(shift);
 
## BEGIN ignore (DECLINE) image requests and allow regular apache to
handle them.
return DECLINED if $r-content_type =~ /image/;
## END ignore image requests
 
my $act = $r-param('act') || 'view';
 
if (my $h = $actions{$act}) {
$r-push_handlers(PerlHandler = $h);
$r-handler('perl-script');
return DECLINED;
} else {
my $stmt = There is no such action as \' . $act . \'\n;
$r-pnotes('error', $stmt);
$r-push_handlers(PerlHandler = 'FES::Error::Error');
$r-handler('perl-script');
return DONE;
} ## end else [ if (my $h = $actions{$act...
}
1;

That's how I impliment at least _part_ of my controller without
resorting to huge IF statements.

Is this what was meant guys?

--Jon R.

If this is overly simplistic, or not what you meant, feel free to smack
me around.



Re: Idiot question: headers at the base of the page.

2002-06-13 Thread Jon Robison

Don't recall offhand, but I know there is an http.conf momd_perl config
command that will set 'auto-header' for you. Perhaps that is already on?

--Jon Robison

Issac Goldstand wrote:
 
 umm... If you send them twice.  Aside from happening by doing
 $r-send_http_header twice (it's happened), it could be something else is
 automatically sending header s for you...
 
 Just an idea...
   Issac
 
 - Original Message -
 From: Rafiq Ismail (ADMIN) [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, June 13, 2002 12:19 AM
 Subject: Idiot question: headers at the base of the page.
 
  I'm doing squinty eyed coding and need someone to knock common sense into
  me.  In the right order - as far as I can see - I have my content_type
  ;send_http_headers; $r-print'ed.  With loads of poo in between.  Under
  what circumstances would my page render, dumping the HTTP headers at the
  base?  Other than their being sequentially out of order, that is.
 
  It's probably one of those look at it again in the morning questions.
 
  Someone hit me over the head with a hammer please.
 
 
 
 



Sending Mail

2002-06-13 Thread Jon Robison

Can anyone give me recommendations on a good Mail handler that
integrates well with mod_perl?

I have a system whereby I want to give people the ability to mail the
currently viewed page to someone. Once they select a To: address, the
system will look up some data, re-construct the viewed page in a textual
format, and send the mail.

I'm just looking for recommendations on a good perl mailing module for
this kind of use.

--Jon Robison



Re: Sending Mail

2002-06-13 Thread Jon Robison

Can MIME::Lite do attachments?

--Jon

Joe Breeden wrote:
 
 We use MIME::Lite seems to work well for us.
 
  -Original Message-
  From: Jon Robison [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, June 13, 2002 8:57 AM
  To: [EMAIL PROTECTED]
  Subject: Sending Mail
 
 
  Can anyone give me recommendations on a good Mail handler that
  integrates well with mod_perl?
 
  I have a system whereby I want to give people the ability to
  mail the
  currently viewed page to someone. Once they select a To: address, the
  system will look up some data, re-construct the viewed page
  in a textual
  format, and send the mail.
 
  I'm just looking for recommendations on a good perl mailing module for
  this kind of use.
 
  --Jon Robison
 



Re: Sending Mail

2002-06-13 Thread Jon Robison

Geesh, it's nice having the books author(s) on the mailing list here!

--Jon R.

Geoffrey Young wrote:
 
 Jon Robison wrote:
 
  Can MIME::Lite do attachments?
 
 
 yes.  there is an example in the cookbook that uses MIME::Lite:
 
 http://www.modperlcookbook.org/code/ch15/Cookbook/Mail.pm
 http://www.modperlcookbook.org/code/ch15/Cookbook/EmailUploads.pm
 
 HTH
 
 --Geoff



MVC Topic Joy

2002-06-10 Thread Jon Robison

I can make no claims to being any kind of exceptional programmer. Heck,
I don't even claim to be half bad. But this topic has really revealed to
me that the concept of MVC means many things to many people.

In the end, I think what I have concluded, at least for my purposes, is
simply this:

1. Modules that deal with core data (i.e. that read/write to the
database) shall never output HTML/XML/Whatever. Just hashed (complex)
data, or simple arrays.

2. Modules that DO create HTML/XML/Whatever should take the core level
data and make the html

3. Modules that present the data should take the html produced by #2
above, wrap as needed in start and end tags, and spit out the resulting
page. They data output by #2 shouldn't matter to this module.

Whereas I know this is overly simplistic, I think that as a rule, it
should work. If I catch myself sticking HTML into the output from my DBI
call before I return the final result, I know I have broken my rule and
should re-think whatever I am doing. I should never really have to edit
#3 (the Viewer), because the HTML construction should be done in #2. If
I find myself editing my viewer to accomodate some function I am adding
to the overall system, I know I need to re-think what I am doing.

Simplistic, yes. Workable, yes. It meets the KISS principle, at least.
;-)

Comments, disagreements, smacks across the virtual face willingly
accepted.

--Jon Robison



Re: MVC Topic Joy

2002-06-10 Thread Jon Robison

Essentially a Dispatch.pm module, which simply looks at the url string
params and sets a Handler based upon the value of the action param.
(After handling security, etc.).

In most cases the Handler is set to view, in which case View.pm
instantiates other modules objects, (and those instantiations use other
url string data to determine what to construct into the object). View
then just spits out the default head, body (created with the other
objects) and footer.

All of the real work is done by the other modules. View.pm could care
less what comes back from $html_obj-view_data. It just adds the result
to $body. It's the html module's job to fill the return from view_data
with the correct information.

Hope this explanation serves. Like I said, I can't lay claim to being a
guru ;-)

--Jon

Perrin Harkins wrote:
 
 Jon Robison wrote:
   I should never really have to edit
  #3 (the Viewer), because the HTML construction should be done in #2. If
  I find myself editing my viewer to accomodate some function I am adding
  to the overall system, I know I need to re-think what I am doing.
 
 In an MVC system, you would definitely need to edit the controller any
 time you change the input side of the user interface.  You may or may
 not need to change the model and view as well.
 
 Which part handles taking the user input, figuring out which methods to
 call on the model objects, and choosing a view (usually a template) to
 show?  This is all stuff that the controller would do in an MVC system,
 and you don't seem to have one in your description.  If you don't have a
 controller, you will end up wedging that stuff into the model objects
 which makes them a lot less reusable.
 
 Don't get me wrong: a basic script + a template is still better than a
 basic script + a bunch of print statements, but there is value in the
 separation of the controller and the model too.
 
 - Perrin



Re: RPM for apache/mod_perl/mod_ssl

2002-06-05 Thread Jon Robison

fliptop, I'll take a copy of that spec file, if you don't mind!!!

--Jon Robison


fliptop wrote:
 
 Fran Fabrizio wrote:
 
 
  We're currently struggling for an easy way to distribute our
  apache/mod_perl/mod_ssl-based application to our data center folks who
  are in a different state and whom we must presume know nothing about
  apache, mod_perl or mod_ssl and are capable of nothing more complicated
  than using RPM to install/update a package.
  As such, does there exist such a thing as an RPM that installs apache
  with mod_perl AND mod_ssl enabled?  I presume this would also have to
  include openssl.  I can only imagine what a pain it would be to create
  this beast, but if it's been done, I'd like to give it a try.
 
 what o/s and version are you running?
 
 i have an rpm for apache 1.3.22, mod_perl 1.26, and mod_ssl 2.8.5 that i
 run on redhat 6.2.  i'd be glad to give you the .src (or the .rpm if you
 also run redhat 6.2) if you would like it.
 
 or, i could just give you the .spec if you'd like to build a new rpm
 with the latest versions.



Re: Apache::TicketAccess

2002-05-31 Thread Jon Robison

You might want to consider Apache::AuthTicket, which IS in CPAN.  It's
an expanded version of the Eagle book's modules, and very capable, yet
also relatively simple.

--Jon Robison

Per Einar Ellefsen wrote:
 
 At 21:50 31.05.2002, Arnold van Kampen wrote:
 
 Hi
 
 Where did it go?
 
 The modules written for the Eagle book haven't been released to CPAN. They
 are available online. See
 http://modperl.com:9000/book/source/apachemod-code-1.02/lib/Apache/
 
 --
 Per Einar Ellefsen
 [EMAIL PROTECTED]



Re: [OT] Refs don't work, like I want

2002-05-17 Thread Jon Robison

In support of F. Xavier Noria, and in simpler terms - your $vars = {
. } overwrote your previous assignment of $vars-{'key2'}.

Perhaps you could have done:

my $var = {};
$var-{'key2'} = some value;
my @args = qw/ XXX YYY ZZZ /;
my @vals = qw/ AAA BBB CCC /;
my $i;
for ($i =0; $i  scalar(@args); $i++) {
  $vars-{$args[$i]} = $vals[$i];
}
$var-{'key1'} = some other value;

This would not have overwritten the $var-{'key2'} assignment.

--Jon Robison


F.Xavier Noria wrote:
 
 On Fri, 17 May 2002 17:10:53 +0300 (EEST)
 Viljo Marrandi [EMAIL PROTECTED] wrote:
 
 : $vars-{'key2'} = value of second key;
 
 The hash $vars points to has a key named key2.
 
 : $vars = {
 : xxx = AAA,
 : yyy = BBB,
 : zzz = CCC,
 : };
 
 Now you change the reference stored in $var. It points to an entirely
 new hash, whose keys are xxx, yyy and zzz.
 
 : $vars-{'key1'} = value of first key;
 
 Here you add the key key1 to the hash $vars points to.
 
 : Problem is, that value of key2 is lost after I set values to xxx, yyy and
 : zzz, but key1 is ok.
 
 $vars contains a reference to a hash that has nothing to do with the
 first one, you didn't create a key named key2 in that hash.
 
 -- fxn



Re: Scope of Perl Special Variables

2002-05-05 Thread Jon

I thought that using 'local' would successfully scope those globals to
within a sub, so you could,k for example, slurp an entire file by doing:

local $/ = undef;
my $file = FH;

Or am I wrong in that?  I use it frequently, and don't seem to have any
troubles.

--Jon R.

PGP Key fingerprint = 12 DA FC 06 AB 4C D6 A4  DE 03 E0 77 D6 DE E0 73
PGP public key available by fingering [EMAIL PROTECTED]

On Fri, 3 May 2002, Bill Catlan wrote:

 Hello,
 
 The online mod_perl guide
 (http://thingy.kcilink.com/modperlguide/perl/The_Scope_of_the_Special_Perl_Va.ht
 ml) states:
 
 Special Perl variables like $| (buffering), $^T (script's start time), $^W
 (warnings mode), $/ (input record separator), $\ (output record separator) and
 many more are all true global variables; they do not belong to any particular
 package (not even main::) and are universally available. This means that if you
 change them, you change them anywhere across the entire program; furthermore you
 cannot scope them with my().
 
 My question pertains the CGI %ENV hash.  First, I'm assumong that this is a
 global variable in the sense of a Perl Special Variable, and not just a main::
 or other package global.  My question is how is it the case that the %ENV
 variable script instance might be working with doesn't get clobbered or reset
 by the next incoming request.  Are some variables, like %ENV treated differently
 by mod_perl?
 
 Also, how can special variables be reliably initialized?  For example, if one
 request provides a certain attribute, such as HTTP_IDENT, but a subsequent
 request does not, how do I know that the value of $ENV{HTTP_IDENT} on the second
 request will indeed be undefined?
 
 Thanks.
 
 Bill
 
 




Re: the cookbook review on perl.com

2002-04-26 Thread Jon Robison


Not sure I would want this person evaluating my books . . .

  not so great if you need your hands holded.

Somebody get this reviewer a grammer checker!

--Jon Robison

Stas Bekman wrote:
 
 For a nice review of the latest and the greatest mod_perl cookbook head
 to perl.com: http://www.perl.com/pub/a/2002/04/25/review.html
 (by Simon Cozens)
 
 __
 Stas BekmanJAm_pH -- Just Another mod_perl Hacker
 http://stason.org/ mod_perl Guide --- http://perl.apache.org
 mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
 http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: the cookbook review on perl.com

2002-04-26 Thread Jon Robison

No it is not. It should read not so great if you need your hands held.

--Jon R

Wiswell, Virginia wrote:
 
  Somebody get this reviewer a grammer checker!
 
 this is a joke, right?
 
 -Original Message-
 From: Jon Robison [mailto:[EMAIL PROTECTED]]
 Sent: Friday, April 26, 2002 9:14 AM
 To: Stas Bekman
 Cc: [EMAIL PROTECTED]
 Subject: Re: the cookbook review on perl.com
 
 Not sure I would want this person evaluating my books . . .
 
   not so great if you need your hands holded.
 
 Somebody get this reviewer a grammer checker!
 
 --Jon Robison
 
 Stas Bekman wrote:
 
  For a nice review of the latest and the greatest mod_perl cookbook head
  to perl.com: http://www.perl.com/pub/a/2002/04/25/review.html
  (by Simon Cozens)
 
  __
  Stas BekmanJAm_pH -- Just Another mod_perl Hacker
  http://stason.org/ mod_perl Guide --- http://perl.apache.org
  mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
  http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: the cookbook review on perl.com

2002-04-26 Thread Jon Robison

Oye!

Hmmat least I have the excuse that I'm not a writer ;-)

--Jon

Fran Fabrizio wrote:
 
  Wiswell, Virginia wrote:
 
 Somebody get this reviewer a grammer checker!
 
 this is a joke, right?
 
 Uh, Jon, she was pointing out that you misspelled 'grammar'.  :-)
 
 -Fran



Re: the cookbook review on perl.com

2002-04-26 Thread Jon Robison

Crud!

Well, at least I hadn't said spell checker!

--Jon

fliptop wrote:
 
 Jon Robison wrote:
 
  No it is not. It should read not so great if you need your hands held.
 
 i think he was referring to the fact that you spelled grammar incorrectly.



Re: Apache::OK error

2002-04-25 Thread Jon Robison


maybe a use Apache::Constants qw/ :common /;  

--Jon Robison

Lihn, Steve wrote:
 
 Hi,
 I am testing the Apache::Echo connection handler for Apache2 and mod_perl 2.
 But encounter the following error:
 
 [Thu Apr 25 15:32:15 2002] [error] failed to resolve handler `Apache::Echo'
 [Thu Apr 25 15:32:15 2002] [error] Bareword Apache::OK not allowed while
 strict subs in use at C:\Apache2/blib/lib/Apache2/Apache/Echo.pm line 25.
 Compilation failed in require at (eval 2) line 3.
 
 What do I miss?
 
 --Steve
 
 --
 package Apache::Echo;
 
  use strict;
  use Apache::Connection ();
  use APR::Socket ();
 
  use constant BUFF_LEN = 1024;
 
  sub handler {
  my Apache::Connection $c = shift;
  my APR::Socket $socket = $c-client_socket;
 
  my $buff;
 
  for (;;) {
  my($rlen, $wlen);
  my $rlen = BUFF_LEN;
  $socket-recv($buff, $rlen);
  last if $rlen = 0;
  $wlen = $rlen;
  $socket-send($buff, $wlen);
  last if $wlen != $rlen;
  }
 
  return Apache::OK;
  }
 
  1;
  __END__
 
   Steve Lihn
   FIS Database Support, Merck  Co., Inc.
   Tel: (908) 423 - 4441
 
 --
 Notice:  This e-mail message, together with any attachments, contains information of 
Merck  Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, 
proprietary copyrighted and/or legally privileged, and is intended solely for the use 
of the individual or entity named in this message.  If you are not the intended 
recipient, and have received this message in error, please immediately return this by 
e-mail and then delete it.
 
 ==



Re: full-featured online database apps

2002-04-24 Thread Jon Robison

It was my understanding that there are numerous tools for converting
tables like this at the mysql.com site.  Some will even access the
Access tables via ODBC and create a set of tables directly for you, or
just make dumps that can be read into MySQL.

Once made, Webmin does a good job of administering mysql databases.
www.webmin.com

--Jon Robison

Adi Fairbank wrote:
 
 Does anyone know of a good customizable, user-friendly, online database
 application, preferably mod_perl-based?  I want to migrate a small Access
 database to MySQL with a web interface, for added features and room for
 growth.  Has anyone come across a good open source project or toolkit that
 would make this job really easy?
 
 TIA,
 -Adi



RE: Content management systems

2002-04-09 Thread Jon Coulter

Yeah, the system that runs slashdot (and many other major sites),
'slashcode' is in modperl:

www.slashcode.com

I think the 'everything' system that runs perlmonks.org is in mod_perl
too, might want to check it out (just see the perlmonks' site)

Jon Coulter
[EMAIL PROTECTED] 

-Original Message-
From: Matthew Watson [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, April 09, 2002 1:54 AM
To: [EMAIL PROTECTED]
Subject: Content management systems


Heya.

 I was wondering if there are any content management systems around for
modperl , i'm after a similar kind of thing as postnuke for php. I'd
much rather something 'out of the box' as I don't have time to develop a
system from scratch mysql.

Regards

--
Matthew Watson
Development, Netspace Online Systems
[EMAIL PROTECTED]




Re: mod_perl and open files limit

2002-04-06 Thread jon schatz

On Thu, 2002-04-04 at 00:46, Mike V. Andreev wrote:
 Hello.

hi.

 During the work with web interface 
 number of open files slowly grows and finally reaches OS limit. 
 And this happens with only 2-3 users working with interface !!!
 If to restart apache number of open files comes back in norm, so I think that
 the problem roots in my way of mod_perl usage.

first of all, is your code closing all the filehandles it opens? garbage
collection works differently in mod_perl, and unless you explicitly
close fh's, they have the tendency to stay around for awhile.

 What kind of diagnostics can be done to find out what causes the  
 problem?

try lsof(8), which will list all open files (and the process they belong
to).

-jon

-- 
[EMAIL PROTECTED] || www.divisionbyzero.com
gpg key: www.divisionbyzero.com/pubkey.asc
think i have a virus? www.divisionbyzero.com/pgp.html
You are in a twisty little maze of Sendmail rules, all confusing. 



signature.asc
Description: This is a digitally signed message part


Apache 2.0 gold -- now when mod_perl 2.0?

2002-04-05 Thread Jon Coulter

It looks like Apache 2.0(.35) is 'gold', so when can we expect a 'gold'
version of mod_perl 2.0 so we can actually make apache 2 fun? ;p

Jon Coulter
[EMAIL PROTECTED] 




Apache::VMonitor not showing requests (might be Apache::Scoreboard problem)

2002-04-04 Thread Jon Molin

Hi list,

I've got some problems with getting Apache::VMonitor showing the
requests, everything but client ip and requests shows. 
when i call server/scoreboard do i get a file, and 'strings
scoreboard|grep -A 1 myip' shows my ip and request (can't find the pid
though) so the info should be there. I've added :
 'REQ='.$rec-{request}.''; #line 373 in Apache::VMonitor
and when i call server/sys-monitor do i get 'REQ=' foreach row. So it
tries to print but it's all empty.

I guess this is some silly conf thingy i've missed out. I have it
running fine on another system and i can't see the diff in
configuration.
here's a snippet of httpd.conf:

# httpd.conf
PerlFreshRestart On  
Perlrequire /usr/local/apache/conf/startup.pl
PerlModule Apache::Scoreboard

Location /perl-status
   SetHandler perl-script
   PerlHandler Apache::Status
   order deny,allow
   deny from all
   allow fromlocalhost
/Location
Location /sys-monitor
   SetHandler perl-script
   PerlHandler Apache::VMonitor
   order deny,allow
   deny from all
   allow from localhost 
/Location
Location /scoreboard
   SetHandler perl-script
   PerlHandler Apache::Scoreboard::send
   order deny,allow
   deny from all
   allow from localhost 
/Location
# END
and here's the part from startup.pl with Apache::VMonitor:
use Apache::VMonitor();
$Apache::VMonitor::Config{BLINKING} = 1;
$Apache::VMonitor::Config{REFRESH}  = 0;
$Apache::VMonitor::Config{VERBOSE}  = 0;
$Apache::VMonitor::Config{SYSTEM}   = 1;
$Apache::VMonitor::Config{APACHE}   = 1;
$Apache::VMonitor::Config{PROCS}= 1;
$Apache::VMonitor::Config{MOUNT}= 1;
$Apache::VMonitor::Config{FS_USAGE} = 1;
$Apache::VMonitor::Config{SORT_BY}  = 'size';
$Apache::VMonitor::PROC_REGEX = join |, qw(httpd mysql);
$Apache::VMonitor::Config{PROC_REGEX}  = join |, qw(httpd mysql);
#END

And here's my system:
Embedded Perl version v5.6.0 for Apache/1.3.23 (Unix) mod_perl/1.26 
$Apache::VMonitor::VERSION = '0.6';
Apache::Scoreboard version: $VERSION = '0.10';

So is there anything obivous I've missed out?

/Jon



Re: AddModule mod_perl.c

2002-03-27 Thread jon schatz

On Thu, 2002-03-28 at 00:00, Perrin Harkins wrote:
 I'm afraid I'm not that much help with install problems because I just
 haven't had any of my own to deal with.  You can try using Apache
 Toolbox to do the build.  It's supposed to make this stuff easier. 

also check this out (Apache Compile HOWTO). Walks you through
compiling apache + mod_perl + mod_ssl + php + just about everything else
you need. i keep it bookmarked because i always forget the openssl
commands to generate a self-signed certificate.

http://www.delouw.ch/linux/apache.phtml

-jon

-- 
[EMAIL PROTECTED] || www.divisionbyzero.com
gpg key: www.divisionbyzero.com/pubkey.asc
think i have a virus? www.divisionbyzero.com/pgp.html
You are in a twisty little maze of Sendmail rules, all confusing. 



signature.asc
Description: This is a digitally signed message part


Re: Accessing Apache master process pid

2002-03-26 Thread Jon Jensen

On Wed, 20 Mar 2002, Geoffrey Young wrote:

   Jon Jensen wrote:
   
Within mod_perl, I would like to know the pid of the master Apache daemon,
 
 well, here's one other way:
 
 Perl
   $Apache::Server::SaveConfig = 1;
   $PidFile = 'logs/httpd.pid';
 /Perl
 
 PerlInitHandler 'sub { warn The parent pid file is: , \
shift-server_root_relative($Apache::ReadConfig::PidFile)}'
 
 yeilds:
 The parent pid file is: /usr/local/apache/logs/httpd.pid at (eval 312)
 line 1.
 
 if you really need access to ap_pid_fname() that looks easy enough,
 but justification for needing it would help doug make the
 architectural decision whether to include it or not in core.

My main motivation is the Don't Repeat Yourself principle -- I'd like to 
be able to find out the name of the pidfile without duplicating its name 
and location anywhere in the configuration, and since Apache already knows 
it, I can't think of a reason mod_perl shouldn't expose it.

But either way, life will go on. :)

Jon




Re: Asia To USA Shipping Rates

2002-03-25 Thread Jon Molin

Vuillemot, Ward W wrote:
 
 Not to beat a dead horse...but we all can have an impact on these guys.
 
 Write a VERY pointed email explaining your position as a web developer.  If
 you do contracting work, convince the company that you _will_ never use
 their product, nor suggest it to any of your *many* customers. . .and will
 further go to any pains to direct traffic to their competitors.  Period.
 

yeah and then they'll sell our addresses, earn a small amount of money
and fill our inboxes with spam.
do you send mail to 'reply to this address if you wanna be removed too'?
;)

/Jon

 we are the ones with the power. . .we are the GEEKS!  And the NERDS!  I mean
 those two words in the best of light, with the greatest of respect and
 pride.  :D
 
 Cheers,
 Ward




Accessing Apache master process pid

2002-03-19 Thread Jon Jensen

Forgive me if this is really elementary.

Within mod_perl, I would like to know the pid of the master Apache daemon,
*after* it forks and goes into the background, but without knowing the
location of httpd.conf or knowing the pidfile beforehand. Storing $$
during startup gives me the pid before forking (i.e., on an idle Linux
system it's usually 2 lower than the pid of the actual daemon). Checking 
$$ in the children is of course not useful.

It seems like I could do one of the following:

1. Just ask some secret Apache routine to give me the number. I haven't 
found such a routine.

2. Find a way to access Apache globals such as char *ap_pid_fname, then 
read the file. This would be fine.

3. Snag the PidFile directive during startup time.

But I haven't found a way to do any of those so far. Most access to pids
seems centered on child pids, while the master pid seems totally
unavailable. (Apache::Scoreboard, for example.)

Does anyone know of a nice way to do this?

Thanks,
Jon




Re: Accessing Apache master process pid

2002-03-19 Thread Jon Jensen

On Wed, 20 Mar 2002, Stas Bekman wrote:

 Jon Jensen wrote:
  
  Within mod_perl, I would like to know the pid of the master Apache daemon,
 
 perldoc -f getppid

Thanks, Stas. I should've found that. I'm still interested in getting the 
PidFile setting at runtime, but can live without it if I have to.

Jon




Re: Net::LDAP::Extension

2002-02-27 Thread Jon Molin

Murugan K wrote:
 
 Hi
  Can please  you direct me to the   Net::LDAP::Extension
 Documentation.
 

http://search.cpan.org/search?mode=modulequery=Net%3A%3ALDAP%3A%3AExtension

 Thanks in advance.
 
 Regards
 K.Murugan



Re: Apache::Session

2002-02-26 Thread Jon Robison

As an add-on to this, does anyone know if one could use MySQL HEAP
(memory resident) tables for the session table?

--Jon Robison

Rob Bloodgood wrote:
 
  I am using Apache::Session with Postgresql. Unfortunately I had
  never worked with a huge amount of data before I started to program
  something like a (little) web application. I happily packed
  everything in the session(s-table) that might be of any use. It
  hit me hard that it takes a veeey long time to get all the stuff
  out of the session(s-table) each time the client sends another
  request.
 
 Sorry if this is obvious, but
 do you have an index on your sessions table, on the sessionid column?
 Because, without an index, PG will have to do a full table read for each
 request.  Which means the more sessions you get, the slower each lookup is
 going to be.  Whereas, if you index SESSIONID (or SESSION_ID or whatever it
 is), it can go right to the row in question and return it immediately.
 
 L8r,
 Rob
 
 #!/usr/bin/perl -w
 use Disclaimer qw/:standard/;



Re: how to pass data in internal redirects?

2002-02-26 Thread Jon Robison

$r-pnotes persist across internal_redirects, I believe.

--Jon Robison

Igor Sysoev wrote:
 
 On Tue, 26 Feb 2002, F. Xavier Noria wrote:
 
  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?
 
 As far as I know r-notes() do not persist across internal redirections.
 You can try r-err_header_out() but clean up it in second handler
 before content output.
 
 Igor Sysoev



Re: POST without any content - sometimes

2002-02-16 Thread jon

On Sat, 2002-02-16 at 01:43, Anders Knuts wrote:
 I don't think it's the users browser since I got one POST with referer and one
 POST without  with only three seconds between. The user runs vanilla Win XP
 with MS IE5.5. I think there is a Norton Personal firewall in between, maybe
 there's the problem?

I don't know about Personal Firewall, but Norton Internet Security does
indeed strip off referer tags. We discovered this at work while
debugging a similar problem. This is part of the Privacy Control
component

-jon

-- 
[EMAIL PROTECTED] || www.divisionbyzero.com
gpg key: www.divisionbyzero.com/pubkey.asc
think i have a virus? www.divisionbyzero.com/pgp.html
You are in a twisty little maze of Sendmail rules, all confusing. 



signature.asc
Description: This is a digitally signed message part


Re: POST without any content - sometimes

2002-02-15 Thread jon schatz

On Fri, 2002-02-15 at 16:07, Ged Haywood wrote:
 [snip,snip]
  to use tcpdump in this case, Any hints?
 
 You can use tcpdump to record the entire conversation between the
 browser and the server.  To find out how to use it you can just type
 'man tcpdump'.  

although tcpdump output isn't very pretty, especially to someone who
isn't familiar with libpcap. you might have better luck with a front-end
to tcpdump. i personally reccomend ethereal (www.ethereal.com), which
runs on *nix and win32. using something like this makes it easier t
-- 
[EMAIL PROTECTED] || www.divisionbyzero.com
gpg key: www.divisionbyzero.com/pubkey.asc
think i have a virus?: www.divisionbyzero.com/pgp.html
You are in a twisty little maze of Sendmail rules, all confusing. 



signature.asc
Description: This is a digitally signed message part


Re: POST without any content - sometimes

2002-02-15 Thread jon schatz

On Fri, 2002-02-15 at 16:20, jon schatz hit the send button to quickly:
 runs on *nix and win32. using something like this makes it easier t

meant to say makes it easier to see the actual HTTP conversation, not
just the tcp traffic. oops.

-jon

-- 
[EMAIL PROTECTED] || www.divisionbyzero.com
gpg key: www.divisionbyzero.com/pubkey.asc
think i have a virus?: www.divisionbyzero.com/pgp.html
You are in a twisty little maze of Sendmail rules, all confusing. 



signature.asc
Description: This is a digitally signed message part


Re: Question...

2002-02-13 Thread Jon Robison

On page leave?  Well I think you can of course use javascript on all the
links on the page, but I don't believe you can do much about the user
typing in a new url in the browser. . .
but that's just IMHO.

--Jon


Ryan Parr wrote:
 
 I think I'm missing something...
 
 If you set a session cookie (i.e. one with no expiry time) then the cookie
 will be deleted immediately upon browser close, forcing the user to login
 again if they've closed their browser instance.
 
 If you don't use cookies and allow basic auth then the exact same behavior
 is called, forcing the user to re-login only if they've closed that browser
 instance.
 
 Is there someway to expire cookies on page leave, or is this the smartass
 thing you were referring to? :)
 
 -- Ryan Parr
 
 - Original Message -
 From: Jon Robison [EMAIL PROTECTED]
 To: Ron Beck [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Tuesday, February 12, 2002 12:28 PM
 Subject: Re: Question...
 
  Cookies!
 
  /me is in smartass mode today.
 
  --Jon
 
  Ron Beck wrote:
  
   Hello all,
   I need to know how to clear the $ENV variables.  For example, I use a
   .htaccess file for specific directories which requires the user to enter
   userID and password.  When they exit the page, I want them to have to
   re-enter userID and passwd if they enter the page again.  Does anyone
   know how this is accomplished?
  
   TIA,
   Ron



Re: Question...

2002-02-12 Thread Jon Robison

Cookies!

/me is in smartass mode today.

--Jon

Ron Beck wrote:
 
 Hello all,
 I need to know how to clear the $ENV variables.  For example, I use a
 .htaccess file for specific directories which requires the user to enter
 userID and password.  When they exit the page, I want them to have to
 re-enter userID and passwd if they enter the page again.  Does anyone
 know how this is accomplished?
 
 TIA,
 Ron



Re: [OT] callisto software graphics

2002-02-07 Thread Jon Robison

Obviously one of those Use our program to build your web site in just 1
hour! things.

Maybe NOFusion? It used to come with a bunch of those Fast Templates

--Jon R.

Aaron Ross wrote:
 
 http://callistocms.com v http://w.moreover.com/
 
 hmmm
 
 --
 aaron ross . alias i, inc
  email . [EMAIL PROTECTED]
  phone . 215 545 6428



Tracing script with problem

2002-01-25 Thread Jon Molin

Hi list,

I had problems with a script that went nuts and took 65MB memory and
alot of cpu. To track this script down I thought Apache:VMonitor would
be perfect, unfortenately I ran into some weird promlems (it said there
was an error in mod_perl.h) and i know gcc might be broken on this
machine so I started scratching my head and came to the conclusion that
this 'oneliner' ought to help me track the error down:

find /www/docs -name '*.cgi' -type f -exec perl -pi -e
's:(#!/usr/bin/perl[ w-]*\s*):$1\nprint STDERR \\nPID=\$\$
SCRIPT=\$ENV{REQUEST_URI} \\n;\n:s;' {} \;

ie, every script now prints it's httpd pid and it's request_uri. So i
just started waiting watching top with excitment and when the 65 MB
httpd process i greped for the pid in the error_log and got the
scriptname and it's arguments. 

Then i reproduced the error on a server with VMonitor to see if what i
missed out. Ok i could see the name of the scrpit but the real problem
was with the query_string, choped after a couple of chars. Now, if i
understand things right (i tried some tweaking on the module) it's not
possible to get more than 64 char. Why is this, and is it really so?

I know I'm no Einstein and i presume thousands of ppl have tried tracing
similar problems, how did you do it? There must be a more effective way
to find it? I know I would've got the script name but since i never
thought it would get the input it got chances are it'd take me a long
time finding the problem if i only knew the name. 

/Jon



Re: Tracing script with problem

2002-01-25 Thread Jon Molin

Stas Bekman wrote:
 
 It's actually easy, take a look at the Apache::SizeLimit or
 Apache::GTopLimit, look at the cleanup handler that they register. Now
 take this handler and dump whatever you need to the file or error_log
 when you find that the process was taking too much memory.
 
 Take a look at this code and you will see that it's very simple.
 

Thanks a bunch, I'll look into that.

Another question, do you (or anyone else for that matter) know how the
accesslog works? (and also why it does work like it does) It seems it
prints after the request is done, otherwise could that easily be used
for checking the parameters, and not only loging. 


/Jon

 _
 Stas Bekman JAm_pH  --   Just Another mod_perl Hacker
 http://stason.org/  mod_perl Guide   http://perl.apache.org/guide
 mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
 http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



Re: DECLINED unless 'text/html' but images never make it

2002-01-14 Thread Jon Robison

How about trying:

return DECLINED unless $r-is_initial_req;

Image calls are not initial requests, they are sub requests.

--Jon Robison


R.Munden wrote:
 
 I've a script (controlled by a Location directive) that wraps a standard
 header and footer around an HTML page
 
 I've this at the top of my script:
 
 my $r = shift;
  return DECLINED unless ($r-content_type() eq 'text/html');
 
 but any images that may be inline never make it to the browser (also, if I
 explicitly call the image in question it never makes it to the browser).
 
 Apache gives a 200 status code for these requests in the access log but
 Netscape 6.2 just sits there and IE returns a 'Cannot find server...' error.
 
 Any ideas, where to start looking, etc.?
 
 --rjm--

-- 
Disclaimer: Any resemblance between the above views and
those of my employer, my terminal, or the view out my
window are purely coincidental.  Any resemblance between
the above and my own views is non-deterministic.  The
question of the existence of views in the absence of anyone
to hold them is left as an exercise for the reader. The
question of the existence of the reader is left as an
exercise for the second god coefficient.  (A discussion
of non-orthogonal, non-integral polytheism is beyond the
scope of this article.)



Re: Apache and Perl togheter

2002-01-09 Thread Jon Molin

Alan Civita wrote:
 
 Hello can some help me pelase?
 i've recently installed Apace 1.3.22...i've configured the
 CGI directive to work as well
 but when i try to execute a CGI script written in perl
 that message appears:
 
 Internal Server Error
 The server encountered an internal error or
 misconfiguration and was unable to complete your request.
 Please contact the server administrator,
 [EMAIL PROTECTED] and inform them of the time the error
 occurred, and anything you might have done that may have
 caused the error.
 More information about this error may be available in the
 server error log

have you checked the error log?

/Jon

 
 The CGI script is a stupid test  hello world CGI script
 ...
 
 Script written in sh script work.
 Can someone solve my problem please...
 Thx to all
 Alan



Re: Apache and Perl togheter

2002-01-09 Thread Jon Molin

Alan Civita wrote:
 
 is it possible that i have to do something special
 in compiling apache to activate the perl mode?

have you read at perl.apache.org? or about executing cgi's in apache?

/Jon



Re: Suggestions on an XML-RPC Service using modperl?

2002-01-02 Thread Jon Robison

As far as the cacheing goes, we have had extremely good luck with
IPC::ShareLite used to share info across mod_perl processes.

--Jon R.

Chip Turner wrote:
 
 Bruce W. Hoylman [EMAIL PROTECTED] writes:
 
  Ciao!
 
  I would like some input on an intranet web service I am currently in the
  process of designing, the core of which will be modperl on UN*X.
 
 Excellent choice.  This works quite well.  Of course, like others on
 this list, I might be a bit biased.
 
  The service itself is to access a couple of back end data stores given
  parameters received in an XML-RPC request, then return the results in an
  XML-RPC formated response.  The data from the back end sources will be
  loaded into memory at service initialization, for fast access.  The data
  is small enough and memory plentiful enough to allow this.
 
 How often does the data change?  How is it stored on the back end?
 You may not need to cache anything if, say, you have a decent SQL
 database on the backend.  Caching never hurts, but it isn't always
 necessary.  The Cache::* modules may be of use for this, though,
 should you still need it.  You also might want to consider not sharing
 the data in each process; the complexity gained vs the memory lost by
 storing it in each process may be a workable tradeoff.  I probably
 would try it first with no cache, then a per-process on-demand cache,
 then finally a shared cache, in that order.
 
  That's pretty much it in terms of the high level data flow.  It has to
  be relatively fast, OTO 5+ requests/sec. as a relative volumetric.
 
 This should be quite easy.  I don't have the necessary setup handy to
 benchmark it, but I imagine you can easily achieve performance at that
 level using Frontier::RPC inside a mod_perl handler.  We typically use
 custom code for interfacing the handler, but IIRC the Frontier module
 comes with a mod_perl handler that, if not enturely suitable, is
 easily modified to your needs.
 
  I'm going to use modperl due to the embedded perl interpreter
  characteristics it provides, allowing initialization overhead to be
  incurred at startup.  I also wish to use an in-memory, read-only hash
  structure shared across all modperl processes for access to the cached
  back end data, rather than making expensive calls to these stores for
  each request.  Again, throughput is critical.
 
 Five hits/second should be absolutely no problem.  If you expect slow
 clients, a mod_proxy in front of things (http://perl.apache.org/guide)
 can help.
 
  I would like your thoughts on the cache management concept of the
  service.  I'm looking at MLDBM::Sync as the mechanism for managing the
  filesystem representation of the in-memory hash content.  What to manage
  the in-memory structure itself in terms of accessing its content?  Is a
  Tie structure too expensive?  I want to end up with a single structure
  accessible to all of the modperl processes, loaded at service 
 
 Chip
 
 --
 Chip Turner   [EMAIL PROTECTED]
   Red Hat Network



PushHandler and Cookies

2002-01-01 Thread Jon Robison

I'm having some troubles with a system I am writing.  The system uses
the Ticket system from the Eagle book, with some minor modifications.

I have also created a logout module, which SHOULD delete the person's
cookie and redirect them to the main page (where they should be
re-directed by the Ticket system to a login screen as the cookie is
gone).

Currently, it isn't working.  I had it working (click Log Out and
you got sent to the login screen), but I noticed that the cookie wasn't
deleted, and that I could type the correct URL (non Ticket redir url)
into the browser and I was back in! This is obviously not a good thing!

I placed a bunch of print STDERR statements in it and what I see now
in the log (after editing to try and make it correctly delete the
cookie) is the logout module processes correctly, the action does get
re-set to view. . . and then it re-runs the logout module!  Maybe I'm
not using the correct Apache return name (DONE, OK, DECLINED, etc.)? or
maybe I'm just totally screwing up the cookie re-make.

Can anyone take a moment and review this code to see what this beginner
has fouled up?

Modified TicketAccess.pm:

###
package FES::Apache::TicketAccess;
use strict;
use Apache::Constants qw(:common);
use FES::Apache::TicketTool ();

sub handler {
  my $r = shift;
  my %input = $r-args; # for 
checking input items
  my $ticketTool = FES::Apache::TicketTool-new($r);
  my($result, $msg) = $ticketTool-verify_ticket($r);
  unless ($result) {
$r-log_reason($msg, $r-filename);
my $cookie = $ticketTool-make_return_address($r);
$r-err_headers_out-add('Set-Cookie' = $cookie);
return FORBIDDEN;
  }
  ## Here is where I added a push_handler insert.

  my $action = defined $input{'act'} ? $input{'act'} : 'view';

  if ($action eq 'logout')  {
$r-push_handlers('PerlHandler' = 'FES::Control::Logout');
return OK;
  } elsif ($action eq 'view') {
$r-push_handlers('PerlHandler' = 'FES::Control::View');
return OK;
  } else {
$r-push_handlers('PerlHandler' = 'FES::Control::View');
return OK;
  }
}

1;
##

And the Logout module hit by clicking a link built as 
a href=/fes?act=logoutLog Out/a


package FES::Control::Logout;
use strict;
use Apache;
use Apache::Constants qw(:common);
use CGI::Cookie;

sub handler {
  my $r = shift;
  my $q = new CGI;
  my $ticket = _get_ticket('r' = $r);
## These next two lines are to re-make the two cookies set
## by the Ticket system from the Eagle book to expiration dates
## from before today, thus deleting them (I wish!)
  my $cookie1 = new
CGI::Cookie(-name='Ticket',-value=undef, 
-expires='-100m');
  my $cookie2 = new
CGI::Cookie(-name='request_uri',-value=undef,
-expires='-100m');
  $r-header_out('Set-Cookie',[$cookie1,$cookie2]);
  $r-internal_redirect(/fes);
  return OK;
}

sub _get_ticket {
  my $args = {
'r' = undef,
@_
};
  my $r = $args-{'r'};
  my %cookies = fetch CGI::Cookie;
  my %ticket = $cookies{'Ticket'}-value;
  return \%ticket;
}

1;
##3

I have tried switching from CGI::Cookie to Apache::Cookie (and modifying
the commands to suit) - no luck.  Same thing.

Can anyone see something obvious that I am doing wrong?  I realized that
this is probably a newbie question, but I could use the help.  I have
re-written the Logout.pm a dozen times, to no avail.

--Jon Robison



Re: mod_perl vs. C for high performance Apache modules

2001-12-14 Thread C. Jon Larsen


The original poster talked about C++ CGI programs. I have been using
mod_perl since 0.7x days and I can tell you there is no way a fork+exec
CGI program no matter what language its written in will come anywhere
close to a perl handler written against the mod_perl Apache API in
execution speed (when they are doing equivalnet types of work). Using C++
to build web applications is something developers who grew up in the
heyday of client server would think is a good idea. In the internet web
applications business by the time you get a C++ program debugged and ready
to roll the market has evolved and your software is out of date.  C++ is a
good language for systems programming, databases, etc., but web apps need
shorter life cycles.

I had an investor question similar to the one we are talking about 3 years
ago. I was questioned as to why we used Apache, mod_perl, and mysql
instead of C++ and Oracle's DB and Web Devel kit. Needless to say our
mod_perl systems have thrived while most of the investor's other
investments have had their expensive hardware auctioned off on Ebay
recently.

The essence of mod_perl is that it allows to to take an idea and build a
working prototype very quickly. When you prove that the prototype works
you don't need to rewrite - mod_perl scales up better than any other web
application technology available - period.

-jon

On Fri, 14 Dec 2001 [EMAIL PROTECTED] wrote:



 -- Jeff Yoak [EMAIL PROTECTED] on 12/14/01 12:58:51 -0800

  This is something different.  The investor is in a related business, and has
  developed substantially similar software for years.  And it is really good.
  What's worse is that my normal, biggest argument isn't compelling in this
  case, that by the time this would be done in C, I'd be doing contract work on
  Mars.  The investor claims to have evaluated Perl vs. C years ago, to have
  witnessed that every single hit on the webserver under mod_perl causes a CPU
  usage spike that isn't seen with C, and that under heavy load mod_perl
  completely falls apart where C doesn't.  (This code is, of course, LONG gone
  so I can't evaluate it for whether the C was good and the Perl was screwy.)
  At any rate, because of this, he's spent years having good stuff written in
  C.  Unbeknownst to either me or my client, both this software and its
  developer were available to us, so in this case it would have been faster,
  cheaper and honestly even better, by which I mean more fully-featured.

 Constructing the $r object in perl-space is an overhead
 that mod_perl causes. This overhead has been managed more
 effectively in recent versions of perl/mod_perl. A study
 done a few years ago probably involved machines with
 significantly less core and CPU horsepower than the average
 kiddie-games PC does today. Net result is that any overhead
 caused by mod_perl in the previous study may well have been
 either mitigated with better code or obviated by faster
 hardware [how's that for a sentence?].

 Net result is that the objection is probably based on once-
 valid but now out of date analysis.

 --
 Steven Lembark  2930 W. Palmer
 Workhorse Computing  Chicago, IL 60647
+1 800 762 1582


-- 

C. Jon Larsen Chief Technology Officer, Richweb.com (804.307.6939)
SMTP: [EMAIL PROTECTED] (http://richweb.com/cjl_pgp_pub_key.txt)

Richweb.com:
Designing Open Source Internet Business Solutions since 1995
Building Safe, Secure, Reliable Cisco-Powered Networks since 1995




[OT] eval

2001-12-10 Thread Jon Molin

hi list,

I know this is OT but i don't know what list i should ask this on so i
give it a shot here. If you're very annoyed with this mail me private
with a list  should use.


I'm trying to use eval () with a constants module and it works very
funny, can anyone explain this behavior to me:

i have a module with constants (constants.pm):
##
package constants;
my %month_number = (
'Jan' = '01',
'Feb' = '02',
'Mar' = '03',
'Apr' = '04',
'May' = '05',
'Jun' = '06',
'Jul' = '07',
'Aug' = '08',
'Sep' = '09',
'Oct' = '10',
'Nov' = '11',
'Dec' = '12'
);

sub get_constant
{
my $name = shift;
my $ret = ();
 $month_number{Dec}\n; #-- ODD ROW
eval '$ret = \\%month_number';
print $_ - $ret-{$_}\n foreach (keys %{$ret}); # just to trace
print $ret=$ret-{Dec}\n;# just to trace
return $ret;
}
1;
#EOF

and a dummyscript constant.pl:

use constants;
my $bla = constants::get_constant ('%month_number');
#EOF


when i run the script with row (--- ODD ROW) it workds fine:
bash-2.04$ perl constant.pl 
Oct - 10
Dec - 12
Mar - 03
Feb - 02
Jan - 01
Nov - 11
May - 05
Aug - 08
Sep - 09
Jul - 07
Apr - 04
Jun - 06
HASH(0x80f8270)=12

but if i remove that line i get:
bash-2.04$ perl constant.pl 
HASH(0x80f8270)=


ie it doesn't seems to find the variable...This seems like vodoo to me.
Can anyone explain or point me to a place with an explanation?


/Jon



Re: Doing Authorization using mod_perl from a programmersperspective

2001-12-10 Thread Jon Robison

To insert a new comment on this old item:

What about sockets?  I am in the middle of trying to use $c =
$r-connection and $c-remote_addr as part of the cookie name.  (So far
I am having trouble with the fact that remote_addr returns packed info,
and I am still searching for how to unpack it - if you know, tell me!).

It's not 'foolproof', but how many casual cookie stealers can force
their browser to use a particular socket?

This little method would even allow me to open multiple windows into a
secured area, each with a different username, etc. (Very usefull during
user interface development, etc. where menus differ based on some
criteria for users)

--Jon Robison


David Young wrote:
 
 fliptop wrote:
  Joe Breeden wrote:
 
  How does this work in an environment with two (or more) computers with the
  exact same configuration, and probably the same HTTP_USER_AGENT behind the
  same proxy? How do you know that one user isn't using another users session?
 
  you don't.  the session hijacker still would need to know the real
  user's username, password, and HTTP_USER_AGENT configuration.
 
 The session hijacker would not need to know the username and password. They
 would only need to sniff the cookie from the network, and then send it from
 a client identifying itself as the same User Agent.
 
  my point
  was that this solves the problem of using the ip address in the md5 hash
  when the client is behind a proxy server.
 
 This does not solve the problem: IP address of users behind Proxy is not
 unique. The User Agent is not unique either. Using User Agent solves
 nothing, and is in fact far less secure, since the client can set the User
 Agent header to be just about anything. At least the IP address has to be
 correct (but not unique) if the client wants to get a response.



Re: [modperl site design challenge] please vote

2001-12-04 Thread Jon Molin

Hans Poo wrote:

[snip]
 voting at http://www.tohubohu.net/cgi/mpchallenge
[snip]
 Please, can you send the address of the three designs?

did you try clicking the links with the names?

http://domm.zsi.at/modperl-site-domm/
http://www.quantumfx.com/modperl_site/
http://www.apache.org/~stas/site/candidates/allan-juul/

/Jon



Deleting a cookie

2001-11-27 Thread Jon Robison

I have created a login system using the wonderful Ticket system from the
Eagle book.  I have modified TicketAccess so that after authentication,
it reviews the arguments in the query string and does push_handler, the
handler being chosen based on the args.

My only problem is that I want to provide the users with a logout button
which will delete the cookie from thier browser, yet I cannot find how!.
I have reviewed every module on my system with 'Cookie' in the name
(Apache::Cookie, CGI::Cookie, etc.) and nowhere does it tell how to do
this. There is a small mention of changing the expiration to  0, but
apparently I am doing it wrong (possible confusing point is the use of
an 'expires' value in the cookie itself, seperate, I think, from the
'expires' attribute on the cookie?)

I know it is a lot to ask, but I am relatively new to this part of
mod_perl (pushing handlers, etc.), so if anyone can look at this and
replace my BLOCKED comments with a couple of helpfull lines, I would
greatly appreciate it! 

Thanks in advance - 

Jonathon Robison


Below is my modified TicketAccess, as well as the Logout module I am
re-directing to for logout action:
=
package FES::Apache::TicketAccess;

use strict;
use Apache::Constants qw(:common);
use FES::Apache::TicketTool ();

sub handler {
my $r = shift;
my %input = $r-args;  
 # for checking input items
my $ticketTool = FES::Apache::TicketTool-new($r);
my($result, $msg) = $ticketTool-verify_ticket($r);
unless ($result) {
$r-log_reason($msg, $r-filename);
my $cookie = $ticketTool-make_return_address($r);
$r-err_headers_out-add('Set-Cookie' = $cookie);
return FORBIDDEN;
}
## Here is where we need to insert a push_handler insert. I won't need
## the requested uri from the $r, since the $r goes along for the ride
in## push_handler

my $action = defined $input{'act'} ? $input{'act'} : 'view';

print STDERR action is defined as $action\n;  ## DEBUGGING

if ($action eq 'logout')  {
$r-push_handlers('PerlHandler' = 'FES::Control::Logout');
return OK;
} elsif ($action eq 'view') {
$r-push_handlers('PerlHandler' = 'FES::Control::View');
return OK;
}   else {
$r-push_handlers('PerlHandler' = 'FES::Control::View');
return OK;
}
   ## ARE THOSE THE CORRECT THINGS TO 'RETURN' FOR THESE CASES?
 
}

1;
==

And the Logout.pm:

=
package FES::Control::Logout;

use strict;
use Apache;
use Apache::Constants qw(:common);
use FES::Common::Common qw( header footer);
use CGI qw/:standard/;
use CGI::Cookie;

sub handler {
my $r = shift;
my $q = new CGI;
my $ticket = _get_ticket('r' = $r);

## HERE IS WHERE I NEED TO 1.) DELETE USER'S TICKET COOKIE AND
## 2.) REDIRECT THEM TO /FES (w/o bringing old
$r),(WHERE THEY SHOULD GET
## A NEW LOGIN SCREEN BECAUSE COOKIE IS
GONE.)

}

sub _get_ticket {
my $args = {
'r' = undef,
@_
};
my $r = $args-{'r'};
my %cookies = CGI::Cookie-parse($r-header_in('Cookie'));
# TESTING
my %ticket = $cookies{'Ticket'}-value;  # TESTING
return \%ticket;
}

1;
=



Re: Doing Authorization using mod_perl from a programmers perspective

2001-11-19 Thread Jon Robison

Randall, you want to expound upon that?

--Jon Robison

Randal L. Schwartz wrote:
 
  fliptop == fliptop  [EMAIL PROTECTED] writes:
 
 fliptop i have found that using the HTTP_USER_AGENT environment
 fliptop variable instead of ip address solves the problem with proxy
 fliptop servers and the md5 hash.  anyone ever tried this as a simple
 fliptop workaround?
 
 Nobody with any sense.  It's flawed.
 
 --
 Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
 See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Doing Authorization using mod_perl from a programmers perspective

2001-11-19 Thread Jon Robison

How about using an Apache::Sessions id instead of IP address?

--Jon Robison

Randal L. Schwartz wrote:
 
  fliptop == fliptop  [EMAIL PROTECTED] writes:
 
 fliptop i have found that using the HTTP_USER_AGENT environment
 fliptop variable instead of ip address solves the problem with proxy
 fliptop servers and the md5 hash.  anyone ever tried this as a simple
 fliptop workaround?
 
 Nobody with any sense.  It's flawed.
 
 --
 Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
 Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
 See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



Re: Doing Authorization using mod_perl from a programmers perspective

2001-11-16 Thread Jon Robison

fliptop wrote:
 
 Jon Robison wrote:
 
  The most relevant section for you is the Ticket system he describes. (I
  believe the section header says something about Cookies, but you'll know
  you have the right one when you see TicketAccess.pm, TicketTools.pm, and
  TicketMaster.pm. One nice addition is the ability to add encryption to
  the Ticket, and the fact that the author used an MD5 hash (of an MD5
  hash!) in the cookie, so verification of the authenticity of the user is
  pretty solid so long as you leave in things like ip address, etc. which
  he uses in the cookie by default. (Although AOL and some proxy systems
  might cause this to be trouble).  AND, he also uses a mysql db for the
 
 i have found that using the HTTP_USER_AGENT environment variable instead
 of ip address solves the problem with proxy servers and the md5 hash.
 anyone ever tried this as a simple workaround?

I think one problem with that is that is fails to uniquely identify the
person.

Someone please tell me if I am wrong - does the USER_AGENT field get
some kind of special serial number from the browser, or is it just a
version identified?

Best example - large company with 1000 PC's, all with same Netscape
installed.  How then does the HTTP_USER_AGENT field deliniate between
PC's?

--Jon



Re: Doing Authorization using mod_perl from a programmers perspective

2001-11-15 Thread Jon Robison

Jonathon,

I am doing exactly this also.  What works is this:

Get a copy of Writing Apache modules with perl and C and read it.

The most relevant section for you is the Ticket system he describes. (I
believe the section header says something about Cookies, but you'll know
you have the right one when you see TicketAccess.pm, TicketTools.pm, and
TicketMaster.pm. One nice addition is the ability to add encryption to
the Ticket, and the fact that the author used an MD5 hash (of an MD5
hash!) in the cookie, so verification of the authenticity of the user is
pretty solid so long as you leave in things like ip address, etc. which
he uses in the cookie by default. (Although AOL and some proxy systems
might cause this to be trouble).  AND, he also uses a mysql db for the
passwords, etc.  All in all, a VERY usefull section of the book.

As for pushing content after authorization, take a very close look at
the $r-push_handler() function.  I use it like this:

my $input = $r-args (or however you want to get input - Apache::Request
is a good way)
if (defined $input-{some_param}) {
  $r-push_handler( PerlHandler = MyActionModule );
} else {
  $r-push_handler(PerlHandler = MyErrorModule );
}

Because the request object (usually $r) exists in it's same state when
the new PerlHandler is called, grabbing $input again (via whatever
method) can be used to determine what action the module takes.

This isn't precise, so please read the manual before using this, but you
get the idea.  One thing to keep in mind is that perl_handlers
(PerlHandler) is a stack that will draw from the top, so it is FILO, not
FIFO.

Hope this helps.

Jonathon Robison
Uniphied Thought, LLC.


Jonathan E. Paton wrote:
 
 I am trying to create a website with predominantly dynamic
 content (mod_perl + DBI + mySQL) for an online community.
 I can manage Perl and mySQL fairly proficently, however
 I've no idea how to successfully create what I want using
 mod_perl and Apache (actually, I know next to nothing about
 them).
 
 --- Background information ---
 
 The website shall be split into a public and private
 section, and will share a common layout and appearance
 (although I might add little visual clues to indicate which
 section they are in).  When members wish to login I want
 them to do so via the public section (from that page), and
 then be able to access the additional links/features of the
 private section.
 
 I wish to handle all the database actions in my own code,
 unless something fits perfectly.  When members try to
 login, my aims are:
 
 1. Check login name, and password.
 2. Check member hasn't been suspended.
 3. Return the membership ID number for the next stage.
 
 The membership ID number will be used to decide what access
 level the members have (what forums, tools etc they can see
 and use).  The SQL table is specified as:
 
 CREATE TABLE access (
   member_id int(10) unsigned NOT NULL,
   account_name varchar(16) NOT NULL,
   account_password varchar(16) NOT NULL,
   state enum('A', 'S') DEFAULT 'A' NOT NULL,
 
 PRIMARY KEY (account_name)
 );
 
 Imagine I now create an object to wrap around this, with
 the following method:
 
 my $permission =  $access-check($account_name,
 $account_password);
 
 which returns the membership number if valid,
 or the value -1 for a suspended account,
 or undef for no account.
 
 --- Questions ---
 
 1. Can this be done (nicely) as a
 authentication/authorization handlier?
 
 2. Do most hosting companies allow
 authentication/authorization handlers?  (Using HostRocket
 at the moment).
 
 3. What is the most appropriate session management system?
 I'm thinking of using cookies (client side) to store a
 session key, rather than resubmitting the password data.
 The server side stores this session key in the database.
 
 4. How does the membership ID get passed to the next stage?
 
 5. What is the time to do additional access checking (for
 senior/admin users)?  I was planning to do it a little
 later on, but it is probably better to do it once (i.e.
 with this).
 
 6. What is a realistic time to expect all this to happen
 in?
 
 I'm sure I've missed a few questions...
 
 Any help appriecated, especially links to relevent
 documentation.
 
 Jonathan Paton
 
 NB - Whilst my preferred answer to these questions is a
 coded solution, I have a restriction (self imposed) - I'd
 prefer to have full copyright on the final code, thus I ask
 any major ideas/code includes permission to use it freely -
 or else be good enough to be worth adding your name provide
 I use it :)
 
 __
 Do You Yahoo!?
 Everything you'll ever need on one web page from News and Sport to Email and Music 
Charts
 http://uk.my.yahoo.com



Silly Newbie Question: cookies and such

2001-11-12 Thread Jon Robison

Unfortunatly, I find myself with a silly newbie question:

I need to make an Apache module (not a Registry script) which will:

1. Check for a cookie, and if not there, pushhandler to a module for
logging in (keeping the original request at hand for use after they
succeed in logging in).
2. Extract data from the cookie (encrypted for security?)
3. Based on data from both the query string ($r-args?) and from data in
the cookie, pushhandler to another module.

I have looked at Apache::AuthCookie - it didn't seem to make much sense
to me.  Apache::Session looks promising, but the instructions don't say
how to set up the mysql tables, etc. My worst problem is that I haven't
had occasion to deal with cookies much (setting, checking,etc.) in the
past and I know this is hampering my understanding.

Can anyone give me a general overview (use this module, this way, etc.)?

I'm not totally new to Apache Modules, but my experience is gleaned from
writing modules already pushed into the handler stack by
PerlTransHandlers written by someone else. I don't want to use
PerlTransHandler, just PerlHandler, so I can use Location in
perl.conf.

In conclusion: I'm making a system/site where no .html files even exist.
I need to handle security via a mysql db, and to push handlers based on
a part of the url and a piece of the cookie which identifies the user as
either a teacher, student, or parent (oops... I gave it away ;-)

Jonathon Robison



Re: [JOB] Red Hat Network Web Engineer positions open

2001-11-08 Thread Jon Robison

Jiminy Crickets Chip!  Yer makin me drool!

If it weren't for the Move to NC part, I'd be doing my best to be your
new closest buddy ;-)

--Jon Robison
Uniphied Thought, LLC
Dearborn, MI

Chip Turner wrote:
 
 Hello all,
 
 We have a couple openings doing intense and interesting mod_perl work
 here at Red Hat.  Formal description is below.  Key skills are perl,
 mod_perl, apache, and DBI (especially Oracle).  Must relocate to
 Research Triangle Park, North Carolina.
 
 Job Title: Web Engineer
 
 Red Hat is looking for some skilled web engineers to design, enhance,
 and implement applications on the Red Hat web site.  You will work on
 a global team to create a best-of-breed web site and implement web
 services that support Red Hat's Open Source products and services.
 
 The ideal candidate will have the following characteristics:
 
   1. Ability to learn.  Candidate must show they can adapt to the rapidly
  changing technology landscape.
 
   2. Ability to communicate.  Candidate must show that they can express
  ideas with elegance and flair.
 
   3. Mature technical ability.  Candidate must understand how the web
  works from a low to a high level.  Candidate must also understand
  how quality software is designed and constructed.  We want you
  to think as much as you code.
 
 Other required skills:
 
Four year degree or equivalent industry experience.
 
Previous experience developing web applications,
preferably for a high volume revenue based web site.
 
Understanding and experience with object-oriented design and coding.
 
Experience using Perl with Apache, preferably mod_perl directly.
 
Understanding of relational database concepts and SQL (prefer
Oracle)
 
Experience with HTML and HTML tools, as well as XML and XHTML.
 
Knowledge of basic Software Engineering concepts: development models,
testing, documentation, and revision control.
 
 Pluses:
 
Knowledge of Red Hat's products and services.
 
Understanding of Apache 1.3.x configuration.  Knowledge
of Apache internals and C module development also a plus.
 
Expert Perl programming experience including:
  Perl web applications under Apache and mod_perl,
  Apache modules, Perl modules, Perl OOP extensions.
 
Languages: Java, Javascript, Python, PHP, C, C++
 
Web Technology: XML, XSLT and XML-RPC; Internationalization;
  Applications Servers (HTML::Mason, Embperl, Apache::ASP, Zope,
  Zentropa, AxKit, Cocoon etc.); Search systems and concepts;
  cookies and authentication mechanisms
 
Oracle database and Oracle Applications (ERP, CRM) Experience.
 
 --
 Chip Turner   [EMAIL PROTECTED]
   Red Hat Network



Re: [OT] FW: OWASP Update

2001-10-29 Thread Jon Molin

only me that get 404 Not Found ? 
both on http://www.owasp.org/projects/cov/index.htm and
http://www.owasp.org

is this the beginning of a new word? the site has been modperled :)

/jon



Matt Sergeant wrote:
 
 Not sure if this should really be considered off topic, as it should be
 required reading. Anyway, go to owasp *now*, and read all the COV's you can
 get through. These should be required knowledge for any web developer, and
 the site seems to have detailed the various possible vulnerabilities really
 well.
 
 http://www.owasp.org/projects/cov/index.htm
 
 (and no, I'm not affiliated in any way - just excited to see all this stuff
 explicitly detailed so succinctly).

 snip



Re: @INC

2001-10-23 Thread Jon Robison

Plows, Sean (London) wrote:
 
 How can I set this as my cgi's can't locate my libs?
 
  Regards,
 
  Sean Plows

Sean - try use lib '/path/to/my/libs';  That should append your
library path to @INC.

Word on the street is that you NEVER EVER want to mess with @INC
directly.

Jon Robison
!Uniphied Thought, LLC



Re: Touble getting apache going...

2001-09-11 Thread Jon Molin

Tim J Spriggs wrote:
 
 I am running Debian Linux(Woody) and installed apache-perl and all of the
 supporting libraries. Whenever Apache is run I get the error message:
 
 ---
 [Mon Sep 10 16:50:03 2001] [error] Can't locate Apache.pm in @INC (@INC
 contains: /usr/local/lib/perl/5.6.1 /usr/local/share/perl/5.6.1
 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.6.1 /usr/share/perl/5.6.1
 /usr/local/lib/site_perl /usr/lib/perl5/5.6 /usr/lib/perl5/5.005 .
 /etc/apache/ /etc/apache/lib/perl) at (eval 1) line 3.
 ---
 
 If I goto the /usr/share/perl/5.6.1/CGI where Apache.pm is located and
 try to start apache it simply says apache cannot be started and in the
 logfile it says:

might not be this but shouldn't you have '/usr/share/perl/5.6.1/CGI' in
your @INC to? 

 
 ---
 Apache.pm failed to load!.
 ---
 
 Thank you in advance for any help given.
 
 -Tim([EMAIL PROTECTED])



tracing memory problem

2001-09-07 Thread Jon Molin

Hi list,

I have a memory leak in a script or module, the problem is that i've
resently added many scripts and modules and can't easily isolate the
problem. Is there a way besides strace to see what the httpd process is
up to?
 9869 httpd  0   0 21188  19M  2424 S   0 12.2  3.8   0:13 httpd
doesn't help me too much...

/Jon



Re: tracing memory problem

2001-09-07 Thread Jon Molin

Stas Bekman wrote:
 
 On Fri, 7 Sep 2001, Jon Molin wrote:
 
  Hi list,
 
  I have a memory leak in a script or module, the problem is that i've
  resently added many scripts and modules and can't easily isolate the
  problem. Is there a way besides strace to see what the httpd process is
  up to?
   9869 httpd  0   0 21188  19M  2424 S   0 12.2  3.8   0:13 httpd
  doesn't help me too much...
 
 Please explain what do you mean by 'what the httpd process is up to'?
 

sorry, what i meant was what script was accessed by the httpd process.
That's the first problem, locating what set of scripts(modules) it can
be and after that start looking...


 It's not an easy task to find the offending code that causes memory leaks.
 Using GTop.pm for easier memory debugging printing helps a lot,
 Devel::Peek is useful too, try also Devel::Leak and their Apache::
 friends: Apache::Peek and Apache::Leak. You can find some notes on using
 these in the mod_perl guide. Apache::VMonitor can be very useful too.
 
 Otherwise you will probably have to play the halving game: remove half of
 your modules/scripts and test. If nothing comes up return a half  of the
 removed half, and so on. It's not always working like that, since some
 code may leak when it interacts with some specific code.
 
 In the meantime, use Apache::SizeLimit to prevent the processes from
 growing. See the guide or the manpage for the details.

ok, i'll look into that. I've been using RLimitMEM and RLimitCPU in
httpd.conf:
RLimitMEM 15728640  15728640 
RLimitCPU 600   600
and haven't got them to work very good:
10314 httpd 13   0 67824  66M  5572 R   0 17.9 13.1   4:19 httpd
10313 httpd 13   0 69984  68M  5580 R   0 17.7 13.5   4:33 httpd

but i guess that's fairly OT on the mod_perl list. 

Thanks for the quick reply!
/Jon

 _
 Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
 http://stason.org/   mod_perl Guide  http://perl.apache.org/guide
 mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
 http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



Re: Apache::Request cookie handling methods?

2001-09-03 Thread Jon Nangle

 princepawn == princepawn  [EMAIL PROTECTED] writes:

princepawn Could someone point me to the documentation for
princepawn apache-based cookie handling?

perldoc Apache::Cookie

Jon



Re: using mod_perl

2001-08-24 Thread Jon Molin

try looking at
http://perl.apache.org/

/jon

[EMAIL PROTECTED] wrote:
 
 Hi! I am wondering if anyone could tell me how to actually run
 modperl on my webserver i have perl modules installed to run without
 modperl and dont know how to invoke the process to get them working
 can anyone help?
 jason



perlmagick and leaking memory

2001-08-21 Thread Jon Molin

Hi list,

I've done a scripts that builds an calender and colours the days with
different colours depending on the status of the day. I've got 6 colours
and one to just fill out so the month starts with the correct day, ie
i've got 6 * 31 + 1 = 187 images and each is about 70 bytes so a
calender is 6 times 7 of these little sqaures, about 3k. 

Now this little script handling this tiny amount of data runs amok and
grows and grows untill i restart apache brutaly, I guess I've done
something very wrong but I can't figure out what, nor can I find any
info about this. Here's what the program looks like:


my $image_obj = Image::Magick-new;
my $images = $image_obj-Read (@days); # an array with 49 filnames
my $montage = $image_obj-Montage (
   mode = 'Concatenate',
   background ='#ff',
   tile = '7x7',
   frame = '1x1',
   gravity = 'center',
   );

$montage-Crop ('138x118'); #fixing the size

print Content-Type: image/gif\n\n ;
$montage-Write();# the image doesn't come out out unless i use Write
before
print $montage-ImageToBlob();

undef $montage;
undef $images;
undef $image_obj;


Anyone see any obvious mistakes?

I also tried putting this before the undef's but it didn't do any
difference:
for (my $i = 0; $i = 48; $i++)
{
undef $image_obj-[$i];
}

/Jon



RE: Problem with ASP Pages

2001-04-17 Thread Bridges, Jon

"Bridges, Jon" wrote:
 
 I'm working on Windows 2000 and have finally managed to get the mod_perl
and
 Apache::ASP extensions working. I can confirm this as when I open up .htm
 files with embedded asp everything works fine.
 
 However I come across a problem when trying to view .asp files as my web
 browser IE5.5 will try and download them.
 
 Has anyone got any ideas on why this is happening


Are you sure the .asp files are being executed?

If they are, then they send a Content-Type: text/html header
by default, so IE 5.5 should handle it.  Did you 
get the examples to work in the ./site/eg directory?
They have .asp files there.

You can see the headers that are being sent by 

  lwp-request -ed $URL

if content-type is being set and IE still doesn't get it,
I'm not sure what to say? 

--Josh

I have figured out why the .asp files were being downloaded instead of
executed. This was because I had not declared .asp in the mime.types file.
I couldn't do the lwp-request as I am running Apache on Windows 2000, is
this a Linux command?

Now all that happening is an error in the error log saying 
"No such file or directory: couldn't spawn child process"

I think this is due to a directory setting in the asp file.  If anyone knows
of any other problems that can cause this can you let me know

Thanks guys

Jonathan Bridges



Problem with ASP Pages

2001-04-12 Thread Bridges, Jon

I'm working on Windows 2000 and have finally managed to get the mod_perl and
Apache::ASP extensions working. I can confirm this as when I open up .htm
files with embedded asp everything works fine.

However I come across a problem when trying to view .asp files as my web
browser IE5.5 will try and download them.

Has anyone got any ideas on why this is happening

Thanks

Jon



Sr software engineer positions at AvantGo

2001-02-07 Thread Jon Swartz
Title: Sr software engineer positions at AvantGo





The mobile internet team at AvantGo is looking for excellent web engineers!


Located in San Mateo, AvantGo develops software to deliver internet/intranet content to handheld devices and cell phones. We mantain the fun, casual and intellectual environment of a small company, while striving to grow aggressively in our space.

The mobile internet team is responsible for technologies underlying AvantGo's web site, internet sync service, and the handheld user interface. We develop web applications with Perl, Apache, mod_perl, Mason, and mysql. We also develop our highly-tuned server infrastructure in C. Generally engineers get the choice of which kind of work they'd like to do, with FreeBSD Unix as a common platform.

Requirements: strong software development skills, experience with Unix and web technologies. Plusses include experience with C and/or Perl, Apache, SQL, and a computer science or equivalent degree.

All positions are full-time and on-site. Occasional work-at-home may be negotiated.


Send your resume to [EMAIL PROTECTED] or [EMAIL PROTECTED] if interested.


Cheers
Jon





Re: can't flush buffers?

2000-12-23 Thread C. Jon Larsen


 
   I posted something like this a week ago, but typos in my message kept
 anyone from understanding the issue.
 
   I am trying to return each row to the client as it comes from the
 database, instead of waiting for all the rows to be returned before
 displaying them.  

Why would you want to do this ?

Writing your application this way will ensure that:

a. end users can crash your server/application.
b. your application will preform poorly on the network.

Buffer your output, and when all the output is collected, print it, and
let tcp deliver the data in network-friendly chunks. If your database is
that slow that you think you need an approach like this, investigate the
possibility of a caching server process that you can sit in front of the
actual db. 

You need to consider what happens when a user executes a query that can
return more rows that a browser can reasonably display. In other words,
having a query results pagination module or feature is probably a must.

If you were writing a stand-alone application that ran on a single cpu
(like MS Access on a local file) in  this style (no pagination, no
buffering) I would consider this to be marginally bad style. Inside a
web-based application, this approach is horrendous.

Just my 2 cents . . .

On Sat, 23 Dec 2000, quagly wrote:

 
   I have set $|=1 and added $r-flush; after every print statement ( I
 realize this is redundant ) but to no avail.  
 
 This is the relevant code:
 
 while ($sth-fetch) {
$r-print ("TR",
map("TD$_/TD",@cols),
"/TR");
   $r-rflush;
 }
 
 Here is the complete package:
 
 package Sql::Client;
 
 use Apache::Request;
 use strict;
 use warnings;
 use Apache::Constants qw(:common);
 
 my $r;  #request
 my $apr;   #Apache::Request 
 my $host;  #hostname of remote user
 my $sql;#sql to execute
 
 $|=1;
 
 sub getarray ($) { 
 
 my $dbh;  # Database handle
 my $sth;# Statement handle
 my $p_sql; # sql statement passed as parameter
 my @cols;  #column array to bind results
 my $titles;   # array ref to column headers
 
 $p_sql = shift;
 
 # Connect
 $dbh = DBI-connect (
 "DBI:mysql:links_db::localhost",
 "nobody",
 "somebody",
 {
 PrintError = 1,# warn() on errors
 RaiseError = 0,   # don't die on error
 AutoCommit = 1,# commit executes
 immediately
 }
 );
 
 # prepare statment
 $sth = $dbh-prepare($p_sql);
 
 $sth-execute;
 
 $titles = $sth-{NAME_uc};
 #--
 # for minimal memory use, do it this way
 @cols[0..$#$titles] = ();
 $sth-bind_columns(\(@cols));
 $r-print( "TABLE BORDER");
 $r-print ("TR",
 map("TD$_/TD",@$titles),
 "/TR");
 while ($sth-fetch) {
 $r-print ("TR",
 map("TD$_/TD",@cols),
 "/TR");
 $r-rflush;
 }
 $r-print ("/TABLE");
 return; 
 }
 
 
 sub handler {
 $r = shift;
 $apr =  Apache::Request-new($r);
 $sql = $apr-param('sql') || 'SELECT';
 $sql='SELECT' if  $apr-param('reset');
 
 $r-content_type( 'text/html' );
 $r-send_http_header;
 return OK if $r-header_only;
 $host = $r-get_remote_host;
 $r-print(HTMLEND);
 HTML
 HEAD
 LINK REL="stylesheet" TYPE="text/css" 
 HREF="/styles/lightstyle.css" 
 
 TITLEHello $host/TITLE
 BODY
 H1Sql Client/H1
 FORM METHOD="POST"
 PEnter your Select Statement:
 BR
 TEXTAREA  NAME="sql" ROWS=8 COLS=60 WRAP$sql/TEXTAREA
 BR
 INPUT TYPE="SUBMIT" VALUE="Submit"
 INPUT TYPE="SUBMIT" NAME="reset" VALUE="Reset"
 /FORM
 HTMLEND
 $r-rflush;
 getarray($sql) unless $sql =~ /^SELECT$/;
 
 $r-print(HTMLEND);
 /BODY
 /HTML
 HTMLEND
 return OK;
 }
 1;
 




Apache::DBI

2000-11-13 Thread Jon Molin

I'm considering using Apache::DBI but before I'd want to benchmark to
see
if I gain anything. To do this I just made a script that
connects/disconnects
10 times. Then I tried running ab with -n 1. The output confused me
a bit
there where only 0.9 secs difference, and it was good old DBI who won,
without
Apache::DBI. 
Am I doing something wrong? I've added 'PerlModule Apache::DBI' in
httpd.conf and as I could understand it wasn't it nessicery to add
anything else...

/Jon



Re: Forking in mod_perl?

2000-10-04 Thread C. Jon Larsen


I use a database table for the queue. No file locking issues, atomic
transactions, you can sort and order the jobs, etc . . . you can wrap the
entire "queue" library in a module. Plus, the background script that
processes the queue can easily run with higher permissions, and you don't
have to worry as much with setuid issues when forking from a parent
process (like your apache) running as a user with less priviledges than
what you (may) need. You can pass all the args you need to via a column in
the db, and, if passing data back and forth is a must, serialize your data
using Storable and have the queue runner thaw it back out. Very simple,
very fast, very powerful.

On Wed, 4 Oct 2000, Neil Conway wrote:

 On Wed, Oct 04, 2000 at 02:42:50PM -0700, David E. Wheeler wrote:
  Yeah, I was thinking something along these lines. Don't know if I need
  something as complex as IPC. I was thinking of perhaps a second Apache
  server set up just to handle long-term processing. Then the first server
  could send a request to the second with the commands it needs to execute
  in a header. The second server processes those commands independantly of
  the first server, which then returns data to the browser.
 
 In a pinch, I'd just use something like a 'queue' directory. In other
 words, when your mod_perl code gets some info to process, it writes
 this into a file in a certain directory (name it with a timestamp /
 cksum to ensure the filename is unique). Every X seconds, have a
 daemon poll the directory; if it finds a file, it processes it.
 If not, it goes back to sleep for X seconds. I guess it's poor
 man's IPC. But it runs over NFS nicely, it's *very* simple, it's
 portable, and I've never needed anything more complex. You also
 don't need to fork the daemon or startup a new script every
 processing request. But if you need to do the processing in realtime,
 waiting up to X seconds for the results might be unacceptable.
 
 How does this sound?
 
 HTH,
 
 Neil
 
 -- 
 Neil Conway [EMAIL PROTECTED]
 Get my GnuPG key from: http://klamath.dyndns.org/mykey.asc
 Encrypted mail welcomed
 
 It is dangerous to be right when the government is wrong.
 -- Voltaire
 







Re: reloading PerlHandlers

2000-08-11 Thread Jon Nangle

In-Reply-To: 2810230556.A628@isis
 But, when I tweak the code of a module I have to do an apachectl
 graceful or something, very annoying.

perldoc Apache::StatINC and read the guide:

   http://perl.apache.org/guide/

Jon




Re: [OT] Anyone know a good perl mailing list?

2000-07-19 Thread Jon Wyatt

Paul wrote:
 
 --- David Hodgkinson [EMAIL PROTECTED] wrote:
 
  kevin [EMAIL PROTECTED] writes:
 
   Hello,
  
   Whilst I am subscribed to modperl mailing list does
   anyone know a good general perl mailing list
  
   preferably from perl.org or .com
  
   I tried subscribing to a few but links where outdated.
 
  This is what the comp.lang.perl* Usenet newsgroups are there for.
 
 True enough, but I can't read newsgroups through our company firewall.
 Email I can get.
 
 Is there *not* a list? ~sigh~
 

Could you not use deja or Remarq.

Alternatively, for a small fee (per message) I will email you each and
every message on your required NG and will mail any of your replies
under the pseudonym 'Arthur Drainpipe'.

Jon.



Re: HTML::Mason - declaration of subs outside out %ONCE sections?

2000-07-06 Thread Jon Nangle

In-Reply-To: [EMAIL PROTECTED]
nchen.d
 Is there any harm in defining subroutines inside regular %PERL sections?

You can do it if you want to, but it is a bad idea because
once Mason has worked its magic, your sub will end up inside
another sub. This is not usually a problem, but if you
reference a variable inside your subroutine that was defined
outside it, you'll get a "variable will not stay shared" error
message. See the mod_perl guide for more information on this
issue.

If you understand the problem, you can work around it (by using
a closure or by passing and returning values properly), but it's
better to avoid the problem altogether and define your subs in the 
%once section. Better still, consider making your subroutine
a separate component or subcomponent.

By the way, there is a dedicated mailing list for Mason at:

  http://netizen.com.au/mailman/listinfo/mason

Jon




Re: How to configure Apache to make work CGI ???

2000-07-05 Thread Jon Wyatt


- Original Message -
From: "Alexandru Boboc" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 05, 2000 12:19 PM
Subject: How to configure Apache to make work CGI ???


Wrong forum really, I think you need the apache specific forum.

But.

Sounds like you need to ensure your localhost network is set up correctly
first (i.e., get to the point where you can ping localhost)
Then you need to ensure apache is configured so you can access html pages on
your local machine. This may require some browser configuration too)
Then you need to configure apache to allow execution of cgi scripts.

If you already have achieved some of these then you need to be more specific
about what isn't happening and what error messages you are getting.

Jon.




Re: Virtual Hosts and POST

2000-07-03 Thread Jon Wyatt

Jay J wrote:
 
 Jon Wyatt wrote:
 
  
   [EMAIL PROTECTED] wrote:
   
Simple first stage question:-
   
Your not using mod_rewrite at all (it took me 6 hours to work out that that 
was causing the same problem for me).
   
  
   I wasn't but I am now and it's made no difference.
  
 
  I'm going to change my mind now. I'm still not using it.
 
  To use that mod surely I need to do the following:-
 
  Edit Configure to enable the mod_rewrite
  perl Makefile.PL .{with everything enabled}
  make  make install
  cd apache dir
  make install
 
  The mod is now statically linked in, right?
 
  Or am I completely wrong?
 
  Jon.
 
 --enable-module=rewrite
 
 FYI, unless you have 'RewriteEngine on' and rules/etc .. this really
 shouldn't interfere.
 

This was the problem. The mod wasn't enabled but the rule was in there.
I'm still having problems enabling the mod which is a bit worrying but
that's a different story, I may ask for assistance later.

Thanks both for your help.

Jon.



Virtual Hosts and POST

2000-06-30 Thread Jon Wyatt

I've just installed mod_perl (of which I have no previous experience) on
my server and configured it apparently correctly for a single site
server. The site runs scripts quite happily, notably POST methods are
accepted.

Then I start setting up virtual hosts, post requests are no accepted on
these hosts.
What directives do I need? I appreciate this might look like an apache
problem but I'm using the pre-mod_perl config file and the only thing
that has changed is the mod_perl addition.

An example virtual host config looks like:-

VirtualHost 192.xx.xx.xx
Options ExecCGI Includes
DocumentRoot /home/billy
ServerAdmin billy@billy
ServerName www.billy.com
Alias /perl/ /home/billy/cgi-bin/
Alias /cgi-bin/ /home/billy/cgi-bin/   
/VirtualHost

And the relevant section in my mod_perl.conf looks like

Location /perl
SetHandler perl-script
PerlHandler Apache::Registry
Options ExecCGI
all from all
PerlSendHeader On
/Location

Jon.



Re: Virtual Hosts and POST

2000-06-30 Thread Jon Wyatt

[EMAIL PROTECTED] wrote:
 
 Simple first stage question:-
 
 Your not using mod_rewrite at all (it took me 6 hours to work out that that was 
causing the same problem for me).
 

I wasn't but I am now and it's made no difference.

Next ;-)

Jon.



Re: Virtual Hosts and POST

2000-06-30 Thread Jon Wyatt

Jon Wyatt wrote:
 
 [EMAIL PROTECTED] wrote:
 
  Simple first stage question:-
 
  Your not using mod_rewrite at all (it took me 6 hours to work out that that was 
causing the same problem for me).
 
 
 I wasn't but I am now and it's made no difference.
 

I'm going to change my mind now. I'm still not using it.

To use that mod surely I need to do the following:-

Edit Configure to enable the mod_rewrite
perl Makefile.PL .{with everything enabled}
make  make install
cd apache dir
make install

The mod is now statically linked in, right?

Or am I completely wrong?

Jon.



Re: unsubscribe instructions

2000-05-23 Thread Jon Wasserman

Yeah!!! ME TOO. How the heck do I unsubscribe. The e-mail is increasing 
exponentially.


From: "Fabio Arciniegas A." [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: unsubscribe instructions
Date: Tue, 23 May 2000 09:46:53 -0400

Hello,
I'm sorry to send administrative questions to the list, but could you 
please
include at the end of the messages the addresses for tasks such as
unsubscribing?  (or at least send me a private email with them? :) )

Thank you,
   Fabio

Fabio Arciniegas A.   [EMAIL PROTECTED]
Viaduct Technologies, Inc.Software Engineer
http://www.thefaactory.com(301) 6563002x125
  "The world is all that is the case" - Wittgenstein

~-Original Message-
~From: [EMAIL PROTECTED]
~[mailto:[EMAIL PROTECTED]]On Behalf Of
~Autarch
~Sent: Tuesday, May 23, 2000 1:56 AM
~To: Marc Lehmann
~Cc: [EMAIL PROTECTED]
~Subject: Re: global variables and reparsing question (low priority ;)
~
~
~On Tue, 23 May 2000, Marc Lehmann wrote:
~
~ stable (mod_perl really is very unstable for large applications). Apart
~
~Wow, I wish you'd warned me before I did several large applications using
~mod_perl.  Fortunately, they haven't experienced any mod_perl related
~problems.  Just a fluke, I guess.
~
~Anyway...
~
~-dave
~
~/*==
~www.urth.org
~We await the New Sun
~==*/
~
~
 FabioArciniegasA..vcf 


Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com




Re: [RFC] Do Not Run Everything on One mod_perl Server

2000-04-19 Thread C. Jon Larsen


My apache processes are typically 18MB-20MB in size, with all but 500K to
1MB of that shared. We restart our servers in the middle of the nite as
part of planned maintenance, of course, but even before we did that,
and even after weeks of uptime, the percentages did not change.

We do not use Apache::Registry at all; everything is a pure handler. We
cache all data structures (lots of storable things) in the parent process
by thawing refs to the datastructures into package variables. We use no
globals, only a few package variables (4) that we access by fully
qualified package name, and they get reset on each request. 

We use Apache::DBI and MySQL, and it works perfectly other than a few
segfaults that occur once in a while. Having all of the data structures
cached (and shared !) allows us to do some neat things without having to
rely solely on sql.

On Thu, 20 Apr 2000, Stas Bekman wrote:

 On Wed, 19 Apr 2000, Joshua Chamas wrote:
 
  Stas Bekman wrote:
   
   Geez, I always forget something :(
   
   You are right. I forgot to mention that this was a scenario for the 23 Mb
   of unshared memory. I just wanted to give an example. Still somehow I'm
   almost sure that there are servers where even with sharing in place, the
   hypothetical scenario I've presented is quite possible.
   
   Anyway, it's just another patent for squeezing some more juice from your
   hardware without upgrading it.
   
  
  Your scenario would be more believable with 5M unshared, even
  after doing ones best to share everything.  This is pretty typical
  when connecting to databases, as the database connections cannot
  be shared, and especially DB's like Oracle take lots of RAM
  per connection.
 
 Good idea. 5MB sounds closer to the real case than 10Mb. I'll make the
 correction. Thanks!!! 
 
  I'm not sure that your scenario is worthwhile if someone does
  a good job preloading / sharing code across the forks, and 
  the difference will really be how much of the code gets dirty
  while you run things, which can be neatly tuned with MaxRequests.
 
 Agree. But not everybody knows to do that well. So the presented idea
 might still find a good use at some web shops.
 
  Interesting  novel approach though.  I would bet that if people
  went down this path, they would really end up on different machines
  per web application, or even different web clusters per application ;)
 
 :)
 
 
 __
 Stas Bekman | JAm_pH--Just Another mod_perl Hacker
 http://stason.org/  | mod_perl Guide  http://perl.apache.org/guide 
 mailto:[EMAIL PROTECTED]  | http://perl.orghttp://stason.org/TULARC/
 http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
 --
 
 




Re: performance mongers: since when is using CGI.pm or Apache::Registrydishonorable?

2000-03-29 Thread C. Jon Larsen


CGI.pm is a great piece of code, but its very monolithic. Lincoln/Doug's
libapreq module is probably much faster (I have never run benchmarks) than
CGI.pm, so it makes sense  for those who like the Q-param type interface
(I do) for working with CGI environment variables, but don't need all the
handy html and cookie functions/methods the CGI.pm provides. 

A lot of mod_perl shops have aready developed their own templating scheme,
or page object model, or are using one of Mason, ASP, embperl etc . . .
and don't have a lot of use for 85% of CGI.pm's library routines. 

Again, there are c based modules now for HTTP utils and cookies as well,
which provide more speed. 

The reason many prefer native Apache methods over wrapped cgi scripts is
not just speed, but coding style and maturity. Writing modules and setting
up objects requires more discipline that writing quick scripts and relying
on magic to reset your environment for the next execution run.  I have
applications that now run as deep as 50,000 to 100,000 lines of code. I
don't want wrapped scripts. I want re-usable functions, objects, etc.
As developers learn to write native handlers they are starting down the
path that gets them ready for more serious action (namespace management,
using lexicals properly, etc . . . )

That being said perl is all about getting your job done before you get
fired. So an elegant registry solution should never be looked down upon
just because its a registry solution. 

On Wed, 29 Mar 2000, Matt Arnold wrote:

 Many messages on this list perpetuate the notion that usage of CGI.pm and
 Apache::Registry is for beginners.  Popular opinion is that you're not a
 leet mod_perl h@x0r until you wean yourself from CGI.pm and Apache::Registry
 and "graduate" to the Apache API.  With this in mind, there have been many
 messages over the years making blanket statements along the lines of "CGI.pm
 is evil" and/or "Apache::Registry sux".  I'm trying to identify the source
 of this disatisfaction.  While it may seem that my intent is to start the
 ultimate, end-all CGI.pm/Apache::Registry flame war, please be assured that
 I am interested in ferreting out the real issues.  :-)
 
 Anyway, in hope of generating some debate, I'll make some (potentially
 inflammatory) assertions:
 
 1. An Apache handler doesn't mean CGI.pm *ISN'T* in use
 
 The "Apache::Registry sux" crowd claims I should forgo Apache::Registry and
 write handlers instead.  Okay, here's my handler:
 
   # in httpd.conf
   Location /foo
 SetHandler perl-script
 PerlHandler Apache::Foo
   /Location
 
   package Apache::Foo;
   use strict;
   use CGI ();
   sub handler {
 my $q = CGI-new;
 print $q-header;
 print "Hello World\n";
 200;
   }
   1;
 
 Satisfied?  No Apache::Registry in use here.  Am I a l33t h@x0r now?  No?
 Why not?  Oh, so when the zealots say, "Apache::Registry sux, write handlers
 instead" they really mean I should be using the Apache API instead of
 CGI.pm.  I see.
 
 I have another beef with the "CGI emulation sux, avoid Apache::Registry"
 crowd.  And that is:
 
 2. Just because you don't use Apache::Registry doesn't mean you're not doing
 CGI emulation (*gasp*)
 
 What exactly is this "evil, bloated, slow CGI emulation" that everyone's
 trying to avoid?  Is it the overheard of setting up all the environment
 variables?  Well, gee whiz, regular handlers do this too unless you tell
 them not to.  Try the following exercise:
 
   Location /env
 #PerlSetupEnv Off  # try first without; then try with PerlSetupEnv Off
 SetHandler perl-script
 PerlHandler Apache::Env
   /Location
 
   package Apache::Env;
   use strict;
   use Data::Dumper qw(Dumper);
   sub handler {
 my $r = shift;
 $r-content_type('text/plain');
 $r-send_http_header;
 $r-print(Dumper(\%ENV));
 200;
   }
   1;
 
 So let's not be so quick to curse Apache::Registry for it's "slow" CGI
 emulation.  Your "fast" handlers are probably doing the same thing
 unbeknownst to you.
 
 Another assertion:
 
 3. Using Apache::Registry doesn't necessarily mean CGI.pm is at use
 
 It seems the "Apache::Registry sux" crowd dislikes Apache::Registry because
 it implies that CGI.pm is in use.  Perhaps their real gripe is one should
 use the Apache API instead of CGI.pm's methods.  So how would they feel
 about this:
 
   # in httpd.conf
   Location /bar
 PerlSetupEnv Off  # we don't need no stinking ENV
 SetHandler perl-script
 PerlHandler Apache::Registry  # or Apache::RegistryNG-handler
 Options +ExecCGI
   /Location
 
   #!/usr/local/bin/perl -w
   use strict;
   my $r = Apache-request;
   $r-content_type("text/html");
   $r-send_http_header;
   $r-print("Hi There!");
 
 Does this count?  Am I a l33t h@x0r because I used the Apache API?  Or am I
 still a lamer for using Apache::Registry?
 
 I can hear the hordes out there crying, "Why use Apache::Registry if you're
 not using CGI.pm?"  Well, perhaps I have a couple hundred scripts and don't

Re: Any help showing examples of database only web site w/mod_perl/my sql

1999-10-26 Thread Jon J

That is what I did for our site. We have a members only section that
allows them to have web access to some configurable pieces of their
services. We store their encrypted account password as a column in the
table that hold account info. When they try to access the protected area,
the module steps in a prints out a form for authentication. It takes in
its stuff and compares it to what it should be as returned by the db and
either rejectes them or assigns them a cookie with a random token that is
also stored in the db. If they try to access the area and the module sees
that they have such a cookie it tests the token to see if its still valid
and the process behaves pretty seamlessly. Its also a good method cause
you can add alot of proprietary type functions for extra security,
tracking, etc. Unfortunately I do not have a test account that you could
examine the interface through. If you need any help or have any questions,
I may be able to provide assistance though.


On Tue, 26 Oct 1999, James G Smith wrote:

 Clifford Lang [EMAIL PROTECTED] wrote:
 I have a static site now where users can create new sites (user home
 directories) very easily, but the growth is going to kill me and my
 filesystem (to many subdirectories).
 
 I would like to build a 100% DB contained web site.  Meaning all users home
 directories, files etc.. exists within a database.  Any examples or places
 to look would be greatly appreciated.  
 
 The areas I'm having conceptual trouble with is mainly the *.conf files. 
 How do I accomplish the same actions as below with a static conf file?
 (without restarting the server every time a new user is added)
 
 I would write my own PerlAcessHandler and PerlAuthenHandler that would base 
 its authentication/authorization on the URL.  If you needed further 
 customization of the authentication/authorization, you could tie your module's 
 configuration to the user in the database.
 
 Implementation is left as an exercise to the reader.
 -- 
 James Smith [EMAIL PROTECTED], 409-862-3725
 Texas AM CIS Operating Systems Group, Unix
 
 
 

---
 "I keep banging my head on things," Tom said, bashfully.
-------
Jon J - Web Development for Shore.Net
   
E-mail: [EMAIL PROTECTED]
[EMAIL PROTECTED]
Phone:  781 593-3110 x156