[16498] in Perl-Users-Digest
Perl-Users Digest, Issue: 3910 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 4 03:05:28 2000
Date: Fri, 4 Aug 2000 00:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <965372713-v9-i3910@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 4 Aug 2000 Volume: 9 Number: 3910
Today's topics:
Re: #include-type-of-thing-in-Perl (Philip 'Yes, that's my address' Newton)
Can't locate object method "new" - CRYPT <pleaseREPLYtotheGROUP@notrealdomain.com>
Can't locate object method "new" - CRYPT <pleaseREPLYtotheGROUP@notrealdomain.com>
Re: Can't locate object method "new" - CRYPT (Logan Shaw)
Re: cookie anyone? (Rafael Garcia-Suarez)
cookie..mmm <troyr@vicnet.net.au>
Re: Directory mover (BUCK NAKED1)
Re: Directory mover <troyr@vicnet.net.au>
Re: display content from <STDIN> (Gwyn Judd)
Gee, thanks for all the help :-( <tarheel@sierratel.com>
Re: Gee, thanks for all the help :-( (Logan Shaw)
Re: How to explain this expression? <prakash@navajo.gate.net>
Re: How to open and append to a file (Gwyn Judd)
Re: How to open and append to a file (Gwyn Judd)
Re: How to open and append to a file <godzilla@stomp.stomp.tokyo>
Re: How to open and append to a file <godzilla@stomp.stomp.tokyo>
Re: How to open and append to a file <godzilla@stomp.stomp.tokyo>
Re: HTML::Template (Anthony Peacock)
Re: need help running .pl files with Apache <rtarpine@hotmail.com>
Re: need help running .pl files with Apache <kernel@start.no>
Re: need help running .pl files with Apache <kernel@start.no>
remove blank character <cplee@bigfoot.com>
Re: remove blank character <troyr@vicnet.net.au>
Re: remove blank character <troyr@vicnet.net.au>
Re: remove blank character <troyr@vicnet.net.au>
Re: Security (with respect to chmod) - user_create.cgi (Robert Hallgren)
semijoin() - a better way? (John M. Gamble)
time output not showing leading 0's ? How do I... <robert@chalmers.com.au>
Re: time output not showing leading 0's ? How do I... (Iain Chalmers)
using perl to fetch finger .plan information <nospam@nospam.com>
Re: using perl to fetch finger .plan information <godzilla@stomp.stomp.tokyo>
Re: using perl to fetch finger .plan information (Logan Shaw)
what mod-perl want me do eastking@my-deja.com
Why won't $ua->credentials($URL,$realm,$uname,$pword) w Dennis @notmyrealaddress.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 04 Aug 2000 05:10:08 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: #include-type-of-thing-in-Perl
Message-Id: <398a47f5.258008055@news.nikoma.de>
On Thu, 3 Aug 2000 23:57:19 -0400, "Ryan Tarpine" <rtarpine@hotmail.com>
wrote:
> Aha! The file I was trying to include consisted only of subroutines, with
> nothing to be executed by do FILE. Just returning a dummy value made it
> work correctly. Is there anything specific I should return as a dummy
> value?
1;
is the most commonly used one. It has to be a true value for require and
use -- you probably want require FILE and not do FILE. perldoc -f
require.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Fri, 04 Aug 2000 04:23:24 GMT
From: "GS" <pleaseREPLYtotheGROUP@notrealdomain.com>
Subject: Can't locate object method "new" - CRYPT
Message-Id: <0zri5.4222$wn.46276@typhoon.san.rr.com>
I installed ActiveState's ActivePerl 5.6 build 616 and then went into PPM
and did
"install Crypt-Blowfish_PP" It said it installed fine.
I then run code (CODE 1 BELOW) which checks for Crypt::CBC and it says
that's OK. But when I try to use it (CODE 2 BELOW) I get this error:
Can't locate object method "new" via package "Crypt::CBC"
I'm a programmer but new to perl and modules. Could someone tell me what to
do to fix this?
CODE 1 EXCERPT
print_message("Checking for Crypt::CBC...");
$module = "CBC";
eval "do $module";
if (not $@) {
print_message(" OK\n");
CODE 2 EXCERPT
$cipher = new Crypt::CBC(pack('H*', $WHATEVER{private_key}),
$WHATEVER{crypt_type});
------------------------------
Date: Fri, 04 Aug 2000 04:23:25 GMT
From: "GS" <pleaseREPLYtotheGROUP@notrealdomain.com>
Subject: Can't locate object method "new" - CRYPT
Message-Id: <1zri5.4223$wn.46276@typhoon.san.rr.com>
I installed ActiveState's ActivePerl 5.6 build 616 and then went into PPM
and did
"install Crypt-Blowfish_PP" It said it installed fine.
I then run code (CODE 1 BELOW) which checks for Crypt::CBC and it says
that's OK. But when I try to use it (CODE 2 BELOW) I get this error:
Can't locate object method "new" via package "Crypt::CBC"
I'm a programmer but new to perl and modules. Could someone tell me what to
do to fix this?
CODE 1 EXCERPT
print_message("Checking for Crypt::CBC...");
$module = "CBC";
eval "do $module";
if (not $@) {
print_message(" OK\n");
CODE 2 EXCERPT
$cipher = new Crypt::CBC(pack('H*', $WHATEVER{private_key}),
$WHATEVER{crypt_type});
------------------------------
Date: 4 Aug 2000 01:06:25 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Can't locate object method "new" - CRYPT
Message-Id: <8mdmh1$jn5$1@provolone.cs.utexas.edu>
In article <0zri5.4222$wn.46276@typhoon.san.rr.com>,
GS <pleaseREPLYtotheGROUP@notrealdomain.com> wrote:
>I installed ActiveState's ActivePerl 5.6 build 616 and then went into PPM
>and did
>
>"install Crypt-Blowfish_PP" It said it installed fine.
>
>I then run code (CODE 1 BELOW) which checks for Crypt::CBC and it says
>that's OK. But when I try to use it (CODE 2 BELOW) I get this error:
>
>Can't locate object method "new" via package "Crypt::CBC"
>
>I'm a programmer but new to perl and modules. Could someone tell me what to
>do to fix this?
>
>CODE 1 EXCERPT
>print_message("Checking for Crypt::CBC...");
>$module = "CBC";
>eval "do $module";
>if (not $@) {
>print_message(" OK\n");
Apparently you're trying to trap failure to include the module so that
your program can continue to run in a degraded mode, right? (If not,
you're being way too complicated.)
It would be better to use the block form of eval, and it would also be
better to actually "use" the module inside your eval rather than
"do"ing it.
print_message("Checking for Crypt::CBC...");
eval { require Crypt::CBC and import Crypt::CBC };
if (not $@) { . . . . whatever . . . . }
I'm not sure if this will solve your problem or not. If not, then the
next thing you ought to do is not try to trap failure and just "use"
the module in the traditional way:
use Crypt::CBC;
$somevariable = new Crypt::CBC (some arguments here);
That way, you'll at least find out whether the module seems to be
working or not.
Hope that helps.
- Logan
------------------------------
Date: Fri, 04 Aug 2000 06:38:58 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: cookie anyone?
Message-Id: <slrn8okpho.8nv.rgarciasuarez@rafael.kazibao.net>
Troy Rasiah wrote in comp.lang.perl.misc:
>hi all,
> I've been wondering if this is a problem with Internet Explorer or
>me..but I'm using the following code to set a cookie that expires within 1
>second. It works fine with Netscape but IE doesn't seem to respond to it.
>For example...say i set the cookie for 10 mins at the start of the
>program..they hit on a logout button..and it sets the expire time to 1s.
>Anyone have any suggestions or comments......
>
>my $cookie_expire='+1s' ;
Try to set
$cookie_expire = '-1d'; # one day in the past
When a cookie expiration date is set in the past, it should be removed
from the browser. And IE seems to have difficulties with short times.
>$cookie = $query->cookie(-name=>'HOTTOP',
> -value=>$session{_session_id},
> -expires=>$cookie_expire,
> -path=>'/',
> -domain=>$cookie_domain);
>
>print $query->header(-cookie=>$cookie);
>print $query->start_html('Admin Logout');
--
Rafael Garcia-Suarez
------------------------------
Date: Fri, 4 Aug 2000 15:26:38 +1000
From: "Troy Rasiah" <troyr@vicnet.net.au>
Subject: cookie..mmm
Message-Id: <Xvsi5.69135$N4.1900511@ozemail.com.au>
hi all,
I've been wondering if this is a problem with Internet Explorer or
me..but I'm using the following code to set a cookie that expires within 1
second. It works fine with Netscape but IE doesn't seem to respond to it.
For example...say i set the cookie for 10 mins at the start of the
program..they hit on a logout button..and it sets the expire time to 1s.
Anyone have any suggestions or comments......
my $cookie_expire='+1s' ;
$cookie = $query->cookie(-name=>'HOTTOP',
-value=>$session{_session_id},
-expires=>$cookie_expire,
-path=>'/',
-domain=>$cookie_domain);
print $query->header(-cookie=>$cookie);
print $query->start_html('Admin Logout');
--
----------------------------------------------------------------------------
----------------
Troy Rasiah
Database/Web Developer
Vicnet
troyr@vicnet.net.au
----------------------------------------------------------------------------
----------------
------------------------------
Date: Fri, 4 Aug 2000 00:13:56 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Directory mover
Message-Id: <12345-398A5114-59@storefull-247.iap.bryant.webtv.net>
I overlooked that Net:FTP module does not work on Unix. I need a
directory mover perl script that will work on a Unix server. Emulating
most of WS FTP's functions would be a plus. Thanks again.
--Dennis
------------------------------
Date: Fri, 4 Aug 2000 15:47:22 +1000
From: "Troy Rasiah" <troyr@vicnet.net.au>
Subject: Re: Directory mover
Message-Id: <nPsi5.69152$N4.1900651@ozemail.com.au>
what do you mean it doesn't work on unix?
what sort of system are u running there?
--
----------------------------------------------------------------------------
----------------
Troy Rasiah
Database/Web Developer
Vicnet
troyr@vicnet.net.au
----------------------------------------------------------------------------
----------------
"BUCK NAKED1" <dennis100@webtv.net> wrote in message
news:12345-398A5114-59@storefull-247.iap.bryant.webtv.net...
> I overlooked that Net:FTP module does not work on Unix. I need a
> directory mover perl script that will work on a Unix server. Emulating
> most of WS FTP's functions would be a plus. Thanks again.
>
> --Dennis
>
------------------------------
Date: Fri, 04 Aug 2000 04:29:59 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: display content from <STDIN>
Message-Id: <slrn8okhm5.s2l.tjla@thislove.dyndns.org>
I was shocked! How could jliu34740@my-deja.com <jliu34740@my-deja.com>
say such a terrible thing:
>Here is part of my program:
>
>print "\nEnter a string of characters for analysis or quit to exit: ";
>@string=chomp($_=<STDIN>);
Hmmm have a look at "perldoc -f chomp" and see what it returns. I don't
think you want to do that...conversely if you do, I don't think it makes
sense.
>---------
>if I enter a string "123 the" on one line, how do I count the number of
>letters the user enters?
Here's a hint...you want to know the length of the string the user
entered.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
An incompetent attorney can delay a trial for months or years. A competent
attornety can delay one even longer.
-Evelle J. Younger
------------------------------
Date: Thu, 03 Aug 2000 21:56:12 -0700
From: Phil Hawkins <tarheel@sierratel.com>
Subject: Gee, thanks for all the help :-(
Message-Id: <398A4CEC.8BD01EB6@sierratel.com>
I have posted here twice in two days begging for help from you all and
NO ONE seems to think my question merits anyone's attention.
Nice group. Real f****** nice group.
Just so you know what I'm talking about, here's my question:
************
I give up. I bought a self-learning book on "Perl 5" and come to find
out I must download Perl, but I go to the perl.com site and it get's
more confusing.
My host is Unix, so I tried to download the Perl 5.6.00... and it just
froze my browser. It appears that there are two versions? One for NT
and the other for
Unix? Huh? I have to write two different scripts for each server
type? And what about the compiler?
I'm brand new to this, so someone please tell me what to do to get the
right version of Perl on my (local) machine... I'm dazed and confused.
The CD that came
with the book loaded the "source code" but when I started to write my
first scripts, it went belly up. I got wierd "Bare word found where
operator expected"
notice when all I tried to do is "% perl hello". Christ. Can't even
get out of the starting block.
Java was easier than this...
Phil
------------------------------
Date: 4 Aug 2000 01:20:01 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Gee, thanks for all the help :-(
Message-Id: <8mdnah$jok$1@provolone.cs.utexas.edu>
In article <398A4CEC.8BD01EB6@sierratel.com>,
Phil Hawkins <tarheel@sierratel.com> wrote:
>I have posted here twice in two days begging for help from you all and
>NO ONE seems to think my question merits anyone's attention.
>
>Nice group. Real f****** nice group.
Well, I quickly looked at your other article and it seemed to be
essentially saying that you were having a problem with your web browser
and downloading a file from the perl web site. That to me sounded like
something not perl-related, so I ignored it. (People post things that
aren't perl-related here all the time, like today when someone asked an
web/ASP question.)
Also, it is true that people answer questions out of their own
generosity, so it's quite possible that a given question might not get
answered if nobody happens to feel like it at the time.
>I give up. I bought a self-learning book on "Perl 5" and come to find
>out I must download Perl, but I go to the perl.com site and it get's
>more confusing.
>
>My host is Unix, so I tried to download the Perl 5.6.00... and it just
>froze my browser. It appears that there are two versions? One for NT
>and the other for
>Unix? Huh? I have to write two different scripts for each server
>type? And what about the compiler?
There are different versions of perl for different platforms because
platforms require this, i.e. the Unix source code isn't going to run
very well on a Windows machine that doesn't have a C compiler, and the
Windows executable isn't going to run very well on a Unix machine
that's have an Intel process (or even on one that does).
You don't have to write different scripts for each machine type. Perl
code can actually be pretty portable. There are some things that have
to be done differently on different platforms, though, just like with
any language.
>I'm brand new to this, so someone please tell me what to do to get the
>right version of Perl on my (local) machine... I'm dazed and confused.
If you have a Unix system, you want to download the source code archive
whose name ends in something like ".tar.gz". Then, extract that file
(using "gunzip filename.tar.gz" and "tar xf filename.tar") and "cd"
into the directory that that will have created. Read the "README" file
and stuff and other documentation until you figure out how to build and
install it. This may be a pain if you haven't ever installed anything
from source code on Unix before. (Depending on which version of Unix
you're using, there may be a pre-compiled perl available.)
>The CD that came
>with the book loaded the "source code" but when I started to write my
>first scripts, it went belly up. I got wierd "Bare word found where
>operator expected"
>notice when all I tried to do is "% perl hello".
"Bareword found where operator expected" means that the perl
interpreter is functioning properly and it doesn't like the syntax of
your script. For instance, this script is incorrect and perl
gives that error on it.
#! /usr/local/bin/perl
print "Hello" there;
The problem is, "print" expects a list of arguments which are
themselves expressions. The 'there' part of that statement isn't a
very good expression. It would be a better one if it were in quotes,
but that still isn't so great because there wouldn't be a comma between
it and the previous expression, which would confuse perl because perl
is expecting a list.
- Logan
------------------------------
Date: 4 Aug 2000 04:02:30 GMT
From: Prakash Kailasa <prakash@navajo.gate.net>
Subject: Re: How to explain this expression?
Message-Id: <8mdf8m$ogk$1@news.gate.net>
u8526505@ms27.hinet.net wrote:
: $_=<>;
: /hello/ and print "abc\n",print "ok\n";
if (/hello/) {
print "ok\n", print("abc\n");
}
The second print call results in the string "abc" and then it's return
value (1) is printed.
/prakash
: the result is
: hello <-- I input this
: ok
: abc
: 1
: Is there a friendly way to rewrite it ?
: Thanks
: Derek
------------------------------
Date: Fri, 04 Aug 2000 04:10:18 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: How to open and append to a file
Message-Id: <slrn8okggr.s2l.tjla@thislove.dyndns.org>
I was shocked! How could Chris Stone <c-stone@att.net>
say such a terrible thing:
>Well, I managed to find a Perl FAQ here
>http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html. Most of it's over
>my head, as I'm just beginning but I did manage to write a script that may
>or may not work. I do have a few questions that I could not find in the
>above FAQ:
>
>Can Perl open and write to an existing HTML document? And does this document
>need to have any special CHMOD commands?
Yes and no (apart from being readable and writable to whoever needs to).
>Here is my script if you are curious:
>
>#!/usr/bin/perl
This should be:
#!/usr/bin/perl -w
use strict;
>#read the form data using cgi-lib
>require "cgi-lib.pl";
This should be:
use CGI.pm;
cgi-lib.pl is old and obsolete. For an explanation of why have a look
here http://language.perl.com/info/www/!cgi-lib.html. Also CGI.pm is
distributed with perl so you don't have to install it.
>#open html file that contains previous entries
>open (GBENTRIES, "../gbentries.html");
>#copy entire document into an array
>@gbentries=<GBENTRIES>;
>close (GBENTRIES);
>#open the same html file to be written over
>open (GBENTRIES, ">../gbentries.html");
The preceding bit of code is just plain wrong. You need to lock the file
before you write to it otherwise you will find yourself in the crap.
Have a look at:
perldoc -q lock
perldoc -f flock
perldoc -f open
perldoc perlopentut (hint: you want the "mixed reads and writes" one. did
you read the "perl -q lock" file yet?)
>for $i; $i <= @#gbentries; $i++
You have a syntax error here. Do "for ($i = 0; $i < @gbentries; $i++)"
but you don't want to do that either. You almost never want to do a C
style for loop. What you probably should do is something like open the
file for read/write (and then lock it as it mentioned in "perl -q lock"
and loop over it like this (untested):
while (<GBENTRIES>) {
next unless /<!--**-->/;
That way you don't need to read the whole file in and then
unnescessarily write it back out again. This is in perlop as well.
>#until it reads <!--**--> which is a placeholder for the new entry
>if ($gbentries[i] =~/<!--**-->/)
> {
> #start writing the new entry
> print GBENTRIES "<P><B>Name: </B>$name</P>;
> print GBENTRIES "<P><B>E-mail: </B>$email</P>;
> print GBENTRIES "<P><B>Homepage: </B>$homepage</P>;
> print GBENTRIES "<P><B>Location: </B>$location</P>;
> print GBENTRIES "<P><B>Found page by: </B>$reference</P>;
> print GBENTRIES "<P><B>Comments: </B>$commments</P>;
> }
You have a few syntax errors there, you need to close off the
double-quotes at the end of each line. While there is nothing else
technically wrong that I can see with the above code you can do it a lot
better. Have a look at "perldoc perldata" and look at "Here Documents".
>This script would read from and write to an html file named "gbentries.html"
>which contains a line "<!--**--> which is where the script would place the
>new entry.
Actually yours wouldn't because you forgot to write the "<!--**-->"
line back to the file. :) Hope that helped.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Crime wouldn't pay if the government ran it.
------------------------------
Date: Fri, 04 Aug 2000 04:17:41 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: How to open and append to a file
Message-Id: <slrn8okgv0.s2l.tjla@thislove.dyndns.org>
I was shocked! How could Godzilla! <godzilla@stomp.stomp.tokyo>
say such a terrible thing:
>Here is a site with a fairly decent script much like
>yours. It does incorporate some security, does provide
>some nice error checking for various functions and, does
>make a good basic script upon which to build. I am not
>suggesting you use it but rather study it and learn from
>this script. It's a decent one, especially if you add
>a few extra features. It's name is Flexbook:
>
>http://scripts.riffnet.com/
One shudders to think what appalling example of coding you have managed
to dredge up this time, although fortunately the site appears to be
down. I guess we'll never know.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
It would be nice to be sure of anything the way some people are of everything.
------------------------------
Date: Thu, 03 Aug 2000 21:41:47 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: How to open and append to a file
Message-Id: <398A498B.E0F6924@stomp.stomp.tokyo>
Chris Stone wrote:
(snippage)
> About the script: strangely, it does not work,
> I got a 500 server error, I'll have to look
> back over it.
I have looked a little closer. See this print
section:
print GBENTRIES "<P><B>Name: </B>$name</P>;
print GBENTRIES "<P><B>E-mail: </B>$email</P>;
print GBENTRIES "<P><B>Homepage: </B>$homepage</P>;
print GBENTRIES "<P><B>Location: </B>$location</P>;
print GBENTRIES "<P><B>Found page by: </B>$reference</P>;
print GBENTRIES "<P><B>Comments: </B>$commments</P>;
You are missing your closing quote marks for each line!
Try this:
print GBENTRIES "<P><B>Name: </B>$name</P>",
<P><B>E-mail: </B>$email</P>",
<P><B>Homepage: </B>$homepage</P>",
<P><B>Location: </B>$location</P>",
<P><B>Found page by: </B>$reference</P>",
<P><B>Comments: </B>$commments</P>";
There are shorter ways to do this. However, this will
only require a minor modification, which is best during
beta testing. This method will also create a nice neat
document source. It is a good practice to only make minor
changes, in one section of program, then test. This
will eliminate any need for warnings and the such.
Save your script versions systematically, like:
script1.cgi
script2.cgi
script3.cgi
With each version having your liner notes on what you
changed, what line numbers and the such. Each version
should only have as minor of a change as possible.
This really is a logical method which releases you
from having to diagnose an entire script.
I should back up. Develop your script in modules.
Start with your basic shebang line, a read and parse,
then print one variable from your form input. If it is
successful, this is script number one with your notes
inside. Then expand your print for all input variables.
Successful, this is script two, with notes. Next, open
a file and print the contents. You should see your input
variables printed and your open file contents printed.
This would be script four, if it works, with notes. Next
step for a script like this, open and write your input
variables to a file. If this works, script number five.
Continue on adding modules to your script, one at at time,
each tested, make notes and save as a version number.
You see? Zero need for pragma hints. You are developing
your script a little at time, narrowing down your bugs
to one small part of your script. You are using modules
for development but not those kind of modules, your own
modules; read parse, print, open file, print, write to
a file... each a module.
Another advantage to this is a great one. If a version
fails and you cannot figure out why, you can backup one
version and start over!
Logic, thinking and good planning are your best diagnostic
tools ever. Forget those pragma hint training wheels, write
your programs like a real programmer; logically.
I'll run some tests on your script and discover if there
are other problems or not.
Godzilla!
------------------------------
Date: Thu, 03 Aug 2000 23:17:09 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: How to open and append to a file
Message-Id: <398A5FE5.F81713C9@stomp.stomp.tokyo>
"Godzilla!" wrote:
> Chris Stone wrote:
> (snippage)
ooppss....
Seems you left off your closing quotes and,
I forgot most of my opening quotes. DUH!!!
Sorry... look close and you will see my mistake
compared to my previous article.
Try this:
print GBENTRIES "<P><B>Name: </B>$name</P>",
"<P><B>E-mail: </B>$email</P>",
"<P><B>Homepage: </B>$homepage</P>",
"<P><B>Location: </B>$location</P>",
"<P><B>Found page by: </B>$reference</P>",
"<P><B>Comments: </B>$commments</P>";
------------------------------
Date: Thu, 03 Aug 2000 23:46:54 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: How to open and append to a file
Message-Id: <398A66DE.F4532ADA@stomp.stomp.tokyo>
Chris Stone wrote:
> Thanks for the encouragement and links...
Not ignoring your comments. Kinda enjoying
this trouble shooting.
Mild typo here:
<P><B>Comments: </B>$commments</P>
^^^
Three "m" in $comments
I will show you a way to dump the for loop.
Godzilla!
------------------------------
Date: 4 Aug 2000 06:31:29 GMT
From: a.peacock@chime.ucl.ac.uk (Anthony Peacock)
Subject: Re: HTML::Template
Message-Id: <8mdo01$gv6$1@uns-a.ucl.ac.uk>
In article <8mc223$s96$1@nnrp1.deja.com>, brainmuffin@excite.com says...
>
>If anyone has experience using imbedded loops with HTML:Template,
>please e-mail me. Thanks.
[Posted and emailed as requested]
I have just started using HTML::Template, using loops etc.
Do you have a specific question.
Please respond to the newsgroup not by email.
------------------------------
Date: Fri, 4 Aug 2000 00:18:25 -0400
From: "Ryan Tarpine" <rtarpine@hotmail.com>
Subject: Re: need help running .pl files with Apache
Message-Id: <8mdga3$2jj6$1@newssvr05-en0.news.prodigy.com>
Do you have a script alias set up? For example:
ScriptAlias /cgi-bin/ "/path/to/cgi-bin/"
in your httpd.conf file will make sure a file accessed in /cgi-bin will
_always_ be executed.
But, this by itself is not enough. You also need:
<Directory "/path/to/cgi-bin/">
AllowOverride None
Options None
</Directory>
Don't forget the / after the path name. If I remember correctly, you
absolutely need this. Hopefully, this is all you need. If you are running
*nix (unfortunately I'm stuck with win32) you should have to set the
appropiate permissions for the directory/files with chmod (I think).
Ryan Tarpine
Christopher Thorjussen <kernel@start.no> wrote in message
news:8mddmn$rio$2@snipp.uninett.no...
> I've got this script i want to run (and I know it works - works fine from
> console).
>
> but I can't seem to get Apache to acknowledge .pl files. I've tried both
> from cgi-bin and from a normal folder. more or less just get the contents
of
> the file displayed to me in pure ascii.
>
> any suggestions?
>
> -Christopher Thorjussen
>
>
------------------------------
Date: Fri, 4 Aug 2000 06:42:28 +0200
From: "Christopher Thorjussen" <kernel@start.no>
Subject: Re: need help running .pl files with Apache
Message-Id: <8mdhbg$s70$1@snipp.uninett.no>
I tried renaming it to .cgi - no luck.
Gonna check my httpd.conf once more for the options Ryan Tarpine mentioned.
-Christopher
"Troy Rasiah" <troyr@vicnet.net.au> wrote in message
news:cWqi5.69068$N4.1898924@ozemail.com.au...
> does it work with a .cgi extension?
>
> --
> --------------------------------------------------------------------------
--
> ----------------
> Troy Rasiah
> Database/Web Developer
> Vicnet
> troyr@vicnet.net.au
> --------------------------------------------------------------------------
--
> ----------------
> "Christopher Thorjussen" <kernel@start.no> wrote in message
> news:8mddmn$rio$2@snipp.uninett.no...
> > I've got this script i want to run (and I know it works - works fine
from
> > console).
> >
> > but I can't seem to get Apache to acknowledge .pl files. I've tried both
> > from cgi-bin and from a normal folder. more or less just get the
contents
> of
> > the file displayed to me in pure ascii.
> >
> > any suggestions?
> >
> > -Christopher Thorjussen
> >
> >
>
>
------------------------------
Date: Fri, 4 Aug 2000 06:52:22 +0200
From: "Christopher Thorjussen" <kernel@start.no>
Subject: Re: need help running .pl files with Apache
Message-Id: <8mdhu3$sb7$1@snipp.uninett.no>
I get a
"Internal Server ErrorThe server encountered an internal error or
misconfiguration and was unable to complete your request.
Please contact the server administrator, joffer@online.no 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."
message :(
I'm starting to think it could be the script that's all fucked up. Cuz i
renamed a counter.cgi script I had to counter.pl and tried to run it through
my webserver, and I didn't get Internal Server Error...
but then again, I've run the script I wanna run from console, so it should
work fine :-/
"Ryan Tarpine" <rtarpine@hotmail.com> wrote in message
news:8mdga3$2jj6$1@newssvr05-en0.news.prodigy.com...
>
> Do you have a script alias set up? For example:
>
> ScriptAlias /cgi-bin/ "/path/to/cgi-bin/"
>
> in your httpd.conf file will make sure a file accessed in /cgi-bin will
> _always_ be executed.
> But, this by itself is not enough. You also need:
>
> <Directory "/path/to/cgi-bin/">
> AllowOverride None
> Options None
> </Directory>
>
> Don't forget the / after the path name. If I remember correctly, you
> absolutely need this. Hopefully, this is all you need. If you are
running
> *nix (unfortunately I'm stuck with win32) you should have to set the
> appropiate permissions for the directory/files with chmod (I think).
>
> Ryan Tarpine
>
> Christopher Thorjussen <kernel@start.no> wrote in message
> news:8mddmn$rio$2@snipp.uninett.no...
> > I've got this script i want to run (and I know it works - works fine
from
> > console).
> >
> > but I can't seem to get Apache to acknowledge .pl files. I've tried both
> > from cgi-bin and from a normal folder. more or less just get the
contents
> of
> > the file displayed to me in pure ascii.
> >
> > any suggestions?
> >
> > -Christopher Thorjussen
> >
> >
>
>
------------------------------
Date: Thu, 03 Aug 2000 21:20:08 -0700
From: ChungpingLi <cplee@bigfoot.com>
Subject: remove blank character
Message-Id: <398A4477.1CE3291A@bigfoot.com>
Hi friend
can anyone tell me how to remove blank character from a string
thanks
Andrea
------------------------------
Date: Fri, 4 Aug 2000 15:23:59 +1000
From: "Troy Rasiah" <troyr@vicnet.net.au>
Subject: Re: remove blank character
Message-Id: <stsi5.69131$N4.1900458@ozemail.com.au>
$variablename=~ s/ //g;
or
$variablename=~ s/ //x;
--
----------------------------------------------------------------------------
----------------
Troy Rasiah
Database/Web Developer
Vicnet
troyr@vicnet.net.au
----------------------------------------------------------------------------
----------------
"ChungpingLi" <cplee@bigfoot.com> wrote in message
news:398A4477.1CE3291A@bigfoot.com...
> Hi friend
> can anyone tell me how to remove blank character from a string
> thanks
> Andrea
>
>
------------------------------
Date: Fri, 4 Aug 2000 15:27:40 +1000
From: "Troy Rasiah" <troyr@vicnet.net.au>
Subject: Re: remove blank character
Message-Id: <Wwsi5.69139$N4.1900510@ozemail.com.au>
yikes outlook express added some crap to it
lemme repost that message in pine
--
----------------------------------------------------------------------------
----------------
Troy Rasiah
Database/Web Developer
Vicnet
troyr@vicnet.net.au
----------------------------------------------------------------------------
----------------
"Troy Rasiah" <troyr@vicnet.net.au> wrote in message
news:stsi5.69131$N4.1900458@ozemail.com.au...
> $variablename=~ s/ file://g;
>
> or
>
> $variablename=~ s/ file://x;
> --
> --------------------------------------------------------------------------
--
> ----------------
> Troy Rasiah
> Database/Web Developer
> Vicnet
> troyr@vicnet.net.au
> --------------------------------------------------------------------------
--
> ----------------
> "ChungpingLi" <cplee@bigfoot.com> wrote in message
> news:398A4477.1CE3291A@bigfoot.com...
> > Hi friend
> > can anyone tell me how to remove blank character from a string
> > thanks
> > Andrea
> >
> >
>
>
------------------------------
Date: Fri, 4 Aug 2000 15:28:39 +1000
From: "Troy Rasiah" <troyr@vicnet.net.au>
Subject: Re: remove blank character
Message-Id: <Qxsi5.69140$N4.1900532@ozemail.com.au>
ahh the "file:" part is not included in the answer
remove it....just oulook express being a bitch
--
----------------------------------------------------------------------------
----------------
Troy Rasiah
Database/Web Developer
Vicnet
troyr@vicnet.net.au
----------------------------------------------------------------------------
----------------
"Troy Rasiah" <troyr@vicnet.net.au> wrote in message
news:stsi5.69131$N4.1900458@ozemail.com.au...
> $variablename=~ s/ file://g;
>
> or
>
> $variablename=~ s/ file://x;
> --
> --------------------------------------------------------------------------
--
> ----------------
> Troy Rasiah
> Database/Web Developer
> Vicnet
> troyr@vicnet.net.au
> --------------------------------------------------------------------------
--
> ----------------
> "ChungpingLi" <cplee@bigfoot.com> wrote in message
> news:398A4477.1CE3291A@bigfoot.com...
> > Hi friend
> > can anyone tell me how to remove blank character from a string
> > thanks
> > Andrea
> >
> >
>
>
------------------------------
Date: Fri, 04 Aug 2000 06:28:00 GMT
From: sandhall@swipnet.se (Robert Hallgren)
Subject: Re: Security (with respect to chmod) - user_create.cgi [0/1]
Message-Id: <slrn8okn9a.153.sandhall@poetry.lipogram>
On 03 Aug 2000 19:24:00 GMT, bean <bean@agentkhaki.com> wrote:
[...]
> Here's what I'm having "issues" with:
>
> sub make_userdbm {
>
> $mode = "0666";
>
> dbmopen (%temp, $username, oct($mode))";
>
> dbmclose (%temp);
>
> system "chmod $mode $username.*";
Don't see why you would want to use a system-call at all. If the files
created has the wrong permissions, have a look at 'perldoc -f umask'.
In any case, you should never have to use a system-call to change
permissions on a file. Have a look at 'perldoc -f chmod' to see what
the built-in function 'chmod' can do for you.
Robert
--
Robert Hallgren <sandhall@swipnet.se>
PGP: http://www.lipogram.com/pgpkey.asc
5F1E 95C2 F0D8 25A3 D1BE 0F16 D426 34BD 166A 566C
------------------------------
Date: 4 Aug 2000 05:06:54 GMT
From: jgamble@ripco.com (John M. Gamble)
Subject: semijoin() - a better way?
Message-Id: <8mdj1e$rec$1@gail.ripco.com>
"There's more than one way to do it." But i have an oft-used
function that i feel could be better. It is named semijoin(),
and it joins groups of items in a list together, creating a new
list. It gets used a lot in our scripts that handle database lists.
I'm pretty sure that it could be improved - i'm using array slices
and a loop, which can't be the fastest way.
So... any suggestions?
=item semijoin()
@newlist = semijoin($expr, $itemcount, @list);
$expr - A string to be used in a join() call.
$itemcount - The number of items in a list to be joined.
It may be negative.
@list - The list
Create a new list by performing a join on I<$itemcount> elements at a
time on the original list. Any leftover elements from the end of the
list become the last item of the new list, unless I<$itemcount> is
negative, in which case the first item of the new list is made from the
leftover elements from the front of the list.
=back
=cut
sub semijoin($$@)
{
my($jstr, $itemcount, @oldlist) = @_;
my($idx);
my(@newlist) = ();
return @oldlist if ($itemcount <= 1 and $itemcount >= -1);
if ($itemcount > 0)
{
my($range) = $itemcount - 1;
my($lim) = $#oldlist - $range;
for ($idx = 0; $idx < $lim; $idx += $itemcount)
{
push(@newlist, join($jstr, @oldlist[$idx..$idx+$range]));
}
if ($idx < @oldlist)
{
push(@newlist, join($jstr, @oldlist[$idx..$#oldlist]));
}
}
else
{
my($range) = $itemcount + 1;
my($lim) = 0 - $range;
for ($idx = $#oldlist; $idx > $lim; $idx += $itemcount)
{
unshift(@newlist, join($jstr, @oldlist[$idx+$range..$idx]));
}
if ($idx >= 0)
{
unshift(@newlist, join($jstr, @oldlist[0..$idx]));
}
}
return @newlist;
}
--
-john
February 28 1997: Last day libraries could order catalogue cards
from the Library of Congress.
--
Pursuant to US Code, Title 47, Chapter 5, Subchapter II, '227,
any and all unsolicited commercial E-mail sent to this address
is subject to a download and archival fee in the amount of $500
US. E-mailing denotes acceptance of these terms.
------------------------------
Date: Fri, 4 Aug 2000 15:10:36 +1000
From: "Robert Chalmers" <robert@chalmers.com.au>
Subject: time output not showing leading 0's ? How do I...
Message-Id: <4bsi5.94$G7.10319@nsw.nnrp.telstra.net>
The follwing code, produces the time fine, but the first printout drops the
leading 0 from the minute display?
like this. So how do I convince it to display it as 15:01, and
not 15:1 ??????
thanks
Bob
............................................................................
..........
Sydney Friday-15:1
And the fully formatted version - Time is Fri Aug 4 15:01:41 2000
............................................................................
...........
#!/usr/bin/perl
use CGI qw(:all);
$tz = 10;
#my $tz = param('tz') || "Timezone Not Specified";
$timehere = scalar(gmtime($tz * 3600 + time));
#................................................
#======================================================
@MoY =
('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
@DoW =
('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($tz * 3600 +
time);
$year += 1900;
$Month = $MoY[$mon];
$Day = $DoW[$wday];
$TimeString = "$Day-$hour:$min";
# ==========================================================================
print "Content-type: text/plain\n\n";
print " $TimeString\n";
print "<br>And the fully formatted version - Time is $timehere<br>\n";
#
===========================================================================
~
------------------------------
Date: Fri, 04 Aug 2000 15:32:40 +1000
From: bigiain@mightymedia.com.au (Iain Chalmers)
Subject: Re: time output not showing leading 0's ? How do I...
Message-Id: <bigiain-0408001532400001@bigman.mighty.com.au>
In article <4bsi5.94$G7.10319@nsw.nnrp.telstra.net>, "Robert Chalmers"
<robert@chalmers.com.au> wrote:
>The follwing code, produces the time fine, but the first printout drops the
>leading 0 from the minute display?
>like this. So how do I convince it to display it as 15:01, and
>not 15:1 ??????
perldoc -f sprintf
>$TimeString = "$Day-$hour:$min";
change that to:
$TimeString=sprintf "%s-%02d:%02d",($Day,$hour,$min);
cheers
Iain
------------------------------
Date: 4 Aug 2000 05:31:40 GMT
From: The WebDragon <nospam@nospam.com>
Subject: using perl to fetch finger .plan information
Message-Id: <8mdkfs$it0$0@216.155.32.51>
I've been fiddling around with Net::Finger, but it seems to me there
could be something a little more robust out there (just my impression)
from my desktop I have to re-try the basic script more than several
times in order to get a reply from the fingered server.. seems like the
socket just doesn't connect readily enough for some weird reason.
can anyone point me to some alternative module methods of getting a
finger from a non-unix platform (that will also work on a unix box)
without just simply doing a `finger $address` ?
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Thu, 03 Aug 2000 23:13:29 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: using perl to fetch finger .plan information
Message-Id: <398A5F09.569AE765@stomp.stomp.tokyo>
The WebDragon wrote:
> I've been fiddling around with Net::Finger, but it seems
> to me there could be something a little more robust out
> there (just my impression)
(snipped)
You know better than this, Mr. Dragon. Almost all finger
connections have been shut down. There may be a handful
still operating here and there. Nevertheless, you know
as well as I do, finger is past history or quickly on
the way to becoming past history, because of all the
serious abuse of this feature, namely invasion of privacy
and criminal internet / real life stalking, of which our
family was victimized for several years, as you equally
well know.
* thinks of a well publicized set of restraining orders *
This isn't the good old ancient days when internet users
could be trusted. Those days are long gone. Our internet
is now Criminal City and there ain't no Batman and Robin.
Only two fingers left now; middle and trigger.
Godzilla!
--
print "http://mailto:%63%61ll%67i%72l@3483852801/%7e%63%61ll%67i%72l";
------------------------------
Date: 4 Aug 2000 01:29:37 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: using perl to fetch finger .plan information
Message-Id: <8mdnsh$jpj$1@provolone.cs.utexas.edu>
In article <8mdkfs$it0$0@216.155.32.51>,
The WebDragon <nospam@nospam.com> wrote:
>I've been fiddling around with Net::Finger, but it seems to me there
>could be something a little more robust out there (just my impression)
>
>from my desktop I have to re-try the basic script more than several
>times in order to get a reply from the fingered server.. seems like the
>socket just doesn't connect readily enough for some weird reason.
>
>can anyone point me to some alternative module methods of getting a
>finger from a non-unix platform (that will also work on a unix box)
>without just simply doing a `finger $address` ?
You could use IO::Socket::INET. The finger protocol is *really*
simple. You just connect up and send a username followed by a newline,
and then the server sends the data back and closes the connection when
it's done. For the more verbose version, give a '\W' and a space
before the username. (That's a literal backslash and capital "w".)
Try fingering root on your local machine by doing this:
$ telnet localhost finger
/W root
Anyway, if you want more information about the finger protocol, it's in
RFC 1288.
Hope that helps.
- Logan
------------------------------
Date: Fri, 04 Aug 2000 04:45:19 GMT
From: eastking@my-deja.com
Subject: what mod-perl want me do
Message-Id: <8mdhov$15f$1@nnrp1.deja.com>
hello, everyone here.
I am using mod-perl to develop CGI application.
But I meet a problem about mod-perl.
please help me, thanks in advance.
I have a script like following
testshare.pl
#!/usr/bin/perl
use strict;
use CGI;
my($query);
pInit();
print $query->header;
print " this is a test";
sub pInit(){
$query = new CGI;
}
# it is the end of this file
When I run it under normal perl environment, it worked well.
But when run it under mode-perl for serveral times, it said that
I used uninitialized value of $query.
So, I change the "my($query)" to "use var qw($query)" like following
testshare.pl
#!/usr/bin/perl
use strict;
use CGI;
my($query);
pInit();
print $query->header;
print " this is a test";
sub pInit(){
$query = new CGI;
}
# it is the end of this file
It did work.But the query is always there, just like "Static" in
function.
So, I change it to following
testshare.pl
#!/usr/bin/perl
use strict;
use CGI;
local($query);
pInit();
print $query->header;
print " this is a test";
sub pInit(){
$query = new CGI;
}
# it is the end of this file
It said that local can not be used under strict.
It seemed that there is no good solution. So I change it one time more
to following
testshare.pl
#!/usr/bin/perl
use strict;
use CGI;
my ($query);
$query = pInit();
print $query->header;
print " this is a test";
sub pInit(){
return new CGI;
}
# it is the end of this file
Yes , it worked. But, So many global variable I have used ,I can not
always use
return value to pass it from function to caller.
also, I can use following
#!/usr/bin/perl
use CGI;
local($query);
use strict;
use var qw($query);
pInit();
print $query->header;
print " this is a test";
sub pInit(){
$query = new CGI;
}
# it is the end of this file
Yes,It workd too.But I do not know is there another problem with it.
Also, I do not know why it work.
So, please help me. Thanks a lot.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 03 Aug 2000 23:21:27 -0500
From: Dennis @notmyrealaddress.com
Subject: Why won't $ua->credentials($URL,$realm,$uname,$pword) work on a web site?
Message-Id: <78gkoso3aje4smlm1ho7kvmm7n7bpi8t25@4ax.com>
I'm trying to access a web site that requires a login username and password.
A snippet of my code is:
my $ua = new LWP::UserAgent;
$ua->agent("Mozilla/3.0");
$req = new HTTP::Request ('GET' , $URL);
my $realm = 'Username and Password Required';
$ua->credentials($URL,$realm,$username,$password);
$content = $ua->request($req)->as_string;
print OUTFILE $content;
In a Web browser when the URL is accessed, a window pops up with the title
'Username and Password Required' and 2 entry boxes below for the username and
password. Below the entry boxes are OK and Cancel buttons.
$content contains the following error message
HTTP/1.1 401 Unauthorized
Connection: close
Date: Thu, 03 Aug 2000 23:25:38 GMT
Via: 1.1 sgmn-pxy4
Server: Microsoft-IIS/4.0
WWW-Authenticate: Basic realm="Members Only - Press Cancel for Information"
Content-Length: 98
Content-Type: text/html
Client-Date: Thu, 03 Aug 2000 23:24:46 GMT
Client-Peer: 216.52.71.10:80
Refresh: 0;URL=../signup.asp
ZZZ-Authenticate: NTLM
<HTML><HEAD><META HTTP-EQUIV="Refresh"
CONTENT="0;URL=../signup.asp"></HEAD><BODY></BODY></HTML>
I checked the perldoc's, Perl Cookbook, Perl in a Nutshell but no answers or
examples were forthcoming.
What am I doing wrong?
TIA for any help.
Dennis Meyers
dennisATmeyersanalytics.com
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3910
**************************************