[18684] in Perl-Users-Digest
Perl-Users Digest, Issue: 852 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 8 03:06:45 2001
Date: Tue, 8 May 2001 00:05:10 -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: <989305510-v10-i852@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 8 May 2001 Volume: 10 Number: 852
Today's topics:
Any d20 Gamers here? I'm building a GM aid... <bmstroh@cavtel.net>
Re: Any d20 Gamers here? I'm building a GM aid... (Craig Berry)
Re: Can this newsgroup read perl/html files nobull@mail.com
Re: Cwd & -T (Martien Verbruggen)
Error in script EOF <PhWashington@home.com>
Re: Error in script EOF (Jay Tilton)
Re: Error in script EOF <krahnj@acm.org>
Re: Executing CGI on a Mac, help? (L. Butler)
Re: Executing CGI on a Mac, help? <krk@speakeasy.org>
Get back errors from calling command line? <danparker276@yahoo.com>
Re: Get back errors from calling command line? <wyzelli@yahoo.com>
Re: Get back errors from calling command line? nobull@mail.com
Re: How do I use client text file for cgi script? <dan@nospam_dtbakerprojects.com>
Re: how to set binary mode when uploading a file <dan@nospam_dtbakerprojects.com>
Re: how to set binary mode when uploading a file (R.S.)
latest stable version of Perl <dcantin@earthlink.net>
Re: latest stable version of Perl (Abigail)
Re: link management script <davidaslanian@hotmail.com>
Newbie: how can I shorten a repetitive regular expressi <dn131@yahoo.com>
Re: Newbie: how can I shorten a repetitive regular expr <wyzelli@yahoo.com>
Re: PL/SQL and DBI. <todd@designsouth.net>
PPM help <kingfu@blueyonder.co.uk>
Prices for work? <bcoon@sequenom.com>
Re: Prices for work? <todd@designsouth.net>
Re: Prices for work? <wyzelli@yahoo.com>
Re: Question: some odd-looking behavior viscido@u.washington.edu
Re: random numbers <wyzelli@yahoo.com>
Re: random numbers <godzilla@stomp.stomp.tokyo>
Re: random numbers (Garry Williams)
Re: reverse of perlcc <bop@mypad.com>
Re: sessions and closures (Dave Bailey)
Re: sessions and closures (Logan Shaw)
Re: sessions and closures (F. Xavier Noria)
What would you do <mrp@hafatel.com>
Re: Win32::ODBC hangs unless I run with "-d" (Philip Lees)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 07 May 2001 22:30:23 -0400
From: Brent Stroh <bmstroh@cavtel.net>
Subject: Any d20 Gamers here? I'm building a GM aid...
Message-Id: <fmleftknlb68no37ckkcc8bpnki5d9h0jr@4ax.com>
I'm in the middle of building a set of modules to make moderating my PBEM a
bit easier. Ideally, they'll all be tied together with a shell program so
I can do things like:
RPGShell> 1d20
1d20: ( 17 ) = 17
RPGShell> roll party init
Alexander (init): 1d20+3 ( 9 ) +3 = 12
Brock (init): 1d20-1 ( 19 ) -1 = 18
RPGShell> roll Brock hide vs 20
Brock (hide): 1d20+6 ( 13 ) +6 = 19 -> Failure!
RPGShell>
It began as a way to save me time shuffling through character sheets.
It's working in concept now, and does everything hinted at above. It
currently handles melee and range attacks, but doesn't know anything about
critical hits or damage. (I haven't done the data entry on the weapons,
yet.) It also is blissfully unaware of two-weapon fighting and multiple
attacks.
Anyway, once I get it working, and clean up/comment the code, I'd like to
find a Perl-literate set of eyes to look it over and help me improve it.
Takers?
------------------------------
Date: Tue, 08 May 2001 04:39:34 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Any d20 Gamers here? I'm building a GM aid...
Message-Id: <tfeu46e4ds7p7a@corp.supernews.com>
Brent Stroh (bmstroh@cavtel.net) wrote:
: I'm in the middle of building a set of modules to make moderating my PBEM a
: bit easier. Ideally, they'll all be tied together with a shell program so
: I can do things like:
:
: RPGShell> 1d20
: 1d20: ( 17 ) = 17
: RPGShell> roll party init
: Alexander (init): 1d20+3 ( 9 ) +3 = 12
: Brock (init): 1d20-1 ( 19 ) -1 = 18
: RPGShell> roll Brock hide vs 20
: Brock (hide): 1d20+6 ( 13 ) +6 = 19 -> Failure!
: RPGShell>
Interesting idea. Here's my approach for just the die-rolling part:
#!/usr/bin/perl -w
# rpgdice - role dice for role-playing games.
# Craig Berry (20010507)
use strict;
while (1) {
print 'rpgdice> ';
chomp(my $cmd = lc <>);
last if !defined $cmd || $cmd eq 'quit';
$cmd =~ s/(\d+)d(\d+)/'( '.&roll($1, $2).' )'/eg;
print "$cmd => ", eval $cmd, "\n";
}
sub roll {
my ($count, $faces) = @_;
my $sum = 0;
$sum += 1 + int rand($faces) while $count--;
return $sum;
}
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "God becomes as we are that we may be as he is."
| - William Blake
------------------------------
Date: 08 May 2001 07:30:53 +0100
From: nobull@mail.com
Subject: Re: Can this newsgroup read perl/html files
Message-Id: <u9pudkmjxe.fsf@wcl-l.bham.ac.uk>
clintp@geeksalad.org (Clinton A. Pierce) writes:
> In article <2kgJ6.130$oS1.127@news2.dnvrcoidc.firstworld.net>,
> "newuser" <newuser@nospam.slip.net> writes:
> > I am currently having a problem with a perl script and in order for me
> > to explain the problem I need to post a html file. I was just wondering what
> > is the best way to post the perl script and the html file.
>
> Usenet is not the place for attachments. Use the wondrous miracle
> of cut-and-paste and paste the relevant pieces into a posting as though
> you'd typed it.
This is the "B" answer.
The "A" answer is to reduce the problem to a short but _complete_
script that is tested to reproduce the problem and paste that
unaltered into the posting.
If that's not possible then go for the "B" answer. BTW: The "B+"
answer is to do what you'd do for "B" but also include a URL to the
full source.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 08 May 2001 02:32:14 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Cwd & -T
Message-Id: <slrn9femle.22m.mgjv@verbruggen.comdyn.com.au>
On Mon, 7 May 2001 20:59:03 +0200,
Mario Rizzuti <diab.lito@usa.net> wrote:
> Is there a way to avoid specification of the full path to scripts while
> still working under taint mode?
>
> #!perl -T
> require "./hello.pl"; # error
_What_ exactly is the error you get? And have you tried looking it up
in the perlsec and perldiag documentation?
Martien
--
Martien Verbruggen |
Interactive Media Division | You can't have everything, where
Commercial Dynamics Pty. Ltd. | would you put it?
NSW, Australia |
------------------------------
Date: Tue, 08 May 2001 02:31:31 GMT
From: Philip <PhWashington@home.com>
Subject: Error in script EOF
Message-Id: <3AF75C36.A0275263@home.com>
I copied a script from a book on perl and I'm getting an error. I'm
what to do to correct this.
open(SENDMAIL, "|/usr/lib/sendmail -oi -t -odq") or
die "Can't fork for sendmail: $! \n";
print SENDMAIL <<EOF;
From:User <philip\@galaxy.com>
To: Final Destination <phwashington\@home.com>
Subject: A relevant subject
Body of the messages goes here.
EOF;
close(SENDMAIL) or warn "sendmail didn't close nicely";
------------------------------
Date: Tue, 08 May 2001 02:44:33 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Error in script EOF
Message-Id: <3af75c8c.10008366@news.erols.com>
On Tue, 08 May 2001 02:31:31 GMT, Philip <PhWashington@home.com>
wrote:
>I copied a script from a book on perl and I'm getting an error. I'm
>what to do to correct this.
[...]
> print SENDMAIL <<EOF;
[...]
> EOF;
Back up the 'EOF' to the first column and lose the semicolon.
For more info, see perlfaq4, "Why don't my <<HERE documents work?"
------------------------------
Date: Tue, 08 May 2001 02:52:20 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Error in script EOF
Message-Id: <3AF75F6F.515037C0@acm.org>
Philip wrote:
>
> I copied a script from a book on perl and I'm getting an error. I'm
> what to do to correct this.
It looks like your book is broken if this is the code it supplies.
> open(SENDMAIL, "|/usr/lib/sendmail -oi -t -odq") or
> die "Can't fork for sendmail: $! \n";
> print SENDMAIL <<EOF;
> From:User <philip\@galaxy.com>
> To: Final Destination <phwashington\@home.com>
> Subject: A relevant subject
>
> Body of the messages goes here.
>
> EOF;
^^^^^^^^^
EOF
> close(SENDMAIL) or warn "sendmail didn't close nicely";
John
--
use Perl;
program
fulfillment
------------------------------
Date: Mon, 07 May 2001 21:31:02 -0500
From: butlerl@attcanada.ca (L. Butler)
Subject: Re: Executing CGI on a Mac, help?
Message-Id: <butlerl-ya02408000R0705012131020001@news.attcanada.ca>
In article <krk-7D1222.11100607052001@news.speakeasy.net>, Kenneth Knight
<krk@speakeasy.org> wrote:
>I'm trying to get a relatively simple CGI applicaiton up and running on
>a system that uses a Macintosh to host its web sites. The CGI is written
>using MacPerl (v 5.2.0r4 - latest version I know of and that's pretty
>old). It runs fine if I serve it using something like Apple's Personal
>Web Sharing, but on this other machine I continually get "Error. Unable
>to launch ACGI application" messages. Can anyone suggest what might be
>going on. Here is the script code (admittedly not very pretty; I'm a
>Perl neophyte).
>
Ken,
What web server is the other mac running. If it is Personal web sharing,
you might want to set it so that the web sharing will launch MacPerl when
the ACGI is called. It kind of sounds like you have just the perl file
saved as text. I think on the Mac you need to save it as an applet, and
have you web server set-up to open MacPerl when the request for the cgi
comes in. I have done it on tests at the office, but I can't remember
right off hand where the configuration is for that under the web sharing
extension.
Lloyd Butler
Product and Systems Development Supervisor
TWN Commercial Services
A division of Pelmorex Inc.
Mississauga, Ontario
office: lbutler@on.pelmorex.com
------------------------------
Date: Tue, 08 May 2001 00:11:18 -0400
From: Kenneth Knight <krk@speakeasy.org>
Subject: Re: Executing CGI on a Mac, help?
Message-Id: <krk-16BD15.00111808052001@news.speakeasy.net>
In article <butlerl-ya02408000R0705012131020001@news.attcanada.ca>,
butlerl@attcanada.ca (L. Butler) wrote:
> In article <krk-7D1222.11100607052001@news.speakeasy.net>, Kenneth Knight
> <krk@speakeasy.org> wrote:
>
> Ken,
>
> What web server is the other mac running. If it is Personal web sharing,
> you might want to set it so that the web sharing will launch MacPerl when
> the ACGI is called. It kind of sounds like you have just the perl file
> saved as text. I think on the Mac you need to save it as an applet, and
> have you web server set-up to open MacPerl when the request for the cgi
> comes in. I have done it on tests at the office, but I can't remember
> right off hand where the configuration is for that under the web sharing
> extension.
I thought I had included that information. My mistake. The server where
this perl cgi is to run is using WebSTAR (don't know which version). I
am uploading the script as a CGI application as you are supposed to do
with MacPerl. You're right the cgi application sends appleevetns to
MacPerl which runs the actual code.
** Ken **
--
** Kenneth Knight Web Design, IT Consultant, Software Engineer **
** krk@speakeasy.org http://www.speakeasy.org/~krk **
------------------------------
Date: Mon, 7 May 2001 18:58:00 -0700
From: "Krusty" <danparker276@yahoo.com>
Subject: Get back errors from calling command line?
Message-Id: <gqIJ6.1302$B13.169795@news.pacbell.net>
my script goes like
$cmd = "plink -ssh me@255.0.0.0 dir"; #orwhat ever
open (FH, "$cmd |");
while (<FH>){
#never gets in here on an error message like 'can't connect to server'
}
How can I get it to display the error messages as well as the out put?
Is is something like
"$cmd &2 |" or I don't know the syntax
help please
------------------------------
Date: Tue, 8 May 2001 11:36:11 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Get back errors from calling command line?
Message-Id: <AvIJ6.19$91.5768@vic.nntp.telstra.net>
"Krusty" <danparker276@yahoo.com> wrote in message
news:gqIJ6.1302$B13.169795@news.pacbell.net...
> my script goes like
> $cmd = "plink -ssh me@255.0.0.0 dir"; #orwhat ever
> open (FH, "$cmd |");
> while (<FH>){
> #never gets in here on an error message like 'can't connect to server'
> }
>
> How can I get it to display the error messages as well as the out put?
>
The last error returned from the operating system is held in the special
variable $!
So change your open to:
open (FH, "$cmd |") or die "Can't open $cmd to pipe : $!";
And you should see what the error is.
(BTW you don't necessarily have to die there, but you should always check
the success or otherwise of an open, and then handle the error
appropriately)
Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
around');
$d='$_$a$s$b$w';$e='$_$a$s$b';sub d{$h=shift;$h=~s/\$(\w+)/${$1}/g;return$h}
sub
e{return(shift!=1)?'s':''}for(reverse(1..100)){$s=e($_);$f=d($d);$g=d($e);
$c.="$f\n$g\n$t\n";$_--;$s=e($_);$e=d($d);$c.="$e\n\n";}print"$c*hic*";
------------------------------
Date: 08 May 2001 07:41:38 +0100
From: nobull@mail.com
Subject: Re: Get back errors from calling command line?
Message-Id: <u9lmo8mjfh.fsf@wcl-l.bham.ac.uk>
"Wyzelli" <wyzelli@yahoo.com> writes:
> "Krusty" <danparker276@yahoo.com> wrote in message
> news:gqIJ6.1302$B13.169795@news.pacbell.net...
> > my script goes like
> > $cmd = "plink -ssh me@255.0.0.0 dir"; #orwhat ever
> > open (FH, "$cmd |");
> > while (<FH>){
> > #never gets in here on an error message like 'can't connect to server'
> > }
> >
> > How can I get it to display the error messages as well as the out put?
> >
>
> The last error returned from the operating system is held in the special
> variable $!
True, but irrelevant since it is the command and not the open()
operation that is produces the error.
See FAQ: "How can I capture STDERR from an external command?"
You may also want to look at $? after you close(FH).
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 08 May 2001 01:29:19 GMT
From: Dan Baker <dan@nospam_dtbakerprojects.com>
Subject: Re: How do I use client text file for cgi script?
Message-Id: <3AF74A8C.A2B85D5A@nospam_dtbakerprojects.com>
Sean Ressler wrote:
>
> I recently wrote a Perl script that transforms a text file to an HTML
> document. I would like to allow my users to call the script via web browser
> (cgi) and supply the text file from their local machine.
>
> The script runs from the command line by issuing the command: "<scriptname>
> <path/text filename>" without quotes.
>
> How do I supply / determine the <path/text filename> to the script that
> resides on the server?
-------------
the server cant pull from the client, you have to push from the
client.... so on your site, provide an html form that either allows: 1)
copy/paste of raw text into a <TEXTAREA> 2)allows them to define a path
and upload their file... see the docs for CGI:: and the many posts on
how to upload and handle files from clients.
In either case you'll need to be careful of illegal characters and
things that may cause problems in their source.
D
------------------------------
Date: Tue, 08 May 2001 01:33:30 GMT
From: Dan Baker <dan@nospam_dtbakerprojects.com>
Subject: Re: how to set binary mode when uploading a file
Message-Id: <3AF74B87.949EC3A1@nospam_dtbakerprojects.com>
"R.S." wrote:
>
> I am trying to upload an image file (jpg) using
> print $query->filefield(-name=>'photo'.-default=>'starting
> value',-size=>50,-maxlength=>80);
----------------
try using google to search this group for posts on "upload" with author
containing dtbaker. I posted a very detailed example on this a while
back.
D
------------------------------
Date: Tue, 08 May 2001 04:29:04 GMT
From: rastacey@roadrunner.nf.net (R.S.)
Subject: Re: how to set binary mode when uploading a file
Message-Id: <3af77583.581728851@news.thezone.net>
On Tue, 08 May 2001 00:21:56 GMT, rastacey@roadrunner.nf.net (R.S.)
wrote:
Some additional info which leads me to beleive it is a binary /text
mode type of problem.
The uploaded file has extra '0D' in front of the '0A' characters.
CRLF.
BOB
>I am trying to upload an image file (jpg) using
>print $query->filefield(-name=>'photo'.-default=>'starting
>value',-size=>50,-maxlength=>80);
>
>And then save the fiel uaing
>open(OUTFILE,">pics\\photo.jpg")
>while ($bytesread=read($fileH1,$buffer,1024)) {
>print OUTFILE $buffer:
>}
>
>This works as far as uploading the file but there always seem to be
>too many characters.
>I have lookaed at buffer, binary, headers without fixing this problem.
>
>Any help or a pointer to a sample would be appreciated.
>
>
------------------------------
Date: Tue, 08 May 2001 01:22:35 GMT
From: Brian Cantin <dcantin@earthlink.net>
Subject: latest stable version of Perl
Message-Id: <wkr8y0lbd1.fsf@earthlink.net>
I am about to install a new version of Perl on mutiple platforms.
For a variety of infrastructure reasons, changing the Perl version
is a big deal. When I went to CPAN, 5.6.1 was identified as the
latest stable version. So, I have been working with 5.6.1 in
preparing for the upgrade.
Randal Schwartz recently posted a message where he said that
5.6.1 is not shaken out enough for use on his production machines.
So, if you were to pick a Perl version that you trusted in a
production environment, which one would it be?
--
Brian Cantin
An advocate of poisonous individualism.
To reply via email, replace "dcantin" with "bcantin".
------------------------------
Date: Tue, 8 May 2001 06:32:46 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: latest stable version of Perl
Message-Id: <slrn9ff4oe.ek6.abigail@tsathoggua.rlyeh.net>
Brian Cantin (dcantin@earthlink.net) wrote on MMDCCCVII September
MCMXCIII in <URL:news:wkr8y0lbd1.fsf@earthlink.net>:
''
'' I am about to install a new version of Perl on mutiple platforms.
'' For a variety of infrastructure reasons, changing the Perl version
'' is a big deal. When I went to CPAN, 5.6.1 was identified as the
'' latest stable version. So, I have been working with 5.6.1 in
'' preparing for the upgrade.
''
'' Randal Schwartz recently posted a message where he said that
'' 5.6.1 is not shaken out enough for use on his production machines.
''
'' So, if you were to pick a Perl version that you trusted in a
'' production environment, which one would it be?
None. Every version of Perl I've used had its problems in one way or the
other. Just because Randal doesn't want to use 5.6.1 on his production
servers (note that Randal gives no clue what kind of mission critical
things he's doing with Perl) doesn't mean you shouldn't. Perhaps the
version of Perl Randal finds suitable for his machines won't work for you.
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
------------------------------
Date: Tue, 08 May 2001 02:30:08 -0000
From: David Aslanian <davidaslanian@hotmail.com>
Subject: Re: link management script
Message-Id: <tfemhgii75p55f@corp.supernews.com>
build it youself! Its not that complicated- all you need is a file to
update every time user comes/leaves your site, and a simple reporting sys.
I would build it for you (but that would make you a parasite). Try
the "Perl Black Book" - a great problem solver.
ringo wrote:
>
>
> link management script
>
> Please, can you help me!
> I need cgi script that counts hits sent to my site , aswell as hits out
from
> my site. And can sorted links by hits sent to me. I want links can be
> displayed anywhere on my page i want.
> I`ve got one big problem: i havent enough money to pay for the script, so
> please, can anybody help me to find the script free of charge!
> Or if you`re a webmaster i can pay for the script by sending you some
> traffic from my site to yours.
>
> Please , help me. Drop me a line and we should have a deal!
> ringo@ringo.net.ru
>
>
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: 07 May 2001 23:03:39 -0700
From: David Wake <dn131@yahoo.com>
Subject: Newbie: how can I shorten a repetitive regular expression?
Message-Id: <9nlmo8s7gk.fsf@Turing.Stanford.EDU>
It seems as if there must be some way of shortening code like this.
Can anyone help?
if ( m{CONTACT\sINFORMATION\s+
Name:\s+
(\w[\w\s]+?)\s+ #name
City:\s+
(\w[\w\s]+?)\s+ #city
State:\s+
(\w[\w\s]+?)\s+ #state
Zip\sCode:\s+
(\w[\w\s]+?)\s+ #zip
}sx ){
print "Name = $1 \n" ;
print "City = $2 \n" ;
print "State = $3 \n" ;
print "Zip = $4 \n" ;
}
Thanks,
David
------------------------------
Date: Tue, 8 May 2001 16:24:14 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Newbie: how can I shorten a repetitive regular expression?
Message-Id: <DJMJ6.32$91.7919@vic.nntp.telstra.net>
"David Wake" <dn131@yahoo.com> wrote in message
news:9nlmo8s7gk.fsf@Turing.Stanford.EDU...
>
> It seems as if there must be some way of shortening code like this.
> Can anyone help?
>
> if ( m{CONTACT\sINFORMATION\s+
> Name:\s+
> (\w[\w\s]+?)\s+ #name
> City:\s+
> (\w[\w\s]+?)\s+ #city
> State:\s+
> (\w[\w\s]+?)\s+ #state
> Zip\sCode:\s+
> (\w[\w\s]+?)\s+ #zip
> }sx ){
> print "Name = $1 \n" ;
> print "City = $2 \n" ;
> print "State = $3 \n" ;
> print "Zip = $4 \n" ;
> }
>
Depends a little on your data expectations, but I think this approach is a
litle clearer: -
$_ = 'CONTACT INFORMATION Name: My name goes here City: This is my City
State: My State Zip Code: 8945621';
my ($name, $city, $state, $zip);
# grab the contents of the fields
if ( m/Name:(.*)City:(.*)State:(.*)Zip Code:(.*)/ ){
($name, $city, $state, $zip) = ($1,$2,$3,$4);
}
# remove leading and trailing spaces from each variable
$name =~ s/^ +(.*?) +$/$1/;
$city =~ s/^ +(.*?) +$/$1/;
$state =~ s/^ +(.*?) +$/$1/;
$zip =~ s/^ +(.*?) +$/$1/;
# other validation as required would go here
print "Name = $name\nCity = $city\nState = $state\nZip = $zip\n";
If the client supplies a null response, we don't fail the regex and can then
perform error checking on the named variables later. The stripping of
spaces shown is not the canonical method from the FAQ, which you should look
at as well.
There are pros and cons to each approach, but this shows clearly what you
are doing at each step, which makes for easier maintenance later on.
HTH
Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";
------------------------------
Date: Tue, 08 May 2001 05:00:12 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: PL/SQL and DBI.
Message-Id: <w3LJ6.73718$U4.16919293@news1.rdc1.tn.home.com>
"Ming Zhang" <Ming.Zhang@ti.com> wrote in message
news:9d7ab5$5dt$1@tilde.csc.ti.com...
> Does anybody have experience on using DBI with
> oracle Pl/SQL?Please give me an example. What should I do if I want to
pass
> in one variable to PL/SQL and get a returned recordset?
> Thanks!
Isn't the whole point of DBI (Independant) that the database doesn't matter?
I'm gonna guess that it's the same code I use with DBI/mySQL:
use DBI;
$dbh = DBI->connect( ... Oracle connect string ..., $user, $pass);
$sth = $dbh->prepare("select * from $table where $column = '$variable'");
$sth->execute;
while ($hr = $sth->fetchrow_hashref) {
do stuff with %{ $hr }
}
$dbh->disconnect;
Or did I miss the point of the question?
--
-todd
------------------------------
Date: Tue, 08 May 2001 05:21:37 GMT
From: "King Fu" <kingfu@blueyonder.co.uk>
Subject: PPM help
Message-Id: <BnLJ6.21023$Cf.2849118@news1.cableinet.net>
hi having just installed windows 2000 and reinstalling perl i can no longer
get ppm to work to install any modules, this is the error i get:
Retrieving package 'DBI'...
HTTP POST failed: 500 (Server Error), in SOAP method call. Content of
response:
<HTML>
<!-- $Id: //depot/prod/ontap/Rbrutus/prod/netcache/errors/500.html#1 $ -->
<HEAD><TITLE>500 Server Error</TITLE></HEAD>
<BODY>
<H1>Server Error</H1>
<H4>
The following error occurred:<P>
Missing final status response after 100-continue<!--NETCACHE ERROR-->
</H4>
<HR>
Please contact the administrator.
</BODY>
</HTML>
at C:/Perl/site/lib/PPM/SOAPClient.pm line 222
Is ppm not compatible with win2k? I have never recieved this error before.
------------------------------
Date: Mon, 07 May 2001 21:50:24 -0700
From: Bryan Coon <bcoon@sequenom.com>
Subject: Prices for work?
Message-Id: <3AF77B10.6A2CF6E8@sequenom.com>
My apologies for a bit off topic post (its still kind of a perl question
though :))
I have been asked do do some contract work for a local company, which
involves installing a perl htaccess/htpasswd manager program and
modifying the code to suit their needs. Nothing major, just a few hours
work at most.
Can someone please point me to some resources that will help determine
how much I should charge them?
For example, what's the going rate on perl programmers? I have been
programming in perl for about 3 years, but it has always been for my
company, never outside. I hear crazy rumors of people paying 50k for a
static site with less than 10 pages, which I cannot verify. I just need
to get a ballpark idea of what is acceptable, so I dont overcharge or
undercharge.
Thanks!
Bryan
------------------------------
Date: Tue, 08 May 2001 05:12:40 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: Prices for work?
Message-Id: <cfLJ6.73777$U4.16942084@news1.rdc1.tn.home.com>
"Bryan Coon" <bcoon@sequenom.com> wrote in message
news:3AF77B10.6A2CF6E8@sequenom.com...
> My apologies for a bit off topic post (its still kind of a perl question
> though :))
>
> I have been asked do do some contract work for a local company, which
> involves installing a perl htaccess/htpasswd manager program and
> modifying the code to suit their needs. Nothing major, just a few hours
> work at most.
>
> Can someone please point me to some resources that will help determine
> how much I should charge them?
>
> For example, what's the going rate on perl programmers? I have been
> programming in perl for about 3 years, but it has always been for my
> company, never outside. I hear crazy rumors of people paying 50k for a
> static site with less than 10 pages, which I cannot verify. I just need
> to get a ballpark idea of what is acceptable, so I dont overcharge or
> undercharge.
>
> Thanks!
> Bryan
>
I'd say $30-40 an hour unless you're in a huge city, then go $50-$60. Just
tell them it's really complicated code even if it's not
--
-todd
------------------------------
Date: Tue, 8 May 2001 15:49:08 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Prices for work?
Message-Id: <KcMJ6.28$91.8508@vic.nntp.telstra.net>
> I'd say $30-40 an hour unless you're in a huge city, then go $50-$60. Just
> tell them it's really complicated code even if it's not
Are those dollars US, Canadian, Australian or what?
Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";
------------------------------
Date: 07 May 2001 18:23:00 -0700
From: viscido@u.washington.edu
Subject: Re: Question: some odd-looking behavior
Message-Id: <m3u22wr5vv.fsf@fiddler.u.washington.edu>
"Dave" <djm@spamfree.mcoe.k12.ca.us> writes:
> Hows about, instead of chomp, he use this:
>
> split /\r?\n?$/
>
> Does that even work? the ? should mean 0 or 1 matches.
>
Haven't tried that, but
$request =~ s/\r//;
worked just fine. Thanks to Ren Maddox for the suggestion (below):
> >
> > You're getting rid of the newline ("\n"), but there is still a
> > carriage return ("\r").
> >
That fixed it.
Steve
--
Steven Viscido [viscido@u.washington.edu]
Department of Zoology, Box 351800 Kincaid Hall
University of Washington
Seattle, WA 98195 Tel: 206-221-6893
------------------------------
Date: Tue, 8 May 2001 11:33:01 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: random numbers
Message-Id: <CsIJ6.18$91.5571@vic.nntp.telstra.net>
> --
> Aren't you, at this point, cutting down a California Redwood using a
> banana *and* a particle accelerator?
> - Bernard El-Hagin, in CLPM
Just about died laughing when I saw that sig. Brought back memories of one
the more ridiculous threads I have ever participated in (been blamed for
perhaps?)
Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";
------------------------------
Date: Mon, 07 May 2001 19:59:58 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: random numbers
Message-Id: <3AF7612E.5F3F5917@stomp.stomp.tokyo>
sas wrote:
(snipped)
> Does anyone have a script that will generate random numbers?
> It must be a 5 digit random number which will be associated
> with a specific name....
I am curious why you would need random numbers for sorting
when you are already using unique specific names.
An argument could be presented an ID number would sort those
with the same name, which is rare but not completely unlikely.
Should you have two or more names which are the same, tag a
unique identifier to the ends of those names. This would
eliminate a need for random number generation, make your
data base more "personal" by not assigning a person a
number, which some find offensive and, overall, reduce
the complexiety of your data base.
Countering this notion of unique names, many never realize
epoch seconds make for excellent ID numbers, given you are
not running a batch of names, all within the same second.
This is quite easy to avoid by data base entry management.
Use of epoch seconds is a sure methodology of assuring no
two numbers are the same. This significantly reduces the
complexiety of a script, increases reliability just as
significantly and, presorts your data base, numerically.
There is an added bonus using epoch seconds; along with
numerical presorting, you also enjoy entry date sorting,
both quite automatic.
There are better options available contrasting use of
random numbers. Consider exploring those options.
Godzilla!
------------------------------
Date: Tue, 08 May 2001 05:13:28 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: random numbers
Message-Id: <slrn9ff03o.2o2.garry@zfw.zvolve.net>
On Mon, 07 May 2001 21:35:05 GMT, Bart Lateur <bart.lateur@skynet.be> wrote:
> sas wrote:
>
>> It must be a 5
>>digit random number which will be associated with a specific name, (an "ID"
>>number), I want to check against a log file to be sure the number hasn't
>>been used already and then add the number and associated name to that log
>>file.
>
> Once you get over 100000 visitors, you'll be in trouble.
Actually the trouble will creep up before then. :-)
--
Garry Williams
------------------------------
Date: Mon, 7 May 2001 22:55:38 -0400
From: "flash" <bop@mypad.com>
Subject: Re: reverse of perlcc
Message-Id: <EbJJ6.1255$h%.540355@news20.bellglobal.com>
true.
But i was.
it was only like 10 lines of code.
Now I am done
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:9d52u6$879$2@mamenchi.zrz.TU-Berlin.DE...
> According to flash <bop@mypad.com>, who top-posted:
>
> > I have already started.
> > and im almost done.
>
> Programmers say "I'm almost done" all the time. It's safe to assume
> they're wrong.
>
> Anno
------------------------------
Date: 08 May 2001 02:09:35 GMT
From: dave@sydney.daveb.net (Dave Bailey)
Subject: Re: sessions and closures
Message-Id: <slrn9feb2t.skv.dave@sydney.daveb.net>
On Mon, 7 May 2001 21:30:56 +0000 (UTC), Abigail <abigail@foad.org> wrote:
>Bart Lateur (bart.lateur@skynet.be) wrote on MMDCCCVI September MCMXCIII
>in <URL:news:40udftskncrpafv9215g9dculok2an0acf@4ax.com>:
>{} Abigail wrote:
>{}
>{} >F. Xavier Noria (fxn@isoco.com) wrote:
>{} >
>{} >:) That's why I asked whether someone
>{} >:) had written (or had considered to write) cgis like that and
>{} >:) would like to share his or her thoughts.
>{}
>{} >I fail to see why Perl lacks this. Perl happily stores a reference to
>{} >a closure in a hash.
>{}
>{} CGI's are independent prgrams.
>Are you claiming that CGI equals Perl, or are you claiming that CGI
>programs written in LISP magically overcome the obstacle of being
>restarted?
The closures generated by the Lisp macros in the server code for the
Yahoo store builder have to be stored somewhere accessible to multiple
httpd processes; i.e. on disk, so that when a link is clicked, the
corresponding closure is picked up correctly by whichever httpd process
is dispatched to handle the request. So it can't be quite as simple as
a hash of references to closures stored in memory (in Perl), but I don't
think it would need to be much more complicated than that - the hash
key could be used to determine a unique location in the filesystem which
contains a file whose contents are the Perl closure automagically
generated earlier by the server code. The file could then be read and
evaluated. In my opinion this is not significantly different from the
Lisp solution. I don't think this technique is an innately superior
method of handling CGI applications. These applications inevitably
boil down to sets of sequences of steps one takes by doing one form
post after another. Session state must be stored somewhere in order
for everything to work. Session state can usually be boiled down to
a few variables which change from one step to the next, and can be
stored in any number of ways. That the author of the Yahoo store
builder chose to store session state in closures generated by Lisp
macros is certainly unique, clever and different, but is it better than
adding and/or updating a row in a table of a relational database, for
example? Graham's article was not convincing in this respect, in no
small part because it had to be so vague.
--
Dave Bailey
davidb54@yahoo.com
------------------------------
Date: 7 May 2001 23:13:11 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: sessions and closures
Message-Id: <9d7ron$eh0$1@boomer.cs.utexas.edu>
In article <slrn9feb2t.skv.dave@sydney.daveb.net>,
Dave Bailey <dave@sydney.daveb.net> wrote:
>post after another. Session state must be stored somewhere in order
>for everything to work. Session state can usually be boiled down to
>a few variables which change from one step to the next, and can be
>stored in any number of ways. That the author of the Yahoo store
>builder chose to store session state in closures generated by Lisp
>macros is certainly unique, clever and different, but is it better than
>adding and/or updating a row in a table of a relational database, for
>example?
Well, I'm not a LISP person and so I'm not clear whether it's a messy
thing to store these closures on disk, but one advantage of it would
seem to be that you have the flexibility to store the exact environment
you need, rather than a set of key value pairs.
Just to make up a random example, if you had a binary tree in memory
and wanted this to be part of the stored state, with a closure,
presumably you just have to make sure some reference to the binary tree
is included, and everything's fine. But storing this in a database
would be a big, special-case pain in the you-know-what.
So, in that respect, it would seem to be more elegant.
That is, assuming there is an elegant way to store a closure on disk in
the first place.
- Logan
--
my your his her our their _its_
I'm you're he's she's we're they're _it's_
------------------------------
Date: Tue, 08 May 2001 07:03:09 GMT
From: fxn@isoco.com (F. Xavier Noria)
Subject: Re: sessions and closures
Message-Id: <3af7945a.863921@news.iddeo.es>
On 08 May 2001 02:09:35 GMT, dave@sydney.daveb.net (Dave Bailey) wrote:
: The closures generated by the Lisp macros in the server code for the
: Yahoo store builder have to be stored somewhere accessible to multiple
: httpd processes; i.e. on disk
Thank you for your response.
I have never used this, but when I read the article I thought we
have closures in Perl on one hand, and FastCGI in the other hand.
One could store a hash in a request dispatcher which would know
how to deal with the stored closures. Do you see any drawbacks in
this schema? I don't know... are closures light enough to take this
technique into account or even given the possibility would be
better to store the session state in a classical way?
-- fxn
------------------------------
Date: Tue, 8 May 2001 12:57:24 +1000
From: "Michael R. McPherson" <mrp@hafatel.com>
Subject: What would you do
Message-Id: <9d7pki02dv6@enews3.newsguy.com>
I have a number of validations I need to run on some input. I have to test
for correct length, as it needs to be a fixed size, and also need to test
for appropriate format. Plus I need to "Murphy Proof" these tests as it can
be a pain to fix the database if any of this input is committed to the
database incorrectly. I also need to "yell" at the user should they input
something incorrectly and let them know what they did wrong.
So far I have come up with the following script but being a newbie at this I
would love to see some variations that may be more efficient at it.
TYIA
IMSI in a 310470XXXXXXXXX format (where X = digit) ;
ISDN in a 1671788XXXX format (where X = digit) ;
sub mode_preadd {
my $imsi=$q->param('imsi');
my $isdn=$q->param('isdn');
print "<META HTTP-EQUIV=\"REFRESH\"
CONTENT=\"1;URL=mproc.pl?mode=preaddtwo&imsi=$imsi&isdn=$isdn\">";
print "Please stand by while I check to make sure that IMSI:<font
color=red>$imsi</font> and ISDN:<font color=red>$isdn</font> are available";
}
sub mode_preaddtwo {
#test imsi length
my $imsi=$q->param('imsi');
my $isdn=$q->param('isdn');
my $imsil = length $imsi;
if ($imsil < 15 || $imsil > 15 ){
$MODEERR = "IMSI $imsi is either to short or long in length. 15
Characters in 310470XXXXXXXXX format";
mode_error($MODEERR);
}else{
mode_preaddthree($imsi, $isdn)
}
}
sub mode_preaddthree {
#test isdn length
my ($imsi,$isdn)=@_;
my $isdnl = length $isdn;
if ($isdnl < 11 || $isdnl > 11 ){
$MODEERR = "ISDN $isdn is either to short or long in length. Please
use the 1671788XXXX format";
mode_error($MODEERR);
}else{
mode_preaddfour($imsi, $isdn)
}
}
sub mode_preaddfour {
#test imsi format
my ($imsi,$isdn)=@_;
if ($imsi =~ /310470\d{9}/) {
mode_preaddfive($imsi,$isdn);
}else{
$MODEERR = "IMSI $imsi is not in the correct format
310470XXXXXXXXX";
mode_error($MODEERR);
}
}
sub mode_preaddfive {
#test isdn format
my ($imsi,$isdn)=@_;
if ($isdn =~ /1671788\d{4}/) {
mode_preaddsix($imsi,$isdn);
}else{
$MODEERR = "ISDN $isdn is not in the correct format 1671788XXXX";
mode_error($MODEERR);
}
}
sub mode_preaddsix {
print "OK";
}
sub mode_error {
my $err = $_[0];
print "<META HTTP-EQUIV=\"REFRESH\"
CONTENT=\"3;URL=mproc.pl?mode=add\">";
print "You have been rejected due to:<br> ";
print "<font color=red>$err</font><br>";
print "You will be redirected back in 3 seconds";
}
------------------------------
Date: Tue, 08 May 2001 06:18:11 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: Win32::ODBC hangs unless I run with "-d"
Message-Id: <3af78dc8.61999780@news.grnet.gr>
On Mon, 7 May 2001 14:38:03 -0700, "Toni Vatcher"
<tmvatcher@Xbigfoot.com> wrote:
>The nice people where I work just upgraded my PC to an 833MHz PC running
>Windows 2000.
>
>I'm trying to move all of my various (working) Perl tools over and am having
>a problem with Win32:ODBC.
There is a bug in Win32::ODBC that generates a warning when a null
value crops up (I can't remember exactly where). In earlier versions
of Windows it's not a problem, but in Win 2000 it locks up.
I asked about this last September in a thread with subject 'Warning
message in Win32::ODBC module'. You can look it up if you're
interested.
I think this has been fixed in newer versions of Win32::ODBC. If
installing the newer version doesn't help, e-mail me and I'll send you
the fixed version I have.
Phil
--
Philip Lees
ICS-FORTH, Heraklion, Crete, Greece
Ignore coming events if you wish to send me e-mail
'The aim of high technology should be to simplify, not complicate' - Hans Christian von Baeyer
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 852
**************************************