[19677] in Perl-Users-Digest
Perl-Users Digest, Issue: 1872 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 4 18:07:33 2001
Date: Thu, 4 Oct 2001 15:05:09 -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: <1002233109-v10-i1872@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 4 Oct 2001 Volume: 10 Number: 1872
Today's topics:
Re: 2nd request pls-Embed sound to cgi? <thomas@baetzler.de>
Re: 2nd request pls-Embed sound to cgi? <casey1@adelphia.net>
Re: 2nd request pls-Embed sound to cgi? <bofh@ubergeek.int>
Re: 2nd request pls-Embed sound to cgi? <melorama@nospam.gov>
Re: append column upon match (newbie) <jeff@vpservices.com>
Re: append column upon match (newbie) <darkon@one.net>
Re: Can't unlink file under Perl for NT <glenn@surveystar.com>
Re: Can't unlink file under Perl for NT <bart.lateur@skynet.be>
Re: CGI form email oddness - not acting as expected nobull@mail.com
Re: escape character for a space <bart.lateur@skynet.be>
Re: help this newbie please - server error <thomas@baetzler.de>
Re: How do I get byte count of retreived site using LWP <thomas@baetzler.de>
Re: How to manipulate data from database <cybertoast@mindless.com>
HTTP::Request::Common (R. Marc)
Re: HTTP::Request::Common <mbudash@sonic.net>
Re: HTTP::Request::Common <uri@sysarch.com>
Re: Is Perl for CGI going the way of the dodo? <prlawrence@lehigh.edu>
mode date from dir <jessica.bull@broadwing.com>
Re: mode date from dir <tony_curtis32@yahoo.com>
Re: Perl 5.6.0 bug: best workaround? (Abigail)
Re: Perl and Solaris Version Upgrade (Abigail)
Re: Positive lookbehind with variable length? (Matt Sergeant)
seconds since epoch to normal date <jessica.bull@broadwing.com>
Re: seconds since epoch to normal date (Randal L. Schwartz)
Re: seconds since epoch to normal date (John J. Trammell)
Re: Skipping following lines if the same <mbudash@sonic.net>
Re: Something wrong with this? <mbudash@sonic.net>
Re: Trapping sendmail errors (with eval?) nobull@mail.com
using secure cgi space? <nick@cheesypeas.demon.co.uk>
Re: Whither Palm Perl? <iltzu@sci.invalid>
Re: Whither Palm Perl? <dan@tuatha.sidhe.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 04 Oct 2001 20:48:28 +0200
From: Thomas Bätzler <thomas@baetzler.de>
Subject: Re: 2nd request pls-Embed sound to cgi?
Message-Id: <sr9prtgvrkj94tnrgobt9ldrrj62c1vric@4ax.com>
On Thu, 04 Oct 2001 14:29:22 GMT, christo <casey1@adelphia.net> wrote:
>I have a free chat cgi script im running and would like to know if a
>beep sound can be embeded somehow to advise me when someone logs in to
>the chat room. any help would be appreciated.
Please provide us with sufficient detail so that we can ascertain what
your problem is. So far, my impression is that you don't know Perl and
that you don't know much about how client/server computing in general
and the web in particular works. This is not good, but maybe we can
work it out nevertheless.
Question 1: What is your WWW/Application server? (check one)
A: [ ] The machine that sits on/under/next to my desk is running a web
server. The chat CGI program is running on that machine.
If yes, the Operating System on that machine is __________
B: [ ] My web pages and the chat CGI program are running on the
machine of a web hoster/ISP/whatever. I'm not interested in playing a
sound on that machine because I probably won't be able to hear it.
Instead, I want a sound played on my local machine that is running a
web browser.
The Operating System of my local machine is __________
C: [ ] I don't understand what you are talking about.
If you answered C, there is no easy way to help you.
If you answered B, then the answer is that the CGI must send you a web
page that contains an active element to play the sound - i.e. some
JavaScript code - whenever somebody logs in. However, per definition,
the server can't just alert you in real-time - instead, you have to
make certain that the page reloads sufficiently often for your needs.
If you answered A, then the answer is that you have to add code to the
CGI that plays a sound on the local machine whenever somebody logs in.
How to play sound depends on what OS you are running.
In any case, without the code, there's no way we can tell what needs
to be done.
And please don't send me more email bugging me about this, unless
you're willing to pay for the solution. And my rates grow
exponentially with the number of warnings and errors I get when the
code is run with use strict and -wT :-P
HTH,
--
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl
------------------------------
Date: Thu, 04 Oct 2001 20:55:08 GMT
From: christo <casey1@adelphia.net>
Subject: Re: 2nd request pls-Embed sound to cgi?
Message-Id: <iliprtk8sthehdci3ouhm23245no63hv7q@4ax.com>
Attn Thomas Batzler - Soirry for th "forwardness" of emailing you
directly...my appologies. Yes I am a newbie...a little perl knowledge.
I am running this chat script with a web hoste/r mindspring.com..on a
unix box, not sure what flavor..therefore I would want a sound played
on my machine via a web browser. The page does reload. I could mail
you the script if that would help. As I mentioned the script can be
accessed here http://www.crystalservice.com/help/bluechat.cgi
and after log on by anyone, I would naturally be logged on, a beep
sound would go off on my machine.
If you care I would be happy to pay a reasonable fee for your help and
trouble. I hope I have given you enough information. Thanks for any
further help.
On Thu, 04 Oct 2001 14:29:22 GMT, christo <casey1@adelphia.net> wrote:
>I have a free chat cgi script im running and would like to know if a
>beep sound can be embeded somehow to advise me when someone logs in to
>the chat room. any help would be appreciated.
>
>It is running on my machine that is logged in to the chat room. I have
>access to the server that is using the cgi script. Im not clear at all
>regarding a strategically placed 'system( "start whatever.wav" )'
> Again the URL is http://www.crystalservice.com/help/bluechat.cgi
>What im trying to accomplish is the same principal that is selling
>for $200 at http://www.realtimeaide.com/home.htm
>Another words when someone logs in the admistrator is chimed to advise
>that somone has logged in. I hope this additional info helps.
>thanks for taking your valuable time to consider this.
------------------------------
Date: Thu, 04 Oct 2001 21:01:33 GMT
From: Richard Holden <bofh@ubergeek.int>
Subject: Re: 2nd request pls-Embed sound to cgi?
Message-Id: <kuiprtohc8hgdq0g9mn0qtnc9groqkncvn@4ax.com>
On Thu, 04 Oct 2001 14:29:22 GMT, christo <casey1@adelphia.net> wrote:
>I have a free chat cgi script im running and would like to know if a
>beep sound can be embeded somehow to advise me when someone logs in to
>the chat room. any help would be appreciated.
>
>It is running on my machine that is logged in to the chat room. I have
>access to the server that is using the cgi script. Im not clear at all
>regarding a strategically placed 'system( "start whatever.wav" )'
> Again the URL is http://www.crystalservice.com/help/bluechat.cgi
>What im trying to accomplish is the same principal that is selling
>for $200 at http://www.realtimeaide.com/home.htm
>Another words when someone logs in the admistrator is chimed to advise
>that somone has logged in. I hope this additional info helps.
>thanks for taking your valuable time to consider this.
You asked this question before, and got several helpful responses. The fact that
you just brushed them off by saying that the answers were "over your head" shows
that you're not willing to help yourself first by trying to learn how to solve
your problem.
And from the way you keep asking this question, it appears that you don't want
"help" with writing your script, but rather, you want someone here to write your
code FOR you. This is not going to happen, as this is a Perl news/discussion
group, and not a "help desk" or commissioned programming service.
In any case, you give no indication that this has ANYTHING to do with Perl, so
you can't expect anyone here to help you with something that isn't related to
the name of the newsgroup.
You could try the comp.infosystems.www.authoring.cgi newsgroup, but I doubt they
will be able to "help" you as well, since you seem unwilling to learn the basic
things you need to know to maintain or modify your CGI script.
Sorry if this seems harsh to you, but it has to be said before someone even
nastier than me (and they are abundant in this ng) flames you off the face of
Usenet for being so clueless.
Read this page for more info:
http://www.tuxedo.org/~esr/faqs/smart-questions.html
------------------------------
Date: Thu, 04 Oct 2001 21:22:30 GMT
From: Mel Matsuoka <melorama@nospam.gov>
Subject: Re: 2nd request pls-Embed sound to cgi?
Message-Id: <29kprtkeu17kev06j7ttvqv3ig474j39ra@4ax.com>
On Thu, 04 Oct 2001 20:48:28 +0200, Thomas Bätzler <thomas@baetzler.de> wrote:
>B: [ ] My web pages and the chat CGI program are running on the
>machine of a web hoster/ISP/whatever. I'm not interested in playing a
>sound on that machine because I probably won't be able to hear it.
>Instead, I want a sound played on my local machine that is running a
>web browser.
> (snip)
>If you answered B, then the answer is that the CGI must send you a web
>page that contains an active element to play the sound - i.e. some
>JavaScript code - whenever somebody logs in. However, per definition,
>the server can't just alert you in real-time - instead, you have to
>make certain that the page reloads sufficiently often for your needs.
Well, it would be very trivial to make the script send an email or other
instant-messaging protocol to the OP's local machine, which could trigger a beep
or visual notification or something even more creative. There are a number of
instant messaging modules on CPAN that the OP could check out.
It's easier of course if the OP has a static i.p. address, but even if he
doesn't, the cgi script could easily be modified to record his current i.p.
address whenever he logs on as Admin, which could then be used to send the
notification message to his local machine.
>And please don't send me more email bugging me about this, unless
>you're willing to pay for the solution. And my rates grow
>exponentially with the number of warnings and errors I get when the
>code is run with use strict and -wT :-P
I personally like the idea of charging programming customers by the number of
characters in the final code. I can throw in warnings for free, and hopefully
I'll end up writing more code...yeah, thats the ticket ;)
Aloha,
mel
------------------------------
Date: Thu, 04 Oct 2001 11:09:07 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: append column upon match (newbie)
Message-Id: <3BBCA5C3.32CF1736@vpservices.com>
David Wall wrote:
>
> Here's another way. :-)
What, only one other way? :-)
> It's similar to Michael's solution, but uses a
> hash instead of arrays. It's not as generalized as Jeff's,
In addition to generalizability (to other field structures, to other
file formats, to other queries, etc.), the difference between the
AnyData solution and yours and Michael's is that the emphasis of the
code is on the structure of the data, not on the structure of the
strings that hold the data or on operations on the files that hold those
strings as it is in your solution and Michael's. That's not to say it's
"better" -- yours and Michael's obviously teach the user more about Perl
processing and are therefore also generalizable, just in a different
direction.
--
Jeff
------------------------------
Date: Thu, 04 Oct 2001 19:31:02 -0000
From: David Wall <darkon@one.net>
Subject: Re: append column upon match (newbie)
Message-Id: <Xns91309DAEA768Adarkononenet@207.126.101.97>
Jeff Zucker <jeff@vpservices.com> wrote on 04 Oct 2001:
> In addition to generalizability (to other field structures, to other
> file formats, to other queries, etc.), the difference between the
> AnyData solution and yours and Michael's is that the emphasis of the
> code is on the structure of the data, not on the structure of the
> strings that hold the data or on operations on the files that hold those
> strings as it is in your solution and Michael's. That's not to say it's
> "better" -- yours and Michael's obviously teach the user more about Perl
> processing and are therefore also generalizable, just in a different
> direction.
Just from the feel of it, I thought AnyData might be something of yours.
I downloaded 0.05 and am looking it over. The interface seems more
convenient than DBD::RAM, which I've occasionally used for a few small
text-file 'databases'. (Why bother with a RDBMS when you don't need that
much power, right?) Thanks for the info.
Oh, BTW, you didn't have to be quite that tender to my feelings, although
I do appreciate the kind remarks. /me looks around for a nail to use this
new hammer on....
(I should be doing work instead of playing with someone else's problems,
but this is more fun. I'm supposed to be writing a boring SAS program...
maybe if I arrange it so that I can write a Perl program to write the SAS
program for me. Hmm, I can start using AnyData for this. That might be
fun, or at least less boring.)
--
David Wall
darkon@one.net
------------------------------
Date: Thu, 04 Oct 2001 14:10:36 -0400
From: Glenn <glenn@surveystar.com>
Subject: Re: Can't unlink file under Perl for NT
Message-Id: <3BBCA61C.BCCE1744@surveystar.com>
Sorry, I had that wrong -- should have been...
$numdeleted=unlink <$somedir/file.*>;
"John J. Trammell" wrote:
> On Thu, 04 Oct 2001 13:36:14 -0400, Glenn <glenn@surveystar.com> wrote:
> ["jeopardy" quote snipped -- please don't do that]
> >
> > As long as we're still asking questions, I still don't understand why
> > $numdeleted=unlink "$somedir/file.*";
> > works under Unix without having to use glob() at all.
> >
> >
>
> Huh?
>
> [ ~ ] touch foo
> [ ~ ] perl -e 'unlink "f*"'
> [ ~ ] ls f*
> foo
> [ ~ ]
>
> --
> Take LISP, make the syntax twice as annoying, and hey presto, XML!
------------------------------
Date: Thu, 04 Oct 2001 20:52:56 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Can't unlink file under Perl for NT
Message-Id: <eviprt8alu77jsjstpu4hbp5p3a1d79d77@4ax.com>
Glenn wrote:
>Sorry, I had that wrong -- should have been...
> $numdeleted=unlink <$somedir/file.*>;
Which is the same as
$numdeleted = unlink glob("$somedir/file.*");
So there's no difference.
--
Bart.
------------------------------
Date: 04 Oct 2001 18:55:20 +0100
From: nobull@mail.com
Subject: Re: CGI form email oddness - not acting as expected
Message-Id: <u9itdvxpbr.fsf@wcl-l.bham.ac.uk>
jennlee.2@eudoramail.com (Jennifer) writes:
> I'm running Perl on a Novell web server and am using a program called
> sendmail.pl (which I didn't write) to send web form content via email.
> It has been working but has some oddities I have not been able to
> figure out or resolve.
What makes you think they may be Perl related as opposed to
application-domain related? I would have thought that even with near
zero Perl or SMTP knowledge it should have been possible to figure out
that these were likely to be SMTP issues not Perl ones.
> When the email is received and viewed, the "To" field does not show up
> as filled in. The recipient email address shows up in the blind copy
> spot, and the email ends up at the right place. I've tested the
> coding and it does in fact actually contain the TO field information,
> outputing: "RCPT TO: address@something.wisc.edu". If my understanding
> is correct, this sould show up as "TO" in the email.
Your understanding is incorrect - this has nothing to do with Perl.
In general SMTP servers do not copy the envelope-to address into the
mail headers. Some servers put the envelope-to address in a "for"
clause in a "Recieved" header. If there's no To: or CC: header then
some servers will put in an "X-Apparently-to" headers on mail that's
delivered locally.
> In addition, when I look at the email headers, I see a warning that
> the HELO protocol was not used. From the code it looks OK to me, but
> maybe I'm missing something.
Again this has nothing to do with Perl. The reason it looks OK to you
is again related to your lack of knowledge of SMTP. The HELO command
takes a manatory parameter.
> I'm hoping someone can give me some advice on why it is not acting as
> expected.
The code is not acting as expected because the expectation is based on
misconceptions about SMTP. This, as I said, has nothing to do with Perl.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 04 Oct 2001 19:12:36 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: escape character for a space
Message-Id: <92dprtktdhglp6l8k1nmpfs2hfim422rhc@4ax.com>
Max Gravitt wrote:
>I'm trying to use a space in the replacement string of a regular
>expression. It is embedded in a batch file, so I can't pass a *real*
>space. I can match a space using "\s", but I need a character that
>will insert a space at the specific place.
>
>For example:
>s/Old\sString/New\sString/g
>
>obviously does not work. I need the equivalent to " " to insert in
>place of the "\s" between New and String.
>
>Any ideas?
Just a space?
s/Old\sString/New String/g
Note that /\s/ not only matches spaces, but a tab, newline, CR, and form
feed as well. If you oinly want to match a space, use a space.
s/Old String/New String/g
--
Bart.
------------------------------
Date: Thu, 04 Oct 2001 20:55:35 +0200
From: Thomas Bätzler <thomas@baetzler.de>
Subject: Re: help this newbie please - server error
Message-Id: <6qbprtoke71692mbiqi1a7cvtep1rom2t4@4ax.com>
On Thu, 4 Oct 2001, "Getho" <gethinc@hotmail.com> wrote:
>I'm very new to this so applogies for the crap questions:
>I'm trying to get a "classifieds" script working (abs5.06 by
>ads-programming). I've got several other scripts working fine - I can just
>about follow some of the script language. I'm sure I've covered all the
>obvious things: permissions (all 777), paths, path to perl, cgi bin etc.
Could we have your server address, please? >:)
>When I ran the script initially I just got a server error. For some reason
>I changed all the double-quotes in the script to single ones and the script
>started to work.
You forgot the quotes around "work".
>Why would that make a difference?
Because some previously undefined variables that were getting
interpolated are now part of the text. This is a Bad Thing.
>Should I cut my losses and give up?
Maybe you should invest some resources in actually learning Perl.
Before your losses start cutting you - I mean, world-writeable files?
This is a hack waiting to happen.
My $0.02,
--
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl
------------------------------
Date: Thu, 04 Oct 2001 20:15:56 +0200
From: Thomas Bätzler <thomas@baetzler.de>
Subject: Re: How do I get byte count of retreived site using LWP::UserAgent
Message-Id: <479prtsrdsd9fsfgr8obvad0bj3qhb5op6@4ax.com>
On Thu, 04 Oct 2001, "John Beavers" <john@tesserv.com> wrote:
>I have a script were I check links within a site. I am not sure how to get
>the byte count of the link that was retrived. Can someone please help?
You don't retrieve a link, you retrieve a document :-)
Anyways, what you get back from the LWP::UserAgent->request method is
an HTTP::Response object, which is derived from a HTTP::Message
object, which in turn relies on HTTP::Header.
You probably want the content_length() method of that class.
A class overview that lists these details is given in the LWP manpage.
#!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $request = HTTP::Request->new('GET', 'http://baetzler.de/');
my $response = $ua->request($request);
if( $response->is_success ){
print "Result Code: ", $response->status_line, "\n",
"Result Size: ", $response->content_length, "\n";
} else {
print "Error requesting: $!\n";
}
__END__
HTH,
--
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl
------------------------------
Date: Thu, 04 Oct 2001 13:59:24 -0500
From: sundar <cybertoast@mindless.com>
Subject: Re: How to manipulate data from database
Message-Id: <3BBCB18C.6010206@mindless.com>
I'm assuming that using "select distinct ..." would not work for you
(due to the join, or other wise). This would probably be the fastest
implementation, since the database engine takes care of the data for you.
So the other option is to remove dups after you've got the data. Make
sure you've got the data sorted, so that this is a simple process:
foreach (@{$dataset}) { # assuming you've got an array reference to
your resultset
if ($_->[0] =~ /$match/) { # assuming you only care about the
1st field
# matched record, so ignore
next;
} else {
# unique record, so keep
push @keep, $_;
}
$match = $dataset[0];
}
Of course, TMTOWTDI, like using map, grep, etc. But the above gives you
an idea of how to get where you need to go.
Hope this helps.
Cheers.
SAS wrote:
>Hi,
>
>I am using Perl DBI to extract data from oracle and then put the data
>in xml format. I am joining all of the tables to get the result, so I
>only execute one sql select statement. This is the format I recieve
>in:
>
>Fname,Lname,SSID,p_num,T1,T2,T3,address1,address2,city,state,e_num
>
>The problem is that I have alot of 1 to many results. That is for
>each Fname,Lname, I could get up to 1000 p_num. So each result
>recieved will have Fname,Lname,SSID,T1,T2,T3 repeated up to 1000 times
>and the p_num ofcourse is different. So in my while statement, I am
>taking each result returned from the database and put it in xml
>format...but I get alot of repeated fields. How do I manipulate the
>data so that I don't include the repeated fields in my xml document?
>
>TIA
>
>SAS
>
------------------------------
Date: 4 Oct 2001 13:13:04 -0700
From: rmarc@copacetic.net (R. Marc)
Subject: HTTP::Request::Common
Message-Id: <cc868095.0110041213.3e588d18@posting.google.com>
I'm having an issue with HTTP::Request::Common and dynamic variables.
I'm creating a monitor for applications that reads a config file
containing the form variables and data for posting to various web
sites.
If I create my request staticly, like so:
my $req = POST 'http://somesite', [ var1 => 'x', var2 => 'y' ];
The code works fine and everything is happy.
If I do the following, however, it does not work:
my $variables = "var1 => 'x', var2 => 'y'";
my $req = POST 'http://somesite', [ $variables ];
The post in the latter example simply posts as if there were
no assigned variables.
So my question is, how does one go about adding variable content
to a post directive, if the above isn't it? Or, better yet, what
exactly am I doing wrong here?
R. Marc
------------------------------
Date: Thu, 04 Oct 2001 20:43:15 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: HTTP::Request::Common
Message-Id: <mbudash-B10C0B.13431704102001@news.sonic.net>
In article <cc868095.0110041213.3e588d18@posting.google.com>,
rmarc@copacetic.net (R. Marc) wrote:
> I'm having an issue with HTTP::Request::Common and dynamic variables.
>
> I'm creating a monitor for applications that reads a config file
> containing the form variables and data for posting to various web
> sites.
>
> If I create my request staticly, like so:
>
> my $req = POST 'http://somesite', [ var1 => 'x', var2 => 'y' ];
>
> The code works fine and everything is happy.
>
> If I do the following, however, it does not work:
>
> my $variables = "var1 => 'x', var2 => 'y'";
> my $req = POST 'http://somesite', [ $variables ];
>
> The post in the latter example simply posts as if there were
> no assigned variables.
>
> So my question is, how does one go about adding variable content
> to a post directive, if the above isn't it? Or, better yet, what
> exactly am I doing wrong here?
some quick testing suggests that this will work for you:
my $req = POST 'http://somesite', [ eval($variables) ];
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Thu, 04 Oct 2001 21:15:20 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: HTTP::Request::Common
Message-Id: <x7ofnn85ti.fsf@home.sysarch.com>
>>>>> "MB" == Michael Budash <mbudash@sonic.net> writes:
>> If I create my request staticly, like so:
>>
>> my $req = POST 'http://somesite', [ var1 => 'x', var2 => 'y' ];
and that is an anon array of the vars.
>>
>> The code works fine and everything is happy.
>>
>> If I do the following, however, it does not work:
>>
>> my $variables = "var1 => 'x', var2 => 'y'";
and that is a quoted string. why would you think that could replace the
array ref used above?
>> my $req = POST 'http://somesite', [ $variables ];
MB> some quick testing suggests that this will work for you:
MB> my $req = POST 'http://somesite', [ eval($variables) ];
and that solution is silly. why even have the string to eval?
you should have just assigned the anon array to the var and used it:
my $variables = [ var1 => 'x', var2 => 'y' ];
my $req = POST 'http://somesite', $variables ;
that is the proper equivilent of the original version.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: Thu, 4 Oct 2001 14:59:48 -0400
From: "Phil R Lawrence" <prlawrence@lehigh.edu>
Subject: Re: Is Perl for CGI going the way of the dodo?
Message-Id: <9pibji$kg6@fidoii.CC.Lehigh.EDU>
[ CC: thurbermingus1@netscape.net ]
"Thurber Mingus" <thurbermingus1@netscape.net> wrote :
> I appreciate the responses. I am not a troll, as was suggested, but I
> wanted to see what people thought of the issue; I don't know anyone at my
> college that is knowledgeable about either subject, and I wanted to bounce
> this question off of people who actually used Perl. I have used VBScript
> for ASP and am looking at ASP.NET for the future, yet I wanted to know
where
> Perl users stood on the alluded-to feeling among some that Perl's use for
> CGI, as well as CGI itself, was falling into disfavor. I was thinking of
> learning Perl, but wasn't sure what motivation I should have for doing so.
>
> I think Perl's use in OOP is interesting, I am going to look into it.
Thank
> you for your time.
Don't miss Damian Conway's _Object Oriented Perl_ book. It's great.
As for the general issues that were raised in this thread, I feel that you
should above all enjoy writing your code. There's more than one way to do
it, and more than one language to do it in. However, try writing your next
few projects in Perl, and see if you can wipe that big grin off your face by
the time you're done. One of the greatest reasons why Perl is fun is its
power; there is so much leverage to be had with Perl and CPAN that even a
relative simpleton like myself can accomplish great things.
Phil R Lawrence
------------------------------
Date: Thu, 04 Oct 2001 19:47:38 GMT
From: "Jessica Bull" <jessica.bull@broadwing.com>
Subject: mode date from dir
Message-Id: <u13v7.102500$hh.9142076@bin1.nnrp.aus1.giganews.com>
Maybe you can help me. I am reading in all files in a directory. I want the
modified time for each file. What I have below is not returning any value at
all. Do you know why that would be or how I could get it to do that?
while (defined($file = readdir(DIR))) {
my $mod = (stat($file))[9];
print "$mod\n";
}
------------------------------
Date: Thu, 04 Oct 2001 14:54:12 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: mode date from dir
Message-Id: <87pu83i3kr.fsf@limey.hpcc.uh.edu>
>> On Thu, 04 Oct 2001 19:47:38 GMT,
>> "Jessica Bull" <jessica.bull@broadwing.com> said:
> Maybe you can help me. I am reading in all files in a
> directory. I want the modified time for each file. What
> I have below is not returning any value at all. Do you
> know why that would be or how I could get it to do that?
> while (defined($file = readdir(DIR))) {
> my $mod = (stat($file))[9];
> print "$mod\n";
> }
The entries read from the directory return the *names* of
the files, not the path to them. If you want to do
something to one of these directory entries in its own
right, you have to construct the appropriate path from the
directory's location, plus the entry name.
Note also there's no error checking in your stat() call;
you just try to access the appropriate part of the
return value regardless.
The File::stat module provides a cleaner and more readable
interface.
hth
t
--
Whoops, I've said too much. Smithers, use the amnesia ray...
------------------------------
Date: 4 Oct 2001 21:49:51 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Perl 5.6.0 bug: best workaround?
Message-Id: <slrn9rpm95.ano.abigail@alexandra.xs4all.nl>
David Coppit (newspost@coppit.org) wrote on MMCMLV September MCMXCIII in
<URL:news:3BBA909D.2020706@coppit.org>:
\\
\\ The problem seems to be the prototype. I can remove it and perl doesn't
\\ core dump. Is there a better workaround? For example, is there a
\\ solution that's easier than:
\\
\\ if ($] == 5.006) {
\\ &foo(@_)
\\ } else {
\\ foo(@_)
\\ }
Well, if this a workable workaround, you appear not to be using the
prototypes anyway. In that case, just drop the prototype and you
don't need a test on the version.
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s};;;
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)}; # Perl 5.6.0 broke this...
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
------------------------------
Date: 4 Oct 2001 21:54:01 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Perl and Solaris Version Upgrade
Message-Id: <slrn9rpmgu.ano.abigail@alexandra.xs4all.nl>
Laurent Galster (laurent.galster@swisscom.com) wrote on MMCMLV September
MCMXCIII in <URL:news:01c14c00$f29cfc50$8d4e310a@u45198>:
"" Hello,
"" We need to upgrade our solaris version from 2.5.1 to xx.
"" The new version number will depend on all other tools that we use.
""
"" Could you please send me a list of compatibilities between Perl versions
"" and Solaris versions. e.g.:
"" Solaris 2.5.1 - Perl 5.005_02
"" Solaris 2.6 - ??
"" Solaris 7 - ??
"" Solaris 8 - ??
"" Solaris 9 (Beta) - ??
The first Solaris version that shipped with Perl was Solaris 8.
So the list would be:
Solaris 2.5.1 - No perl.
Solaris 2.6 - No perl.
Solaris 7 - No perl.
Solaris 8 - 5.005.
Solaris 9 - 5.6.1. (AFAIK)
Abigail
--
$_ = "\x3C\x3C\x45\x4F\x54";
print if s/<<EOT/<<EOT/e;
Just another Perl Hacker
EOT
------------------------------
Date: 4 Oct 2001 13:36:52 -0700
From: msergeant@star.net.uk (Matt Sergeant)
Subject: Re: Positive lookbehind with variable length?
Message-Id: <eb3031b9.0110041236.7121d688@posting.google.com>
markus.cl@gmx.de (Markus Dehmann) wrote in message news:<c1e48b51.0110040205.2666f72@posting.google.com>...
> Hi,
>
> as you know, positive lookbehind is only allowed with fixed-width:
> s/(?<=A)B
>
> This matches B only if there is a A before it, but doesnt match the A
> itself.
>
> This is not allowed:
> s/(?<=\w+)B
> because the lookbehind assertion has a variable length and this is not
> implemented in Perl yet.
>
> I heard in Perl6 this feature will be allowed.
> Are there tools that allow it by now? Python seems not to allow it.
> What about other Unix tools?
Actually, depending on your exact regexp, you can implement this in
the current Perl. Just reverse your string and your match, and use a
lookahead:
if ($reversed_string =~ /B(?=\w+)/) {
...
}
Matt.
------------------------------
Date: Thu, 04 Oct 2001 21:15:09 GMT
From: "Jessica Bull" <jessica.bull@broadwing.com>
Subject: seconds since epoch to normal date
Message-Id: <wj4v7.377271$Lw3.23709518@news2.aus1.giganews.com>
I have this piece of code which should pull the time the file was last
modified in seconds since epoch. I feed that value into localtime and it
gives me an off the wall date. (though it does it consistantly) I use the
same subroutine to calculate the current time by feeding in the value from
time, and it works great. I am having trouble with why it won't work with
the modified time. HELP!!!!
while (defined($file = readdir(DIR))) {
$oldfile = "$chkdir\\$file";
my $mod = (stat($oldfile))[9];
my $modtime = Gettimestamp2($mod);
sub Gettimestamp2 {
my $timemodvalue = @_;
my ($sec2, $min2, $hou2, $mdy2, $mon2, $yea2) = localtime($timemodvalue);
$yea2=1900+$yea2; $mon2=$mon2+1;
if (length($sec2)<2) { $sec2="0$sec2"; }
if (length($min2)<2) { $min2="0$min2"; }
if (length($hou2)<2) { $hou2="0$hou2"; }
if (length($mdy2)<2) { $mdy2="0$mdy2"; }
if (length($mon2)<2) { $mon2="0$mon2"; }
# $timestamp is in the format of yyyy.mm.dd.hh.mm.ss
my $timestamp2="$yea2.$mon2.$mdy2";
return $timestamp2;
}
------------------------------
Date: 04 Oct 2001 14:35:42 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: seconds since epoch to normal date
Message-Id: <m18zerulzl.fsf@halfdome.holdit.com>
>>>>> "Jessica" == Jessica Bull <jessica.bull@broadwing.com> writes:
Jessica> I have this piece of code which should pull the time the file
Jessica> was last modified in seconds since epoch. I feed that value
Jessica> into localtime and it gives me an off the wall date. (though
Jessica> it does it consistantly) I use the same subroutine to
Jessica> calculate the current time by feeding in the value from time,
Jessica> and it works great. I am having trouble with why it won't
Jessica> work with the modified time. HELP!!!!
Jessica> while (defined($file = readdir(DIR))) {
Jessica> $oldfile = "$chkdir\\$file";
Jessica> my $mod = (stat($oldfile))[9];
Jessica> my $modtime = Gettimestamp2($mod);
Jessica> sub Gettimestamp2 {
Jessica> my $timemodvalue = @_;
$timemodvalue is always 1 here. Did you want
my($timemodvalue) = @_;
perhaps?
Jessica> my ($sec2, $min2, $hou2, $mdy2, $mon2, $yea2) = localtime($timemodvalue);
Jessica> $yea2=1900+$yea2; $mon2=$mon2+1;
Jessica> if (length($sec2)<2) { $sec2="0$sec2"; }
Jessica> if (length($min2)<2) { $min2="0$min2"; }
Jessica> if (length($hou2)<2) { $hou2="0$hou2"; }
Jessica> if (length($mdy2)<2) { $mdy2="0$mdy2"; }
Jessica> if (length($mon2)<2) { $mon2="0$mon2"; }
Ouch, this code hurts my eyes. Did you copy it from a Matt Wright
Script perhaps? He's famous for this broken idiom.
Try this instead:
$_ = sprintf "%02d", $_ for $sec2, $min2, $hou2, $mdy2, $mon2;
Jessica> # $timestamp is in the format of yyyy.mm.dd.hh.mm.ss
Jessica> my $timestamp2="$yea2.$mon2.$mdy2";
Jessica> return $timestamp2;
Jessica> }
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Thu, 4 Oct 2001 16:36:56 -0500
From: trammell@haqq.hypersloth.invalid (John J. Trammell)
Subject: Re: seconds since epoch to normal date
Message-Id: <slrn9rpljo.gqh.trammell@haqq.hypersloth.net>
On Thu, 04 Oct 2001 21:15:09 GMT, Jessica Bull wrote:
[plea for help snipped]
> while (defined($file = readdir(DIR))) {
> $oldfile = "$chkdir\\$file";
$oldfile = "$chkdir/$file"; works too...
> my $mod = (stat($oldfile))[9];
> my $modtime = Gettimestamp2($mod);
>
> sub Gettimestamp2 {
> my $timemodvalue = @_;
^
my $timemodvalue = shift; # or $_[0];
I think this is your killer.
> my ($sec2, $min2, $hou2, $mdy2, $mon2, $yea2) = localtime($timemodvalue);
> $yea2=1900+$yea2; $mon2=$mon2+1;
>
> if (length($sec2)<2) { $sec2="0$sec2"; }
> if (length($min2)<2) { $min2="0$min2"; }
> if (length($hou2)<2) { $hou2="0$hou2"; }
> if (length($mdy2)<2) { $mdy2="0$mdy2"; }
> if (length($mon2)<2) { $mon2="0$mon2"; }
Using sprintf("%02d",$foo) is much cleaner.
> # $timestamp is in the format of yyyy.mm.dd.hh.mm.ss
???
> my $timestamp2="$yea2.$mon2.$mdy2";
> return $timestamp2;
>
> }
How about using POSIX::strftime()? perldoc POSIX for details.
--
ERR_NOSIG: sigfile out of commission while removing 'all your base'
references.
------------------------------
Date: Thu, 04 Oct 2001 20:23:58 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Skipping following lines if the same
Message-Id: <mbudash-C1D6CE.13240004102001@news.sonic.net>
In article <slrn9roght.8li.bernard.el-hagin@gdndev25.lido-tech>,
bernard.el-hagin@lido-tech.net (Bernard El-Hagin) wrote:
> [snip]
>
> for ( my $i = 0; $i < @data; $i++ ){
very un-perlish... use this:
for my $i ( 0..$#data ) {
> [snip]
sorry - i couldn't resist...
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Thu, 04 Oct 2001 20:24:21 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Something wrong with this?
Message-Id: <mbudash-29FA5E.13242404102001@news.sonic.net>
In article <9ph8c1$6id$3@mamenchi.zrz.TU-Berlin.DE>,
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
> According to Joe Schaefer <joe+usenet@sunstarsys.com>:
>
> > --
> > Joe Schaefer "Language is the dress of thought."
> > -- Samuel Johnson
> >
>
> Does that make an autist a cognitive nudist?
>
> Anno
excellent!
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: 04 Oct 2001 19:00:27 +0100
From: nobull@mail.com
To: bill@ilap.com
Subject: Re: Trapping sendmail errors (with eval?)
Message-Id: <u9g08zxp38.fsf@wcl-l.bham.ac.uk>
bill@ilap.com (Bill Dykstra) writes:
> I'm having some trouble trapping a fatal sendmail error when trying to
> send email messages. Every now and then sendmail is not available
> (ie: somebody stopped the sendmail process, which happens now and then
> if the sendmail config files are being rebuilt). If my program is
> running, and is in the process of sending a message or messages when
> sendmail is stopped, it crashes, usually with an error such as this:
>
> No local mailer defined
> QueueDirectory (Q) option must be set
>
> Because of this sendmail error, my perl program dies.
That does not look like a Perl error. That looks like STDOUT from
sendmail. What makes you believe that you Perl script is crashing?
> I've tried using eval to trap the error, but I can't get it to
> work.
What makes you believe that there is an error to trap?
> Please respond via email to bill@ilap.com (and maybe post a reply here
> as well, to benefit anyone else who may have similar troubles).
Please read the groups you post to (or to put it another way only post
to groups you are prepared to read). Failing that, please use a
Mail-copies-to header.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 4 Oct 2001 22:11:18 +0100
From: Nick Robinson <nick@cheesypeas.demon.co.uk>
Subject: using secure cgi space?
Message-Id: <9xSiyCA2BNv7EwYL@cheesypeas.demon.co.uk>
Can anyone point me to a good site on using cgi in a secure area? I'm
having a few strange problems, such as env(remote_host) not returning a
value in the secure area.
Many thanks
all the best,
Nick Robinson
------------------------------
Date: 4 Oct 2001 19:52:33 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Whither Palm Perl?
Message-Id: <1002224943.9825@itz.pp.sci.fi>
In article <t4sort88or0ghbnse8ogmacqjnm2idp11d@4ax.com>, Bart Lateur wrote:
>DrDebug wrote:
>
>>Is there some reason why Perl has not been ported to the PalmOS?
>>Sure it's big, but couldn't something be done?
>
>Perl6 will most likely run on the Palm. A few months, or years, of
>patience, please.
Mind you, "run" may still be the wrong verb. I'm having a hard time
imagining that anything resembling Perl could ever do anything but
"crawl" on PalmOS, regardless of the underlying implementation. Of
course, I *could* be wrong...
--
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real! This is a discussion group, not a helpdesk. You post something,
we discuss its implications. If the discussion happens to answer a question
you've asked, that's incidental." -- nobull in comp.lang.perl.misc
------------------------------
Date: Thu, 04 Oct 2001 20:39:57 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Whither Palm Perl?
Message-Id: <xO3v7.62799$NT3.6797763@news1.rdc1.ct.home.com>
Ilmari Karonen <iltzu@sci.invalid> wrote:
> In article <t4sort88or0ghbnse8ogmacqjnm2idp11d@4ax.com>, Bart Lateur wrote:
>>DrDebug wrote:
>>
>>>Is there some reason why Perl has not been ported to the PalmOS?
>>>Sure it's big, but couldn't something be done?
>>
>>Perl6 will most likely run on the Palm. A few months, or years, of
>>patience, please.
> Mind you, "run" may still be the wrong verb. I'm having a hard time
> imagining that anything resembling Perl could ever do anything but
> "crawl" on PalmOS, regardless of the underlying implementation. Of
> course, I *could* be wrong...
I dunno. The palms aren't blazingly fast, but they're not horribly
slow either. It might end up being worth it to compile perl 6 down
to C and compile that, but I think the interpreter will probably
run adequately well regardless.
Dan
------------------------------
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 1872
***************************************