apache in win2k

2002-03-12 Thread Conan Chai

dear all,

i just install apache 1.3.26 in win2k. the html documents are running properly but cgi 
is not running. i have perl v5.6.1 installed. everytime i run a cgi script, the server 
error_log says "couldn't spawn child process: c:/program files/apache 
group/apache/cgi-bin/pizza.cgi". this error happens even if i run a simple cgi that 
prints "hello world". i'm not sure if it has anything to do with the shebang line 
because as what i found out, windows ignores the shebang line.

pls advise. thks

Conan





Where is UserAgent.pm

2002-03-12 Thread Marcelo Camperi

Dear members of the list,

I have a question that will probably reveal how little (if anything) I know 
about perl. Please forgive me if I am asking something akin to "will the sun 
rise tomorrow" to a perl programmer...

I need to use a script on my web server (running RedHat 7.2) that requires me to 
install MIME-Lite. I downloaded MIME-Lite-HTML-1.8.tar.gz from cpan and tried to 
install it, as instructed in the README file. However, the testing was 
unsuccesful, as I was told that:

Can't locate LWP/UserAgent.pm in @INC...

I assume this is another perl module that I do not have. Could someone please 
tell me where to find it? (I looked into User and Agent in cpan, but they do not 
seem to be the ones...)


Also, the script I need to use tells me that I can copy the directory MIME into 
cgi-bin, and that this should contain Lite.pm. Well, nothing with that name 
appears in MIME-Lite-HTML-1.8.tar.gz, only a HTML.pm. Is this the same thing?


Thank you very much for your help

Marcelo


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




writting webmail with perl V.S C

2002-03-12 Thread Cliff

Hi all:
I am considering which language to write a webmail mail program is a better choice.
Is there any article compare the two language developing a cgi program ?
Thanks !


Cliff


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: mysterious leading spaces

2002-03-12 Thread Tagore Smith

James Woods wrote:
>
> The code I was referring to was:
>
> foreach (@Draw) {
> s/\s+$//g; # remove all whitespace at the end of a row
> print "\n";
> }
>

   Are you reading the data into an array in the script and then printing
the array using interpolation inside double quotes?

   print @Array; and print "@Array";. are different. The second will
separate the items with spaces.

Tagore Smith




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: nearly got the cookies // debugging suggestion

2002-03-12 Thread Stout, Joel R

Here's a sample CGI/Cookies script, originally taken from perlmonks (cLive).
Notice you don't need CGI::Cookie.  You may need to refresh once to see the
set cookies.  And don't tell my wife about the redheads thing, she's a
brunette. :)

#!/usr/bin/perl-w

use strict;
use CGI;
use CGI::Carp 'fatalsToBrowser';

my $cgi = new CGI;

# grab existing %cookie
my %cookie;
for ($cgi->cookie()) {
  $cookie{$_} = $cgi->cookie($_);
}

# set a couple of cookies;
$cookie{'ID'} = 123456;
$cookie{'preferences'} = "redheads";
$cookie{'LoginName'} = "Calaban";
$cookie{'Other_cookie'}  = "whatever";

# create cookies for CGI
my @cookies;
for (keys %cookie) {
  push @cookies, $cgi->cookie( -name  => $_,
   -value => $cookie{$_}
 );
}

# print amended header
print $cgi->header(-cookie=>[@cookies]),$cgi->start_html(-title=>'Login');

# use our hash to check "cookie"
if(defined(my $cookieHolder = $cookie{'LoginName'})){
print $cgi->h3("Retrieved cookie named LoginName: $cookieHolder");
}
else{
print $cgi->h3("No cookie retrieved.");
}

# display all stored
print $cgi->h4('Stored Cookies');

for (keys %cookie) {
  print "$_ = $cookie{$_}".$cgi->br;
}


Should show:
Retrieved cookie named LoginName: Calaban
Stored Cookies
ID = 123456
preferences = redheads
Other_cookie = whatever
LoginName = Calaban

I'm learning CGI myself so if anyone else wants to pitch in please do so.

Joel

> -Original Message-
> From: Matthew Harrison [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 12, 2002 11:30 AM
> To: Stout, Joel R
> Cc: [EMAIL PROTECTED]
> Subject: Re: nearly got the cookies // debugging suggestion
> 
> 
> I have added all the debugging tools and it is still not 
> enough info to 
> sort the prob. have you got a script that retreives variables 
> that i could 
> look at?
> 
> cheers
> 
> On Tuesday 12 Mar 2002 6:48 pm, Stout, Joel R wrote:
> > A good site for beginners...
> >
> > 
> http://www.easystreet.com/~ovid/cgi_course/appendices/appendix1.html#D
> >
> > > -Original Message-
> > > From: Matthew Harrison 
> [mailto:[EMAIL PROTECTED]]
> > > Sent: Tuesday, March 12, 2002 10:42 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: nearly got the cookies
> > >
> > >
> > > I have manager to set a cookie containing a hash of 4 keys
> > > and 4 values.
> > > This is the script i have to retrieve the cookies and modify
> > > the look of
> > > the page using them. i have constructed it using bit frmo
> >
> > www.perldoc.org.
> > it keeps saying it cannot run because of something in the way i am
> > retieving the cookies. what is wrong?
> >
> > #!/usr/bin/perl
> >
> > use CGI qw/:standard/;
> > use CGI::Cookie;
> >
> > %cookies = fetch CGI::Cookie;
> > $font = $cookies{'font'}->value;
> > $size = $cookies{'size'}->value;
> > $color = $cookies{'cookie'}->value;
> > $back = $cookies{'back'}->value;
> >
> > print header();
> >
> > print < >
> > 
> > 
> > 
> > hello people, hope you like your prefs.
> > 
> > 
> > 
> >
> > END_OF_HTML
> 
> -- 
> Matthew Harrison
> Internet/Network Services Administrator
> Peanut-Butter Cheesecake Hosting Services
> Genstate
> www.peanutbuttercheesecake.co.uk
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: session id

2002-03-12 Thread Hanson, Robert

I usually use Session::Apache for that.  It will allow for the creation of
session ID's, storing data, and retreival of data.  You will need to set up
a table in a database, and then put some code in each page to fetch the
session ID from the querystring or cookie so that it can initialize the
session object.  It's a little tricky, but will do what you want.

Rob

-Original Message-
From: Hytham Shehab [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 3:42 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: session id


Hello!
i see in most PHP powered sites values like SID=02304028lkbah234, which
is the session id in most cases, is there any way to do the same in PERL?

Thanks

--
Hytham Shehab

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: mysterious leading spaces (sample text included)

2002-03-12 Thread fliptop

James Woods wrote:

> Putting that code in place of the chomp code that was suggested earlier 
> produced the same result.


i just tried this test case:

# one with blank spaces, two with a tab,
# three with a \n, four with several \n's
my @Data = ('one   ', 'two  ', 'three
', 'four


');

foreach (@Data) {
   s/\s+$//g;
   print "\n";
}

and the output was:






so i don't know how i can help any more.  it should work as expected.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: mysterious leading spaces (sample text included)

2002-03-12 Thread James Woods

fliptop wrote:

according to a 'view source' on the above url, your hidden input params
do indeed have a new line on the end.

try this (instead of chomp):

foreach (@Draw) {
s/\s+$//g;  # remove all whitespace at the end of a row
print "\n";
}

James wrote:

Putting that code in place of the chomp code that was suggested earlier 
produced the same result.

>Here's something that I need some education on: why is it when I just
>put the @Draw array into a hidden field, does it pass all the data, and
>when I use the code suggested, it only passes the first record?  It
>seems to me from what I've read about CGI.pm that it would take all the
>hidden fields and put them into the @Draw array like I've specified.  Oh
>well.

fliptop wrote:

i'm not sure which code you are referring to.

Jams wrote:

The code I was referring to was:

foreach (@Draw) {
s/\s+$//g;  # remove all whitespace at the end of a row
print "\n";
}

Thanks so much for spending so much time on this.  When I decided that this 
sounded like a "simple" project to help me learn Perl, I obvously had no 
idea what I was getting myself into.

Any more ideas?

-James

_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Perl, Apache & undefined subroutine

2002-03-12 Thread Tim Doty

Hi,

I am having a problem on a particular server with a subroutine being
'undefined' most (but not all) of the time. The error that shows up from
apache is:

Undefined subroutine &Apache::ROOT::perl::query_2epl::ReadParse called at
/usr/local... line 13

The subroutine, &ReadParse() is provided by cgi-lib.pl (v2.18). cgi-lib.pl
resides in the same directory as the perl script which does:

require "cgi-lib.pl";

followed by the &ReadParse(). I have tried different paths (e.g.,
../cgi-lib.pl) with no difference in behavior.

I don't have any hard statistics, but the error is very random. Sometimes
there isn't an error, often times there is. If I click reload "enough" times
the page will eventually load without error.

The strange thing is that I have the same setup on another server (different
scripts but doing the same kind of thing) and there is never a hiccup.

The problem server is running Redhat 7.2 and has exhibited the problem with
the provided rpm versions of apache, perl, etc. as well as with recent
versions that I downloaded and installed (originally it was Apache/1.3.20
(Unix) (Red-Hat/Linux) with perl 5.6.0 and mod_perl as a DSO, now it is
Apache/1.3.23 (Unix) with perl 5.6.1 and mod_perl compiled into apache).

The working server was running Redhat 7.1 with the provided rpm versions of
apache, perl, etc. but is currently running SuSE 7.3 with provided apache,
perl, etc. ATM I don't have access to the machine to tell what the various
versions are.

I would really like to not have to reload a page fifty times just to get the
script to run correctly; does anyone have any ideas?

TIA,

Tim Doty


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




session id

2002-03-12 Thread Hytham Shehab

Hello!
i see in most PHP powered sites values like SID=02304028lkbah234, which is the 
session id in most cases, is there any way to do the same in PERL?

Thanks

--
Hytham Shehab



Re: HTML::Template

2002-03-12 Thread fliptop

Boex,Matthew W. wrote:

> is it preferred to have a cgi print the inital .html template page, or
> should i put it in the html dir, and point the FORM tag to the cgi.  i know
> putting in the html dir will speed things up, no perl process to spawn.  i
> will be using fast cgi in the near future...


if you serve your template pages from your document root (without having 
perl and HTML::Template parse them), they'll have 's and 
's etc. sprinkled throughout.  i doubt you'd really want that.

normally, i set up an httpd virtual host like this (this is on linux w/ 
apache):

server root:  /path/to/vhosts/domainname/
document root:  /path/to/vhosts/domainname/html/
template root:  /path/to/vhosts/domainname/templates/
cgi-bin:  /path/to/vhosts/domainname/cgi-bin/

it's probably best to not put your template files in the document root.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




HTML::Template

2002-03-12 Thread Boex,Matthew W.


is it preferred to have a cgi print the inital .html template page, or
should i put it in the html dir, and point the FORM tag to the cgi.  i know
putting in the html dir will speed things up, no perl process to spawn.  i
will be using fast cgi in the near future...

matt 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: nearly got the cookies // debugging suggestion

2002-03-12 Thread Matthew Harrison

I have added all the debugging tools and it is still not enough info to 
sort the prob. have you got a script that retreives variables that i could 
look at?

cheers

On Tuesday 12 Mar 2002 6:48 pm, Stout, Joel R wrote:
> A good site for beginners...
>
> http://www.easystreet.com/~ovid/cgi_course/appendices/appendix1.html#D
>
> > -Original Message-
> > From: Matthew Harrison [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, March 12, 2002 10:42 AM
> > To: [EMAIL PROTECTED]
> > Subject: nearly got the cookies
> >
> >
> > I have manager to set a cookie containing a hash of 4 keys
> > and 4 values.
> > This is the script i have to retrieve the cookies and modify
> > the look of
> > the page using them. i have constructed it using bit frmo
>
> www.perldoc.org.
> it keeps saying it cannot run because of something in the way i am
> retieving the cookies. what is wrong?
>
> #!/usr/bin/perl
>
> use CGI qw/:standard/;
> use CGI::Cookie;
>
> %cookies = fetch CGI::Cookie;
> $font = $cookies{'font'}->value;
> $size = $cookies{'size'}->value;
> $color = $cookies{'cookie'}->value;
> $back = $cookies{'back'}->value;
>
> print header();
>
> print <
> 
> 
> 
> hello people, hope you like your prefs.
> 
> 
> 
>
> END_OF_HTML

-- 
Matthew Harrison
Internet/Network Services Administrator
Peanut-Butter Cheesecake Hosting Services
Genstate
www.peanutbuttercheesecake.co.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: mysterious leading spaces (sample text included)

2002-03-12 Thread fliptop

James Woods wrote:

> Here is the raw text from my text file (the original source).  It's 
> created on a Windows machine (??in case that makes a difference with 
> linefeeds vs. carridge returns??) then put on an apache web server.
> 
> f|Gimlis Axe|p|fellowship/large/14gimlisbattleaxe.html
> f|Hand Axe|p|minesofmoria/large/010handaxe.html
> f|Gimlis Helm|p|fellowship/large/15gimlishelm.html
> f|Dwarven Armor|p|fellowship/large/8dwarvenarmor.html
> f|Dwarven Bracer|p|minesofmoria/large/003dwarvenbracers.html
> f|Gandalfs Staff|p|minesofmoria/large/022gandalfsstaff.html
> f|Glamdring|p|fellowship/large/75glamdring.html
> f|Sleep Cahadras|d|fellowship/large/84sleepcaradhras.html
> f|Axe Strike|d|fellowship/large/3axestrike.html

> 
> on http://staff.washington.edu/guru/james.cgi you should be able to see 
> the progression of the @Draw array in the large textareas.


according to a 'view source' on the above url, your hidden input params 
do indeed have a new line on the end.

try this (instead of chomp):

foreach (@Draw) {
s/\s+$//g;  # remove all whitespace at the end of a row
print "\n";
}

> Here's something that I need some education on: why is it when I just 
> put the @Draw array into a hidden field, does it pass all the data, and 
> when I use the code suggested, it only passes the first record?  It 
> seems to me from what I've read about CGI.pm that it would take all the 
> hidden fields and put them into the @Draw array like I've specified.  Oh 
> well.


i'm not sure which code you are referring to.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




nearly got the cookies

2002-03-12 Thread Matthew Harrison

I have manager to set a cookie containing a hash of 4 keys and 4 values. 
This is the script i have to retrieve the cookies and modify the look of 
the page using them. i have constructed it using bit frmo www.perldoc.org.
it keeps saying it cannot run because of something in the way i am 
retieving the cookies. what is wrong?

#!/usr/bin/perl

use CGI qw/:standard/;
use CGI::Cookie;

%cookies = fetch CGI::Cookie;
$font = $cookies{'font'}->value;
$size = $cookies{'size'}->value;
$color = $cookies{'cookie'}->value;
$back = $cookies{'back'}->value;

print header();

print <


hello people, hope you like your prefs.




END_OF_HTML

-- 
Matthew Harrison
Internet/Network Services Administrator
Peanut-Butter Cheesecake Hosting Services
Genstate
www.peanutbuttercheesecake.co.uk


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: mysterious leading spaces (sample text included)

2002-03-12 Thread James Woods

Here is the raw text from my text file (the original source).  It's created 
on a Windows machine (??in case that makes a difference with linefeeds vs. 
carridge returns??) then put on an apache web server.

f|Gimlis Axe|p|fellowship/large/14gimlisbattleaxe.html
f|Hand Axe|p|minesofmoria/large/010handaxe.html
f|Gimlis Helm|p|fellowship/large/15gimlishelm.html
f|Dwarven Armor|p|fellowship/large/8dwarvenarmor.html
f|Dwarven Bracer|p|minesofmoria/large/003dwarvenbracers.html
f|Gandalfs Staff|p|minesofmoria/large/022gandalfsstaff.html
f|Glamdring|p|fellowship/large/75glamdring.html
f|Sleep Cahadras|d|fellowship/large/84sleepcaradhras.html
f|Axe Strike|d|fellowship/large/3axestrike.html

on http://staff.washington.edu/guru/james.cgi you should be able to see the 
progression of the @Draw array in the large textareas.

Here's something that I need some education on: why is it when I just put 
the @Draw array into a hidden field, does it pass all the data, and when I 
use the code suggested, it only passes the first record?  It seems to me 
from what I've read about CGI.pm that it would take all the hidden fields 
and put them into the @Draw array like I've specified.  Oh well.

Thanks all for your help so far!  It's been educational

Original Message Follows
From: fliptop <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: James Woods <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: mysterious leading spaces (same foreach problem w/ more 
details)
Date: Tue, 12 Mar 2002 00:19:50 -0500

James Woods wrote:

>I used the following code to write out all my hidden fields.  It didn't
>get rid of the newline or caridge return characters at the end though.
>
>foreach my $item (@Draw){
>my $counter = 0;
>my $daValue = $item;
>chomp($daValue);
>print "\n";
>$counter++;
>}
>
>I accessed and created the array with this code:
>
>my @Draw = $cgi->param("drawHidden") || "";
>
>Any ideas why I can't get rid of the ending characters?  (besides the
>fact that I really have no idea what I'm doing? 8^)


well i don't know offhand - i'd have to examine what's in @Draw.  i'd
suspect you may have more in there than chomp() can handle.  can you
post an example portion of @Draw that displays the strange behavior?

btw, your loop can be rewritten as such:


foreach (@Draw) {
   chomp;
   print "\n";
}


or like this:


map {
   chomp;
   print "\n";
} @Draw;


without all that $item/$counter stuff.  i don't understand what the
$counter is for anyway since you're setting it to 0 on each loop iteration.



_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: mysterious leading spaces (same foreach problem w/ more details)

2002-03-12 Thread Joshua Hayden

- Original Message -
From: "James Woods" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, March 11, 2002 10:56 PM
Subject: Re: mysterious leading spaces (same foreach problem w/ more
details)


> I used the following code to write out all my hidden fields.  It didn't
get
> rid of the newline or caridge return characters at the end though.
>
> foreach my $item (@Draw){
> my $counter = 0;
> my $daValue = $item;
> chomp($daValue);
> print "\n";
> $counter++;
> }
>
> I accessed and created the array with this code:
>
> my @Draw = $cgi->param("drawHidden") || "";
>
> Any ideas why I can't get rid of the ending characters?  (besides the fact
> that I really have no idea what I'm doing? 8^)
>
> -James

I had the same problem in a script I was writing. You could use this to get
rid of your caridge returns.

foreach (@Draw) {
   chomp;
   s/\n//;
   print "\n";
}

Best Regards,
JOSHUA D. HAYDEN




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]