[9436] in Perl-Users-Digest
Perl-Users Digest, Issue: 3031 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 30 17:07:15 1998
Date: Tue, 30 Jun 98 14:00:29 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 30 Jun 1998 Volume: 8 Number: 3031
Today's topics:
$DB::alias question (Kin Cho)
ABOR Problem with FTP Script <jwade1@iumc.iupui.edu>
Re: Arrays (Larry Rosler)
Re: Couple of quick ?'s from perl newbie <jason.holland@dial.pipex.com>
Re: Help me write a CGI Perl file <rootbeer@teleport.com>
Help needed! <k150556@assari.cc.tut.fi>
Help: perl5.00404 and UnixWare 2.1.2 (locale problem) <dlgolden@ibm.net>
Re: how to flush network connections <jason.holland@dial.pipex.com>
i've got a forking problem (Dan Perez)
Re: i've got a forking problem <rootbeer@teleport.com>
Re: i've got a forking problem <tchrist@mox.perl.com>
Re: making my string lowercase <jason.holland@dial.pipex.com>
Re: making my string lowercase (Matt Knecht)
PL/SQL by perl (j.k.)
Re: problems with script (Matt Knecht)
Registration Discount Expires in 4 Days for Perl Conf 2 lisam@oreilly.com
rename() not working ...any ideas? <gjholden@cbe.ab.ca>
Re: Scripts run by Apache can't find Mods <jason.holland@dial.pipex.com>
Re: Scripts run by Apache can't find Mods <jason.holland@dial.pipex.com>
Re: Sorting values usings arrays (Larry Rosler)
timelocal function in 2000 <darren.blair@csfb.com>
What is wrong with this script? sprigen687@pop.dnvr.uswest.net
Re: What is wrong with this script? (Kelly Hirano)
Re: What is wrong with this script? <rootbeer@teleport.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 Jun 1998 12:28:09 -0700
From: kin@c-cube.com (Kin Cho)
Subject: $DB::alias question
Message-Id: <cohemw6bsfq.fsf@omni.c-cube.com>
I tried to set up an alias in the Perl debugger to compensate
for the `X' command's lack of support for $_, @_, etc...
My idea is to assign $_, @_, etc... to a named variable,
then print out the variable with X.
This is my attempt:
$DB::alias{'XX'} = 's/^XX (.*)$/$qqzz=$1;X $qqzz;/';
When I tried to use it like this "XX $_", I got this error:
Can't call method "XX" without a package or object reference at (eval 4) line 2, <IN> chunk 3.
Anybody got any hints?
Thanks.
-kin
X [symbols] Same as as "V" command, but within the current
package.
------------------------------
Date: Tue, 30 Jun 1998 15:52:13 -0400
From: Joe Wade <jwade1@iumc.iupui.edu>
Subject: ABOR Problem with FTP Script
Message-Id: <359941ED.3607@iumc.iupui.edu>
Greetings:
In attempting to solve a problem I'm having with a Perl FTP script, I
have searched the Usenet for pertinent articles as well as reading the
perldocs regarding Net::FTP and perlfaqs, perlfaq9 in particular.
Unfortunately, I haven't found any documentation that enlightens me as
to why the following ftp script works correctly (that is, transfers the
file completely) when sending to our Stratus computer running the VOS
operating system but leaves the last 2-3 (carriage return, newline
delimited) records off files sent to a VMS-based machine.
The debugging output seems to suggest that the file transfers completely
to the Stratus because the ABOR command is unimplemented on the Stratus
ftp server but *is* implemented on the VMS machine's ftp server. While
I'm curious as to why the ABOR is sent at all, my overriding concern is
how I can get my Perl script to send the complete file to the VMS
machine.
Thanks in advance for any help you may offer.
Joe Wade
LIS Software Engineer
Indiana University Medical Center
Indianapolis
e-mail: jwade1@iupui.edu
#!/usr/local/bin/perl
use Net::FTP;
$fname = "";
$put_file = "myfile";
$host = "stratus";
if ($host eq "stratus") {
$login = "me";
$passwd = "pwd";
$dir = "scratch_files";
}
else {
$login = "me";
$passwd = "pwd";
$dir = "";
}
print "Opening connection to $host FTP server\n";
$ftp = Net::FTP->new($host)
or die "Can't open $host FTP server!\n";
$debug_level = $ftp->debug(1);
print "previous debug level = $debug_level\n";
$debug_level = $ftp->debug();
print "current debug level = $debug_level\n";
print "Logging on to $host FTP server\n";
$ftp->login($login, $passwd)
or die "Can't log in to $host FTP server!\n";
if ($dir ne "") {
print "Changing to directory $dir\n";
$ftp->cwd($dir)
or die "Can't change to directory $dir\n";
}
$fsize = $ftp->size($fname);
print "size of $fname = $fsize\n";
print "Putting file $put_file\n";
($sec,$min,$hour,$mday,$mon,$year) = localtime(time);
++$mon; # since mon is an array subscript ranging from 0 to 11
printf "Put start: %02d-%02d-%02d %02d:%02d:%02d\n",
$year,$mon,$mday,$hour,$min,$sec;
$ftp->put($put_file)
or die "Can't put file $put_file\n";
($sec,$min,$hour,$mday,$mon,$year) = localtime(time);
++$mon; # since mon is an array subscript ranging from 0 to 11
printf "Put stop : %02d-%02d-%02d %02d:%02d:%02d\n",
$year,$mon,$mday,$hour,$min,$sec;
print "Successful putting file $put_file to $host\n";
Debug info from put to Stratus:
Net::FTP: Net::FTP(2.27)
Net::FTP: Exporter
Net::FTP: Net::Cmd(2.09)
Net::FTP: IO::Socket::INET
Net::FTP: IO::Socket(1.1602)
Net::FTP: IO::Handle(1.1504)
Net::FTP=GLOB(0x82004f4)>>> user me
Net::FTP=GLOB(0x82004f4)<<< 331 Password required for me.
Net::FTP=GLOB(0x82004f4)>>> PASS ....
Net::FTP=GLOB(0x82004f4)<<< 230 User me logged in.
Net::FTP=GLOB(0x82004f4)>>> CWD scratch_files
Net::FTP=GLOB(0x82004f4)<<< 251 "%chc_iu#d01>iu_lab>scratch_files" is
current directory.
Net::FTP=GLOB(0x82004f4)>>> SIZE
Net::FTP=GLOB(0x82004f4)<<< 500 Command not understood.
Net::FTP=GLOB(0x82004f4)>>> PORT nnn,n,nnn,nnn,nnn,nnn
Net::FTP=GLOB(0x82004f4)<<< 200 PORT command ok.
Net::FTP=GLOB(0x82004f4)>>> STOR myfile
Net::FTP=GLOB(0x82004f4)<<< 150 Opening data connection for myfile
(nnn.n.nnn.nnn,nnnnn).
Net::FTP=GLOB(0x82004f4)>>> ABOR
Net::FTP=GLOB(0x82004f4)<<< 226 Transfer complete.
Net::FTP=GLOB(0x82004f4)<<< 502 ABOR command not implemented.
Net::FTP=GLOB(0x82004f4)>>> QUIT
Net::FTP=GLOB(0x82004f4)<<< 221 Goodbye.
Debug info from put to VMS machine:
Net::FTP: Net::FTP(2.27)
Net::FTP: Exporter
Net::FTP: Net::Cmd(2.09)
Net::FTP: IO::Socket::INET
Net::FTP: IO::Socket(1.1602)
Net::FTP: IO::Handle(1.1504)
Net::FTP=GLOB(0x82004f4)>>> user me
Net::FTP=GLOB(0x82004f4)<<< 331 Username ME requires a Password.
Net::FTP=GLOB(0x82004f4)>>> PASS ....
Net::FTP=GLOB(0x82004f4)<<< 230 User logged in.
Net::FTP=GLOB(0x82004f4)>>> SIZE
Net::FTP=GLOB(0x82004f4)<<< 502 SIZE is unimplemented.
Net::FTP=GLOB(0x82004f4)>>> PORT nnn,n,nnn,nnn,nnn,nnn
Net::FTP=GLOB(0x82004f4)<<< 200 PORT command successful.
Net::FTP=GLOB(0x82004f4)>>> STOR myfile
Net::FTP=GLOB(0x82004f4)<<< 150 Opening data connection for myfile
(nnn.n.nnn.nnn,nnnnn)
Net::FTP=GLOB(0x82004f4)>>> ABOR
Net::FTP=GLOB(0x82004f4)<<< 225 ABOR Command successful.
Net::FTP=GLOB(0x82004f4)<<< 426 Transfer aborted.
Net::FTP=GLOB(0x82004f4)>>> QUIT
Net::FTP=GLOB(0x82004f4)<<< 221 Goodbye.
------------------------------
Date: Tue, 30 Jun 1998 13:23:18 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Arrays
Message-Id: <MPG.1002e9121c88783b9896da@nntp.hpl.hp.com>
In article <35993f23.22379593@news.bigsky.net> on Tue, 30 Jun 1998
19:42:54 GMT, Keith L. Miller <miller@bigsky.net> says...
> I have an array, lets say:
>
> @ports=(15,17);
>
> now, I want to be able to compare every element of the array in an if
> statement such asL
>
> if ($test eq "temp" && $test2 == ??????){
>
>
> Now, what do I put where the ?'s are so that it will make the
> comparison to every element in tie @ports array?
Read perlfaq4: "How can I tell whether an array contains a certain
element?"
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 30 Jun 1998 21:31:41 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
To: cia1@ix.netcom.com
Subject: Re: Couple of quick ?'s from perl newbie
Message-Id: <3599593D.87A574C2@dial.pipex.com>
cia1@ix.netcom.com wrote:
>
> Thanks in advance to any who can help!
>
> The following is a piece of code from my first ever script that appends to a
> file some form info:
>
> open (DB, ">>data.txt");
> print DB "$FORM{'name'}|$FORM{'email'}|$FORM{'phone'}|$FORM{'room'}|
> $FORM{'month'}|$FORM{'day'}|$FORM{'year'}|$FORM{'from'}|$FORM{'ampm'}|
> $FORM{'to'}|$FORM{'ampm2'}\n";
> close(DB);
>
> It seems to work o.k.. When I open data.text it looks fine:
>
> John Rodriguez|jrod@mail.com|333-3333|room1|Jul|5|1998|9|AM|10|AM
> Jack Smith|dk@fdk.com|123-4565|room2|Aug|1|1998|10|AM|11|AM
>
> When I try to read the file I'm having trouble splitting them into scalers and
> printing the scalers.
>
> I've tried:
>
> open (DB, "data.txt");
> while <DB> {
> ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)=split(/|/);
> print "$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11";
> }
> close <DB>;
Hello,
This is just a quick guess, but scalar variables named $n are usually
special variables containing the last successful pattern match.
You may be having trouble using this variable names in a 'normal'
context. Try using different variable names, or an array or something.
Bye!
--
____ __
/ /\ \ / / \ ##### # # # # # #
/ / \ \/ \__ $ $ $ $$ $ $ $
/ /----\ / \ !!! ! ! ! ! ! !!
___/ / \ / / : : : : :: : :
_______________________/ . ... . . . .
$fJunction = $objectCGI->decodeChars( "%4A%75%6E%63%74%69%6F%6E" );
e-mail -> jason.holland@dial.pipex.com
JaysFunkJunction -> http://dspace.dial.pipex.com/jason.holland/
package Jason;
sub new {
my $class = shift;
my $object = {};
$object->{TALENTS}->{Perl5.0} = "Programmer";
$object->{TALENTS}->{JavaScript} = "Getting There !"
$object->{TALENTS}->{HTML} = "Author";
$object->{TALENTS}->{UNIX_LINUX} = "Advanced User";
$object->{TALENTS}->{MACINTOSH} = ( "Guru", "Photoshop" );
bless( $object, $class );
return( $object );
}
------------------------------
Date: Tue, 30 Jun 1998 20:37:56 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Help me write a CGI Perl file
Message-Id: <Pine.GSO.3.96.980630133405.15737J-100000@user2.teleport.com>
On Tue, 30 Jun 1998 kjernigan@geocities.com wrote:
> Subject: Help me write a CGI Perl file
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> I am trying to write a perl program that will be an administration
> program for my Guestbook, if someone here would like to help me, please
> e-mail me to make it easier.
If you want private tutoring and guidance, many of us could quote you a
rate. Is that what you're asking for?
> Oh, the script is my modified version of Matt's Guestbook!
How did you modify it? Did you take out the bugs? Or only the major
bugs? :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 30 Jun 1998 20:43:06 GMT
From: Antti-Jussi Korjonen <k150556@assari.cc.tut.fi>
Subject: Help needed!
Message-Id: <6nbikq$cj3$1@baker.cc.tut.fi>
HI!
I've made a browser driven configuration program with perl. I'm using
Netscape 4.05. The program accesses the resource by issuing command: pad +
command port number. Every time something is done it reconnects.
One way to prevent other users accessing the same pad as I is to make a
lock file, right?
But then, the pad can be accessed just simply telnetting the same computer
and doing it all by hand. And now my program has no idea that somebody
else is already accessing the pad I'm trying to connect to.
One way would be keeping the pad busy when not accessing it with my
program. Then there would have to be some way to log out i.e. stop keeping
the pad busy. There would also have to be a timer running in case the user
forgets to log out.
-> I download the configuration with the program, it disconnects and the
other program keeps the pad busy until I'm ready to upload my changes..
Any ideas how to do this?
Or any better ideas?
--
__/ __/ __/ __/ Antti-Jussi Korjonen
__/ __/ __/ __/ __/__/ Vaajakatu 5 D 85
__/ __/ __/ __/ __/__/ 33720 TAMPERE, FINLAND
__/ __/ __/__/__/ __/ __/ tel. +358-(0)40-577 83 23
Antti-Jussi.Korjonen@sonera.fi
--------->> http://www.students.tut.fi/~k150556 <<---------
------------------------------
Date: Tue, 30 Jun 1998 15:36:56 -0500
From: Dennis Golden <dlgolden@ibm.net>
Subject: Help: perl5.00404 and UnixWare 2.1.2 (locale problem)
Message-Id: <35994C68.5503@ibm.net>
This is a multi-part message in MIME format.
--------------15E27EEC7922
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
I posted the following to comp.unix.unixware.misc, and as yet have not
received any responses. I thought possibly someone on this group might
have some idea where I might look.
I am having problems with subject environment. I have an lp filter
written in perl, and since going to 5.00404, it no longer works. I
have stripped it down to a bare minimum (just write to stderr), and
it works fine from the command line but failes from the spooler. All
I have now in the script is commands to dump the environment and issue
the locale command.
Any hints will be greatly appriciated.
Regards,
Dennis
--------------15E27EEC7922
Content-Type: text/plain; charset=us-ascii; name="perl.prob"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="perl.prob"
When I envoke "/home/golden/newppfilter/prop.filter </home/golden/newppfilter/hello.ps"
I receive the following output (no locale complaints from perl):
ENV=//.kshrc
FCEDIT=vi
HOME=/
HZ=100
KSHRC=//.kshrc
LANG=C
LOGNAME=root
MANPATH=/usr/share/man:/usr/local/man
PAGER=/usr/local/bin/less
PATH=/sbin:/usr/sbin:/usr/bin:/etc:/usr/ccs/bin:/usr/ccs/bin:/usr/merge/dosroot/ubin:/usr/local/bin:/usr/ucb:/opt/wp6/wpbin
PWD=/
SHELL=/u95/bin/sh
TERM=mitxterm
TFADMIN=
TIMEOUT=0
TZ=:US/Central
VISUAL=vi
WPBIN=/opt/wp6/wpbin
_=/sbin/su
_TTYNAME=/dev/pts002
Locale info follows:
LANG=C
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
=======================================================================
However, when I use "lp -T prop /home/golden/newppfilter/hello.ps"
I receive the following error in the mail that perl is complaining
about the locale (or lack therof):
>From lp Sun Jun 28 18:26 CDT 1998
Return-path: <lp>
Date: Sun, 28 Jun 98 18:26 CDT
From: lp@goldens.private
Subject: Status of lp request ibmpp-171
Status: R
Content-Length: 863
Your request ibmpp-171 destined for ibmpp
encountered an error during filtering.
Reason for failure:
perl: warning: Setting locale failed.
Content-Length: 374
Content-Type: text/plain
Message-ID: <3596d10d0.184d@goldens.private>
To: goldens!golden
perl: warning: Please check that your locale settings:
LC_ALL = (unset),
LC_MESSAGES = "/etc/inst/locale/C",
LANG = "C"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
CAT=uxrc
FILTER=/home/golden/newppfilter/prop.filter
LANG=C
LC_MESSAGES=/etc/inst/locale/C
PATH=/sbin:/usr/sbin:/etc:/usr/bin
SPOOLER_KEY=59339831
TFADMIN=
TIMEOUT=0
TZ=:US/Central
_AUTOBOOT=true
_CURR_NTIMES=0
_CURR_RL=3
_PREV_RL=S
Locale info follows:
LANG=C
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES=/etc/inst/locale/C
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
=======================================================================
This is the perl script stripped down to dumping to stderr:
#!/usr/local/bin/perl -w
foreach( sort( keys(%ENV))) {
print STDERR "$_=$ENV{$_}\n";
}
print STDERR "\nLocale info follows:\n";
print STDERR `locale`;
--------------15E27EEC7922--
------------------------------
Date: Tue, 30 Jun 1998 21:35:47 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
To: Delian Delchev <delian@ntrl.net>
Subject: Re: how to flush network connections
Message-Id: <35995A33.2B1C389B@dial.pipex.com>
Delian Delchev wrote:
>
> I write a perl script that makes tcp connection to port 25. I need to
> flush all data that is in stream queue, because mail server not respont,
> and then timeout and close connection. How I can flush file descriptor?
>
> --
> Delian Delchev http://www.naturella.com/~delian
> ____ ____ __ ____ _ _ ____ __ __
> / ) / ) / / ) / / / ) / /
> / / /___ / / /___ / /___ / /
> / / / / / / / / / /
> /____/ (____/ /____) (____/ _/ /_ (____/ \___/
Hello,
Off the top of my head, I remember that there's a special variable that
can be set to cause file buffers to flush immediately, data is not
buffered.
On the other hand, I usually send an 'empty' string down a socket to
flush it, likes this:
print( SOCKET_HANDLE "" );
it seems to work fine for me.
Bye!
--
____ __
/ /\ \ / / \ ##### # # # # # #
/ / \ \/ \__ $ $ $ $$ $ $ $
/ /----\ / \ !!! ! ! ! ! ! !!
___/ / \ / / : : : : :: : :
_______________________/ . ... . . . .
$fJunction = $objectCGI->decodeChars( "%4A%75%6E%63%74%69%6F%6E" );
e-mail -> jason.holland@dial.pipex.com
JaysFunkJunction -> http://dspace.dial.pipex.com/jason.holland/
package Jason;
sub new {
my $class = shift;
my $object = {};
$object->{TALENTS}->{Perl5.0} = "Programmer";
$object->{TALENTS}->{JavaScript} = "Getting There !"
$object->{TALENTS}->{HTML} = "Author";
$object->{TALENTS}->{UNIX_LINUX} = "Advanced User";
$object->{TALENTS}->{MACINTOSH} = ( "Guru", "Photoshop" );
bless( $object, $class );
return( $object );
}
------------------------------
Date: 30 Jun 1998 20:19:43 GMT
From: dperez@blue.seas.upenn.edu (Dan Perez)
Subject: i've got a forking problem
Message-Id: <6nbh8v$fih$1@netnews.upenn.edu>
Ok, here is what I want to do.
The script reads through a file and, for every line in the file, it
forks off a process. The parent then reads the next line, forks
again, etc. The child processes should be doing all the work,
so that all of the actions happen in parallel.
Here is the script that I have:
#!/pkg/bin/perl5
open(F, "./test");
while (<F>) {
fork && next;
print;
exit;
}
close(F);
Very straightforward, right? Open the test file which has three
lines. "1" on the first line, "2" on the next, "3" on the last line.
Read through the file, forking off a process at each line so that the
child can print out the line and exit.
I (and my coworkers) want to know why this doesn't work as it should.
Thank you,
Dan
------------------------------
Date: Tue, 30 Jun 1998 20:40:25 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: i've got a forking problem
Message-Id: <Pine.GSO.3.96.980630133842.15737K-100000@user2.teleport.com>
On 30 Jun 1998, Dan Perez wrote:
> open(F, "./test");
Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
> while (<F>) {
> fork && next;
If you will fork more than N child processes in a short time span, you
should check the return value from fork to be sure that it succeeded. The
value of N differs depending on the programmer. For me, N=1. :-)
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 30 Jun 1998 20:54:27 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: i've got a forking problem
Message-Id: <6nbja3$qs7$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
dperez@blue.seas.upenn.edu (Dan Perez) writes:
: while (<F>) {
: fork && next;
: print;
: exit;
: }
You're duplicating stdio buffers. Tsk.
--tom
--
: There may be 2 or three ways to perform a particular task, but there will
: not be 10,000 as there are in perl.
I think you may be exaggerating slightly. Perl isn't that good yet.
-- Larry Wall, 5 Jun 91 5:11:004GMT
------------------------------
Date: Tue, 30 Jun 1998 21:13:28 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
To: - <blockmar@nxs.se>
Subject: Re: making my string lowercase
Message-Id: <359954F8.A3213EB@dial.pipex.com>
- wrote:
>
> Could anyone tell me how to make a skring of UPPERCASE or MiXed-caSE
> chars into a lowercase string?
>
> Thanks
>
> /Blockmar
Hello
try this:
my $string = "HELLO";
$string =~ tr/[A-Z]/[a-z]/;
Bye!
--
____ __
/ /\ \ / / \ ##### # # # # # #
/ / \ \/ \__ $ $ $ $$ $ $ $
/ /----\ / \ !!! ! ! ! ! ! !!
___/ / \ / / : : : : :: : :
_______________________/ . ... . . . .
$fJunction = $objectCGI->decodeChars( "%4A%75%6E%63%74%69%6F%6E" );
e-mail -> jason.holland@dial.pipex.com
JaysFunkJunction -> http://dspace.dial.pipex.com/jason.holland/
package Jason;
sub new {
my $class = shift;
my $object = {};
$object->{TALENTS}->{Perl5.0} = "Programmer";
$object->{TALENTS}->{JavaScript} = "Getting There !"
$object->{TALENTS}->{HTML} = "Author";
$object->{TALENTS}->{UNIX_LINUX} = "Advanced User";
$object->{TALENTS}->{MACINTOSH} = ( "Guru", "Photoshop" );
bless( $object, $class );
return( $object );
}
------------------------------
Date: Tue, 30 Jun 1998 20:35:31 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: making my string lowercase
Message-Id: <n_bm1.8$Ve.550493@news2.voicenet.com>
Jason Holland <jason.holland@dial.pipex.com> wrote:
> $string =~ tr/[A-Z]/[a-z]/;
Perhaps you mean: tr[A-Z][a-z] instead of tr/[A-Z]/[a-z]/? Unless of
course you want to substitue a [ for a [ and a ] for a ]. perlop
explains this.
>--
I usually don't do this, but, is a 24 line sig _really_ nessacery? Oh
well.. at least it was cutlined nicely.
--
Matt Knecht - <hex@voicenet.com>
"496620796F752063616E207265616420746869732C20796F7520686176652066
617220746F6F206D7563682074696D65206F6E20796F75722068616E6473210F"
------------------------------
Date: 30 Jun 1998 17:33:22 GMT
From: lien@cs.umb.edu (j.k.)
Subject: PL/SQL by perl
Message-Id: <6nb7h2$mcd$1@news.res.ray.com>
How to pass parameters into it? please help
.......
my $tt = q{
How to pass parameters into it? please help
.......
my $tt = q{
CREATE OR REPLACE PACKAGE TT AS
PROCEDURE TO ( rc IN VARCHAR2,
pp IN ALL_USERS.Users%TYPE );
END TT;
/
CREATE OR REPLACE PACKAGE BODY TT AS
PROCEDURE TO ( rc IN VARCHAR2,
pp IN ALL_USERS.Users%TYPE )
AS
.........
.........
.........
};
.........
.........
$csr = $db->prepare(q{
BEGIN
TT.TO('$opt_pp','$opt_rc');
# It alwayse fail
#here, it couldn't accept parameters
END;
});
------------------------------
Date: Tue, 30 Jun 1998 20:09:03 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: problems with script
Message-Id: <zBbm1.5$Ve.544712@news2.voicenet.com>
Abigail <abigail@fnx.com> wrote:
>++ Long before that, hopefully! I can't remember where I read it, but a
>++ very good book about C says something to the effect of: "You need only
>++ remember one rule of precedence. Multiplication and division come
>++ before addition and subtraction. Any else, use parentheses." Of
>++ course, in C you don't have to worry about the precedence of '='.
>
>So, you state a rule, directly followed by an exeption.
It was a book on C, speaking of things C. Of course there will be
exceptions when this is applied to Perl!
>What about $foo = $bar [3] + 3; ? Another exception?
I had to run a quick test to make sure this did what I think it would
do. This sort of construct is right up there with saying [x]4 in C when
you should be writing x[4]. Good for obfuscation, and little else.
> $foo = $$bar + 3; ? Yet another exception?
> /bar/ || /foo/; ? Parens here??
Again, the rule was orginally applied to C. Of course it's not going to
fit perfectly in Perl. But, yes, those are good exceptions.
>++ I think this style is a Good Thing(tm):
>++
>++ if (!((($a < $b) && ($c > $d)) || $f))
>
>Not to me, as it starts all kinds of bells and whistle that
>something special is going on. But there isn't.
Hmmm. Parentheses mean something special is going on? Please
explain/demonstrate. I don't understand.
>unless ($a < $b && $c > $d || $f) { ... }
This makes me reach for a precedence chart to double check. It also
gives me headaches when I have to add and remove conditions to a
particularly long conditional. I find myself going over the entire
expression, AGAIN, when I change anything. With parentheses it's a very
simple matter to drop in and remove pieces (Not to mention the '%'
command in vi, for removing or copying parts).
>Less noisy
Yes, this is true. I often find myself fighting the excessive punctuation
syndrome when I write Perl. I think it's a battle I'm _slowly_ winning.
>and clear.
That's debatable. :)
--
Matt Knecht - <hex@voicenet.com>
"496620796F752063616E207265616420746869732C20796F7520686176652066
617220746F6F206D7563682074696D65206F6E20796F75722068616E6473210F"
------------------------------
Date: Tue, 30 Jun 1998 11:57:05 -0700
From: lisam@oreilly.com
Subject: Registration Discount Expires in 4 Days for Perl Conf 2.0
Message-Id: <35993501.7734@oreilly.com>
If you haven't taken a look at your calendar today, it's June 30.
Which means that you have only 4 days to take advantage
of the July 3 early bird discount deadline for the Perl
Conference 2.0 on August 17-20, 1998 in San Jose.
In-depth tutorials on Perl Programming, Security,
CGI, Apache, Web Programming,Windows NT and Regular
Expressions...plus a very special Workshop for
Developers with Larry Wall, creator of Perl, a
keynote on Netscape'smozilla.org,
a session on XML by Tim Bray, co-editor of XML,
and over 45 talks on Perl, Apache, Windows, and
more. It's the only conference exclusively devoted
to Perl, with the core Perl developers
Register now and youll save up to $200 on the conference
and tutorials, you will get a free OReilly book, and
be eligible to win a Palm Pilot. Plus, if you
register via the Web by July 3, you could win a $100
gift certificate for OReilly
books. Go to the conference web site now and register:
http://conference.perl.com.
Or call toll-free 877-633-8467.
------------------------------
Date: 30 Jun 1998 20:40:08 GMT
From: "Glenn Holden - Internet Support" <gjholden@cbe.ab.ca>
Subject: rename() not working ...any ideas?
Message-Id: <01bda468$2f28d0c0$f806a6a4@W400-324.b400.cbe.ab.ca>
Hello,
I have been successfully using the rename() function in some of my scripts
on a server with an older build of Perl. We have migrated these scripts to
a new server with the most recent build of Perl. (NT 4.0, IIS 3.0)
All of my scripts work fine except the one with the rename function. All I
am trying to do is rename a file in a specified directory.
The Perl documentation only states that this function exists and gives
minimal info on how to use it. The Perl books I have show almost the same
info.
Below is the listing of the directories, code and results of what I am
trying to do.
Directories:
The file is located in g:\\inetpub\wwwroot\dir1\dir2
The folder permissions for the above folders give full permission to
everyone including system.
The bin directory where the Perl file is located is in
g:\\inetpub\wwwroot\cgi-bin
Code:
$oldfile = "whatever.htm"; # name of file I want to rename
$newfile = "whatever.txt"; # name of file after rename process
$dirpath = "\\inetpub\\wwwroot\\dir1\\dir2"; # path to the file (I've even
tried the absolute path from the root)
rename("$dirpath/$oldfile", "$dirpath/$newfile");
Results:
On the old server it works fine. On the new server it looks at the code,
ignores it and then executes all of the code that follows. No error
messages are generated. The file is simply NOT renamed.
If anyone could shed some light on this problem, it would be greatly
appreciated.
Thank You
-------------------------------------------------------------
Glenn Holden, Internet Technical Specialist
Internet Support
Information Systems Services
Learning & Information Technologies
Calgary Board of Education
------------------------------
Date: Tue, 30 Jun 1998 21:57:41 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
To: John Robinson <"J.S.Robinson"@(ChopThisBit)soton.ac.uk>
Subject: Re: Scripts run by Apache can't find Mods
Message-Id: <35995F55.B571FF0B@dial.pipex.com>
John Robinson wrote:
>
> I'm having problems with Apache 1.3 running scripts on RedHat 5.0. The
> scripts in question (from smb2www) will run just fine from the command
> line, but when Apache tries to run them, it stops with the following...
>
> Can't locate MIME/Base64.pm in @INC (@INC contains:
> /usr/lib/perl5/i386-linux/5.00401 /usr/lib/perl5
> /usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .) at
> /usr/lib/perl5/smb2www.pm line 29.
>
> The Base64.pm Mod is in one (all!) of the directories listed (including
> .)
>
> I know there are issues surrounding running scripts that have the SUID
> bit set not finding modules. These scripts aren't SUID, but Apache is
> running the SUEXEC wrapper, running as 'Nobody' - could this be the
> problem? Where do i need to put the Mod? I'm losing my
> miiiiiiiiiiiiiiiiiind.
>
> I've RTFM but I've not been able to find anything relevant.
>
> Any help gratefully received.
>
> TIA
>
> John
Hello John,
I'm not sure if your problem is the same as the one I had, but it sounds
similar. when we first got our web site up, I had a hell of a time
getting CGI progs to run. The server is hosted on our ISP's machine,
running Apache if I remember right.
I wrote some CGI stuff that used modules arranged under sub-directories.
I placed these into the cgi-bin folder, but attempting to run them
caused the same error as yours. Quite often the scripts would run when I
telnet'ted to the site, but would not run via the web server.
Eventually I managed to get them to work by placing the scripts AND the
modules into the cgi-bin directory, with no sub-directories.
In addition I had to set the -I switch on the shebang line to tell perl
where the additional modules were located, so the shebang line looked
something like this:
#!/usr/local/bin/perl5 -I /home/www/cgi-bin
The -I switch adds an extra directory to the INC array.
We also had the added difficulty of virtual directories or somesuch, the
perl program saw the REAL pathname to our CGI scripts, whereas when we
telnet'ted to the site we were placed in our user area, effectively
isolated. The ISP technical support wasn't very helpful!
These are just a few ideas, but they may help.
Bye!
--
____ __
/ /\ \ / / \ ##### # # # # # #
/ / \ \/ \__ $ $ $ $$ $ $ $
/ /----\ / \ !!! ! ! ! ! ! !!
___/ / \ / / : : : : :: : :
_______________________/ . ... . . . .
$fJunction = $objectCGI->decodeChars( "%4A%75%6E%63%74%69%6F%6E" );
e-mail -> jason.holland@dial.pipex.com
JaysFunkJunction -> http://dspace.dial.pipex.com/jason.holland/
package Jason;
sub new {
my $class = shift;
my $object = {};
$object->{TALENTS}->{Perl5.0} = "Programmer";
$object->{TALENTS}->{JavaScript} = "Getting There !"
$object->{TALENTS}->{HTML} = "Author";
$object->{TALENTS}->{UNIX_LINUX} = "Advanced User";
$object->{TALENTS}->{MACINTOSH} = ( "Guru", "Photoshop" );
bless( $object, $class );
return( $object );
}
------------------------------
Date: Tue, 30 Jun 1998 21:58:17 +0000
From: Jason Holland <jason.holland@dial.pipex.com>
To: John Robinson <J.S.Robinson@soton.ac.uk>
Subject: Re: Scripts run by Apache can't find Mods
Message-Id: <35995F79.9A3E98E0@dial.pipex.com>
John Robinson wrote:
>
> I'm having problems with Apache 1.3 running scripts on RedHat 5.0. The
> scripts in question (from smb2www) will run just fine from the command
> line, but when Apache tries to run them, it stops with the following...
>
> Can't locate MIME/Base64.pm in @INC (@INC contains:
> /usr/lib/perl5/i386-linux/5.00401 /usr/lib/perl5
> /usr/lib/perl5/site_perl/i386-linux /usr/lib/perl5/site_perl .) at
> /usr/lib/perl5/smb2www.pm line 29.
>
> The Base64.pm Mod is in one (all!) of the directories listed (including
> .)
>
> I know there are issues surrounding running scripts that have the SUID
> bit set not finding modules. These scripts aren't SUID, but Apache is
> running the SUEXEC wrapper, running as 'Nobody' - could this be the
> problem? Where do i need to put the Mod? I'm losing my
> miiiiiiiiiiiiiiiiiind.
>
> I've RTFM but I've not been able to find anything relevant.
>
> Any help gratefully received.
>
> TIA
>
> John
Hello John,
I'm not sure if your problem is the same as the one I had, but it sounds
similar. when we first got our web site up, I had a hell of a time
getting CGI progs to run. The server is hosted on our ISP's machine,
running Apache if I remember right.
I wrote some CGI stuff that used modules arranged under sub-directories.
I placed these into the cgi-bin folder, but attempting to run them
caused the same error as yours. Quite often the scripts would run when I
telnet'ted to the site, but would not run via the web server.
Eventually I managed to get them to work by placing the scripts AND the
modules into the cgi-bin directory, with no sub-directories.
In addition I had to set the -I switch on the shebang line to tell perl
where the additional modules were located, so the shebang line looked
something like this:
#!/usr/local/bin/perl5 -I /home/www/cgi-bin
The -I switch adds an extra directory to the INC array.
We also had the added difficulty of virtual directories or somesuch, the
perl program saw the REAL pathname to our CGI scripts, whereas when we
telnet'ted to the site we were placed in our user area, effectively
isolated. The ISP technical support wasn't very helpful!
These are just a few ideas, but they may help.
Bye!
--
____ __
/ /\ \ / / \ ##### # # # # # #
/ / \ \/ \__ $ $ $ $$ $ $ $
/ /----\ / \ !!! ! ! ! ! ! !!
___/ / \ / / : : : : :: : :
_______________________/ . ... . . . .
$fJunction = $objectCGI->decodeChars( "%4A%75%6E%63%74%69%6F%6E" );
e-mail -> jason.holland@dial.pipex.com
JaysFunkJunction -> http://dspace.dial.pipex.com/jason.holland/
package Jason;
sub new {
my $class = shift;
my $object = {};
$object->{TALENTS}->{Perl5.0} = "Programmer";
$object->{TALENTS}->{JavaScript} = "Getting There !"
$object->{TALENTS}->{HTML} = "Author";
$object->{TALENTS}->{UNIX_LINUX} = "Advanced User";
$object->{TALENTS}->{MACINTOSH} = ( "Guru", "Photoshop" );
bless( $object, $class );
return( $object );
}
------------------------------
Date: Tue, 30 Jun 1998 13:17:46 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Sorting values usings arrays
Message-Id: <MPG.1002e7c4c6317dc19896d9@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <6nba04$md7$1@winter.news.erols.com> on Tue, 30 Jun 1998
14:12:22 -0400, Pap <Pap22@erols.com> says...
... <big snip of Perl code>
Posting that much code is guaranteed to drive most people away.
> this script works, yet does not sort the data by percentage
> notice sub bypercent { $percent{$b} <=> $percent{$a} }
> has no relevance when i add it, since it needs something like:
> foreach $player ( sort bypercent keys($percent) ) {
foreach $player ( sort bypercent keys(%percent) ) {
> but this gives an error when i put it in, 500 error.
> i also tried
> foreach $player ( sort%percent bypercent keys($percent) ) {
> and
> foreach $player ( sort %percent bypercent keys($percent) ) {
> same outcome, 500 server error.
These last two attempts are not Perl.
Your script undoubtedly had a syntax error and didn't compile. Did you
remember to add a closing brace when you put that 'foreach' line in?
You should *at least* try compiling the script from your terminal ('perl
-cw script.pl'). You should also try executing it from your terminal
(which would be simple if you used the CGI module). *Then* when you try
it from your browser it should work.
*Then* (or first :-), you should study 'Learning Perl' from beginning to
end. And DON'T FORGET about '-w' and 'use strict;'.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 30 Jun 1998 10:34:47 -0400
From: "Darren A. Blair" <darren.blair@csfb.com>
Subject: timelocal function in 2000
Message-Id: <3598F787.442D@csfb.com>
I use the timelocal in a bunch of scripts that are making calculations
on dates using the timelocal function. Does anyone know what will
happen using this function with dates in the year 2000 and beyond? Are
there any functions I can use instead that are Y2k compliant or any idea
how I can fix it?
Thanks,
Darren
Pls reply by email also.
--
********************************************************************************
Darren A. Blair Ph# (212) 325-3487
Credit Suisse First Boston Fax (212) 325-8187
Applications Integration & Migration alp (800) 225-0256/373451
E-mail darren.blair@csfb.com
********************************************************************************
------------------------------
Date: Tue, 30 Jun 1998 14:27:59 -0600
From: sprigen687@pop.dnvr.uswest.net
Subject: What is wrong with this script?
Message-Id: <35994A3E.D2FB7AD3@pop.dnvr.uswest.net>
I'm trying to run a script through Perl and send a HTML document back,
only Netscape thinks the document contians no data. When I check it
with Perl, it says they're are no syntax errors, so I don't know what's
going on. I'll show it to you and maybe you can see what's wrong with
it.
use CGI; # Uses CGI.pm module
$query = new CGI('value=hello');
$outcome = $query->param('value');
print "Content-type: text/html\n\n";
print "<HTML><HEAD>\n";
print "<TITLE>See what you typed</TITLE>\n";
print "</HEAD><BODY BGCOLOR=#FFFFFF>\n";
print "<P>You typed $outcome</P>\n";
print "</BODY></HTML>\n";
I thought printing the Content-type would work, but it doesn't seem to
do so.
------------------------------
Date: 30 Jun 1998 13:33:11 -0700
From: hirano@Xenon.Stanford.EDU (Kelly Hirano)
Subject: Re: What is wrong with this script?
Message-Id: <6nbi27$91a@Xenon.Stanford.EDU>
In article <35994A3E.D2FB7AD3@pop.dnvr.uswest.net>,
<sprigen687@uswest.net> wrote:
>I'm trying to run a script through Perl and send a HTML document back,
>only Netscape thinks the document contians no data. When I check it
>with Perl, it says they're are no syntax errors, so I don't know what's
>going on. I'll show it to you and maybe you can see what's wrong with
>it.
>
>use CGI; # Uses CGI.pm module
>$query = new CGI('value=hello');
>$outcome = $query->param('value');
>print "Content-type: text/html\n\n";
>print "<HTML><HEAD>\n";
>print "<TITLE>See what you typed</TITLE>\n";
>print "</HEAD><BODY BGCOLOR=#FFFFFF>\n";
>print "<P>You typed $outcome</P>\n";
>print "</BODY></HTML>\n";
>
>I thought printing the Content-type would work, but it doesn't seem to
>do so.
your script works for me and my apache web server... that is, after i add
#!/usr/local/bin/perl -w to the top.
--
Kelly William Hirano Stanford Athletics:
hirano@cs.stanford.edu http://www.gostanford.com/
hirano@alumni.stanford.org (WE) BEAT CAL (AGAIN)! 100th BIG GAME: 21-20
------------------------------
Date: Tue, 30 Jun 1998 20:43:10 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: What is wrong with this script?
Message-Id: <Pine.GSO.3.96.980630134042.15737L-100000@user2.teleport.com>
On Tue, 30 Jun 1998 sprigen687@pop.dnvr.uswest.net wrote:
> Subject: What is wrong with this script?
Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.
http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post
> I'm trying to run a script through Perl and send a HTML document back,
> only Netscape thinks the document contians no data. When I check it
> with Perl, it says they're are no syntax errors,
Well, that doesn't sound like it's a Perl problem, then. Maybe it's a CGI
problem, or a problem with the webserver.
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.org/CPAN/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 3031
**************************************