[9516] in Perl-Users-Digest
Perl-Users Digest, Issue: 3110 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 9 19:07:13 1998
Date: Thu, 9 Jul 98 16:00:20 -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 Thu, 9 Jul 1998 Volume: 8 Number: 3110
Today's topics:
Re: -- Abigail, my sink is clogged (Bob Trieger)
Bizarre copy of ARRAY in aassign? justinb@ignored.cray.com
DynaLoader question <keith@herald.itg.ti.com>
exec'ing rsh differences greggj@savvis.com
Free Newsletter (HO BigD)
Re: Free Newsletter (brian d foy)
Re: grep lines from log file by date. <franzen@pmel.noaa.gov>
h2n <wolverine@pandore.qc.ca>
Re: kill 0 always true? How test pid? <lrosen@alum.mit.edu>
Re: new charter and moderator for comp.lang.perl.announ (John D Groenveld)
nother question: how do you declare a SAFEARRAY? mad_ahmad@my-dejanews.com
parsing a template and replacing certain words (from a jevon@my-dejanews.com
Re: Perl4 and 5 (was: random writes) (Bob MacDowell)
Placing output from System() call into an array from th <bth@acsu.buffalo.edu>
Q:Switching Formats ("Kirby, David")
Re: Removing the ^M character (Bob Trieger)
Re: Removing the ^M character <mikane@shell3.ba.best.com>
Re: Removing the ^M character (Kelly Hirano)
Re: REVIEW: Perl CGI Programming - No Experience Requir <John.Adams@BentonvilleAR.ncr.com>
Re: secure HTTPS connection module? <aas@sn.no>
Re: Silly things to do in Perl (or: is that Laptop wate (Larry Rosler)
sort utility <ken_stephenson@corp.srs.com>
Re: sort utility (Bob Trieger)
Re: sort utility (Larry Rosler)
Re: sort utility (Ben Coleman)
Re: trigger sending a Free Newsletter <dtbaker_@flash.net>
Re: using a variable only once (Mike Stok)
Re: what's wrong with this code? <jdporter@min.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 09 Jul 1998 21:38:35 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: -- Abigail, my sink is clogged
Message-Id: <6o3dd1$sm5$1@strato.ultra.net>
try the Labor::Plumber module on CPAN.
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972
Ext: 1949 and let the jerk that answers know
that his toll free number was sent as spam. "
------------------------------
Date: 09 Jul 1998 15:52:52 -0500
From: justinb@ignored.cray.com
Subject: Bizarre copy of ARRAY in aassign?
Message-Id: <o8nhg0qzqzf.fsf@springer.cray.com>
Hello, I've got a CGI program that runs okay on this version of perl :
springer<justinb>90% /opt/local/bin/perl5 -v
This is perl, version 5.003 with EMBED
built under irix_6_2 at Nov 10 1996 12:53:14
+ suidperl security patch
But fails weirdly with this version :
springer<justinb>91% /sw/pd/perl/5.004_o32/bin/perl -v
This is perl, version 5.004_04 built for IP25-irix
The specific error with the latter shows up in the error log as :
Bizarre copy of CODE in aassign at /data/web/wwwmn/cgi-bin/PRIVATE/query
line 515, <PASS> chunk 1
but when run under -d it gives :
Bizarre copy of ARRAY in aassign at /sw/pd/perl/5.004_o32/lib/perl5db.pl
line 1122, <IN> chunk 20.
Then, again :
springer<www>31% /sw/pd/perl/5.004_o32/bin/perl -c -w query
query syntax OK
and
springer<www>32% /opt/local/bin/perl5 -c -w query
query syntax OK
According to the Camel, "Bizarre copy of %s in %s" is a (P) class error,
meaning I should never see it. What to do (besides run under the older
version until I can figure it out)?
-justinb
--
Justin Banks - Silicon Graphics Inc. Eagan, MN
if the answer is the same whether you're programming in Perl,
C, or Visual Modula 17++ with JavaBeans and Digital Satellite
TV Support, it's not a Perl question.
echo '16i[q]sa[ln0=aln100%Pln100/snlbx]sbA0D4D465452snlbxq' | dc
------------------------------
Date: 09 Jul 1998 16:20:48 -0500
From: Keith Sparacin <keith@herald.itg.ti.com>
Subject: DynaLoader question
Message-Id: <ufmk95m2027.fsf@par.itg.ti.com>
I was using Perl 5.00401 and installed the Net::TCP module that
created a .so file that was used by DynaLoader.pm. I then installed
Perl 5.00404 and got the following error trying to load the .so file:
cat foo.pl
#!/usr/local/bin/perl5
use Net::TCP;
./foo.pl
Can't load '/usr/local/lib/perl5/site_perl/sun4-solaris/auto/Net/Gen/Gen.so' for module Net::Gen: ld.so.1: /usr/local/bin/perl5.00401: fatal: relocation error: symbol not found: Perl_dowarn: referenced in /usr/local/lib/perl5/site_perl/sun4-solaris/auto/Net/Gen/Gen.so at /usr/local/lib/perl5/sun4-solaris/5.00401/DynaLoader.pm line 155.
at /usr/local/lib/perl5/site_perl/Net/Inet.pm line 35
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/Net/Gen.pm line 157.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/Net/Inet.pm line 35.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/Net/TCP.pm line 33.
BEGIN failed--compilation aborted at ./foo.pl line 3.
If I reinstall the Net::TCP module with Perl 5.00404 then the perl
script works with 5.00404 but not 5.00401. If I rebuild Perl 5.00401
(this version was installed quite a while back) then the script works
with both versions of Perl but not old .so files. This will make it
harder to upgrade Perl versions. I was wondering if the site_perl
directory should have version specific .so files?
Keith
------------------------------
Date: Thu, 09 Jul 1998 20:51:37 GMT
From: greggj@savvis.com
Subject: exec'ing rsh differences
Message-Id: <6o3agp$cau$1@nnrp1.dejanews.com>
I have a script that does an rsh to a router attempting to get the output
from a traceroute command. The script does an exec, with a list of
arguments. I can run the script from the command line and it produces the
correct output. So, what I want, is to put the output on a web page. So, I
put up an html page that allows the user to select some options and have the
action be to call a perl script (not the one does the rsh), for further
processing. This script in turn exec's (I've tried system and open with a
pipe etc with the same results), the script that does the rsh. Now for the
frustrating question. The output that is returned, is only the first 5 lines
and it stops (and there should be around 15, the number of lines from the run
from the command line). Note, I have gotten past the script being run as
user NOBODY, so that should not be an issue. I have played with the auto
flush to no avail, had the script write the output to an intermediate file
and even snooped the packets sent and recieved. Its as if the router just
stops sending the data after a bit, when not running from the command line.
Any suggestions?
Gregg Jensen
greggj@savvis.com
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 9 Jul 1998 21:10:35 GMT
From: hobigd@aol.com (HO BigD)
Subject: Free Newsletter
Message-Id: <1998070921103500.RAA23834@ladder01.news.aol.com>
Hello,
I need help! I am trying to set up a "subscribe to our newsletter" type of form
on our website. Does anyone know of a perl script that will do this? I know
they are available but have been unable to find one.
Thanks,
Darren
------------------------------
Date: Thu, 09 Jul 1998 18:14:35 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Free Newsletter
Message-Id: <comdog-ya02408000R0907981814350001@news.panix.com>
Keywords: from just another new york perl hacker
In article <1998070921103500.RAA23834@ladder01.news.aol.com>, hobigd@aol.com (HO BigD) posted:
>I need help! I am trying to set up a "subscribe to our newsletter" type of form
>on our website. Does anyone know of a perl script that will do this? I know
>they are available but have been unable to find one.
maybe. what does "subscribe to our newsletter" mean? does it sign
someone up for a mailing list, snail mail list, or other sort of
list? what sort of database does it interact with? these and other
details can help us find the right solution for you :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>
------------------------------
Date: Thu, 9 Jul 1998 13:42:39 -0700
From: Nathan Franzen <franzen@pmel.noaa.gov>
Subject: Re: grep lines from log file by date.
Message-Id: <Pine.SOL.3.96.980709132952.29887A-100000@corona.pmel.noaa.gov>
On 9 Jul 1998, Craig Berry wrote:
>infomancer@my-dejanews.com wrote:
>:Hello, I am trying to grep lines from a log file between certain dates. Each
>:line is dated in the format: 09/Jul/1998:12:01:13. How would I grab the lines
>:between say Jul 2 and July 15 without reading in variables and a lot of
>:processing. Some of my logs are over 30 megs! Thanks for any help!
>
> Doing it without reading in variables is asking a bit much. I fear you'll
> have to wait for the Mind::Read module, to be bundled with Perl 6.
I hesitate to suggest a solution, and in fact I do so only in the hope
that I will be corrected and further enlightened...
Having said that, I started using the range operator relatively recently.
I've use it on a couple of problems, where it performed delightfully. Why
not here?
If you assume all the logs appear in order, and that there are logs for
each day, then
print if m#02/Jul/1998# .. m#16/Jul/1998#;
could work. Of course, if there is no log file for July 16 (or July 2),
then you're in trouble and would have been better off with the (more
robust) date manipulation approach.
(even then, you might still want to use the range operator as
print if &compare_date($_, $date1) .. &compare_date($date2, $_);
)
Corrections, please.
-Nathan
------------------------------
Date: Thu, 09 Jul 1998 21:05:58 GMT
From: Sebastien Perreault <wolverine@pandore.qc.ca>
Subject: h2n
Message-Id: <35A530B4.4910@pandore.qc.ca>
Could someone tell me where I could find h2n,
That script could make my life easier...
It's the script that changes de hosts into db. files...
Thanks
------------------------------
Date: Thu, 09 Jul 1998 17:03:02 -0400
From: "Larry P. Rosen" <lrosen@alum.mit.edu>
To: Glenn West <westxga@ptsc.slg.eds.com>
Subject: Re: kill 0 always true? How test pid?
Message-Id: <35A53006.B899DC6B@alum.mit.edu>
OK. I did mess up with getting the grandchild's pid to the
grandparent. When I modified the code to pass the pid to
the grandparent, the code worked fine. However, I now
have code where the process being checked is the child,
not the grandchild. In this case (see code below) the
kill 0 always returns 1, because even though the child
process finished, and isn't visible with unix ps, it
is a "zombie in waiting" until the parent does a "wait()"
for it. By the way, I could just do a waitpid(), as
long as it is non-blocking, to test if the child is
running. Now I need to know if waitpid() is non-blocking
on our platforms (irix 6.2, irix 6.4, Solaris, Linux) and
what the flag is that I use. If not, I can modify my code
to do a grandchild instead. Thanks.
#!/usr/local/bin/perl -w
# Can a process send kill 0 to a running child and
# get back 1 (true), then send kill 0 to a non-existent
# process and get back 0 (false)?
use strict;
# Fork off a child:
my $pid = fork();
# parent will have child's pid in $pid.
# child will have 0 in $pid.
die "fork failed: $!" if (!defined($pid) || ($pid < 0));
unless ($pid) { # child
print "Child - process is $$.\n";
print "Child - Sleep for 10 seconds at ", time, ".\n";
sleep (10);
print "Child done at ", time, ".\n";
exit 0; # child exits.
}
# parent
sleep (3); # Give child a chance to go to sleep.
print "Parent - Send kill 0 to child pid $pid at ", time, ".\n";
my $status = kill 0, $pid;
print "Parent - signal sent by ", time, ".\n";
print "Parent - kill returned: $status\n";
# wait for child to end by sleeping longer.
sleep (10);
print "Parent - test child again at ", time, ".\n",
" time should be > Child done time.\n";
$status = kill 0, $pid;
print "Parent - signal sent by ", time, ".\n";
print "Parent - kill returned: $status\n";
waitpid ($pid, 0); # Reap dead child.
print "Parent done.\n";
1;
------------------------------
Date: 9 Jul 1998 17:04:35 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <6o3b93$c7l$1@tholian.cse.psu.edu>
I like the current charter and Randal has done a fine job moderating
the group. Let the commercial interests advertise in the Perl Journal
or some other median.
Commercial products and services like the ActiveState IDE and the Perl
Conference have been adequately promoted elsewhere.
John
groenveld@acm.org
------------------------------
Date: Thu, 09 Jul 1998 21:15:24 GMT
From: mad_ahmad@my-dejanews.com
Subject: nother question: how do you declare a SAFEARRAY?
Message-Id: <6o3btc$fg4$1@nnrp1.dejanews.com>
twice no one answered my question on OLE with excel --how to store a column in
an array without a slow loop that does cell by cell.
so i guess no one knows.
anyway, i've given up on that for now so here's another question if anyone can
help me with it, i'd be much obliged.
how does one declare a SAFEARRAY?
I want to create one, send it to a program thru OLE to a function that mutates
it. and get it back so I can print it.
Is that possible or have i overestimated the power of perl?
Thanks,
Ahmad Saeed
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 09 Jul 1998 21:19:24 GMT
From: jevon@my-dejanews.com
Subject: parsing a template and replacing certain words (from a form)
Message-Id: <6o3c4s$fj9$1@nnrp1.dejanews.com>
I am trying to parse through a template and then replace all instances of
$name with it corresponding $value ($name[5] = $value[5] etc...) This is my
code.
print "Content Type: text/html\n\n";
read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
@pairs=split(/&/,$temp);
foreach $item (@pairs) {
($key,$content)=split (/=/,$item,2);
$content=~tr/+/ /;
$content=~ s/%(..)/pack("c",hex($1))/ge;
@value = (@value, $content);
@name = (@name, $key);
}
open(TEMPLATE, "<tem.html");
@lines = <TEMPLATE>;
close(TEMPLATE);
foreach $lines (@lines) {
$num = 0;
foreach $name (@name) {
#($line) = $lines =~ s/$name/$value[$num]/ig;
$num = $num + 1;
}
#@out = (@out, $line);
}
open(OUT, ">out.html");
print OUT @out;
close(OUT);
I know it's messy and I am not used to perl. But I am having a lot of trouble
getting this to work.. could someone sujest ANYTHING...
I really appreciate it.
Jevon MacDonald
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 9 Jul 1998 22:33:05 GMT
From: bobmacd+clpm@netcom.com (Bob MacDowell)
Subject: Re: Perl4 and 5 (was: random writes)
Message-Id: <bobmacdEvuMn5.FuC@netcom.com>
Danger! Danger! Advocacy discussion ahead!
Tom Christiansen <tchrist@mox.perl.com> writes:
>:and anyway I use
>:perl4, which doesn't have the command, far more than I use perl5, so I
>:eschew perl5 idioms.
>You really shouldn't do that, you know. :-)
Everywhere I have a big OS (large Macs, Win32, Unix) I have installed
Perl5, of course, simply because I can. But that isn't everywhere.
Anyway, I am an old-school computer game programmer. Back when you had
to write a game that would make other game programmers go "Hey, the
hardware can't do that!" using 8192 bytes of ROM and 4096 bytes of RAM,
video buffer included. I have an appreciation for compact and elegant,
which I consider perl4 to be.
But then, I also prefer hand tools over power tools for small work.
>I don't think there's any excuse whatsoever for being locked into
>Perl4. None.
If your box is too small for perl5, or if it's someone else's box.
I had to do a TCP/IP renumbering on about 100 PC's. Thank God, all the
IP number edits were in text files (SYSTEM.INI and such.) Of course I'm
not going to hand-edit 300 text files. :-)
But alas, with the mishmash of hardware, the only environment common to
all of them was a diskette, 1.2 or 1.44 megs. A Win95B bootstrap loader
would fit on this, leaving 800k of disk and 500k of RAM for perl, the
database, and the script.
The weekend of the IP renumbering got shoved back, to the same weekend
as a big and very wild festival at a hot springs. I was not going to
miss that. My boss would let me go IF I could automate the process where
2 other staff could accomplish it in a Saturday.
The critical workflow question here is: How can I attend the festival?
The answer was a perl4 that fit in 300k.
This month, we're converting from QuickMail/Mac to Netscape Mail/PC.
I have some Perl that converts the filed mail and address books (and I
even use the perl5 Socket module to make HTTP queries to our Directory
webpage.) MacPerl5 runs great on machines with 12MB or more. But it'd
be nice if it'd run on the 4MB Mac SE's too.
So I maintain that perl4's compactness makes it yet still useful, for
some people. I realize most people who use Perl as intently as I do
work in reasonably state-of-the-art, fully-32-bit environments, where
Win95/MacOS is the minimum OS, and NT or Unix are the norm. If that
were me, I too might dive into the capabilities of perl5 and never
look back.
But my chosen avocation is to convert the obsolete into the new, and that
necessitates working with the obsolete. That sometimes means using
compact and elegant tools *grin* and this pleases me, as long as the
tools work as I expect them to. :-)
-Bob
------------------------------
Date: Thu, 9 Jul 1998 17:03:03 -0400
From: Bryan T Hoch <bth@acsu.buffalo.edu>
Subject: Placing output from System() call into an array from the file that calls it?
Message-Id: <Pine.GSO.3.96.980709165651.788A-100000@callisto.acsu.buffalo.edu>
In one of my Perl programs, I have a line that calls a system call to see
who is on line.
if ((system ("rusers -l $hostA | fgrep $personA")) == 0){
}
Basically it will check to see if $personA is on $hostA and if so, it will
place it in an array (somewhere in the if statement). At least that's what
I want it to do.
Right now, what it does is just spit out every single user on $hostA to
the screen (it doesn't take into account it's only looking for $personA.
How do I make it so it doesn't print it to the screen (rather to an array
or string in the program) and how do I do it so it only checks for
$personA, and not everyone on that host?
Thanks a lot to anyone who tries to help.
Bryan H
------------------------------
Date: Thu, 9 Jul 1998 13:19:53 -0500
From: davidkirby@nmcc.sprintspectrum.com ("Kirby, David")
Subject: Q:Switching Formats
Message-Id: <cUSapSprintPCSlOSSC2-980709181953Z-169992@ossc2.sprintspectrum.com>
How can I get my format header to print after switching formats mid-page
(instead of waiting for TOP)? TIA!
==========
David Kirby
------------------------------
Date: Thu, 09 Jul 1998 21:45:46 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Removing the ^M character
Message-Id: <6o3dqh$sm5$2@strato.ultra.net>
[ posted and mailed ]
<mikane@shell3.ba.best.com> wrote:
-> I am having trouble removing the ^M character from the end of a line.
I'd worry more about preventing the ^Ms than how to get rid of them.
If you upload ascii files in ascii mode, you won't get the ^M.
s/\cM//;
should fix the ones you already have.
HTH
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972
Ext: 1949 and let the jerk that answers know
that his toll free number was sent as spam. "
------------------------------
Date: 9 Jul 1998 22:29:38 GMT
From: <mikane@shell3.ba.best.com>
Subject: Re: Removing the ^M character
Message-Id: <6o3g8i$349$1@nntp1.ba.best.com>
Thanks to Bob and others who have tried to assist.
s/\cM// did not work neither did s/\r\n/\n/gm.
The ^M character was not generated by a bin ftp, rather by Netscape 3.0 posting
text from a textarea box.
I can manually go in and delete the ^M but I am trying to use perl code to do
so.
Mike
Bob Trieger <sowmaster@juicepigs.com> wrote:
: [ posted and mailed ]
: <mikane@shell3.ba.best.com> wrote:
: -> I am having trouble removing the ^M character from the end of a line.
: I'd worry more about preventing the ^Ms than how to get rid of them.
: If you upload ascii files in ascii mode, you won't get the ^M.
: s/\cM//;
: should fix the ones you already have.
: HTH
: Bob Trieger
: sowmaster@juicepigs.com
: " Cost a spammer some cash: Call 1-800-400-1972
: Ext: 1949 and let the jerk that answers know
: that his toll free number was sent as spam. "
------------------------------
Date: 9 Jul 1998 15:45:14 -0700
From: hirano@Xenon.Stanford.EDU (Kelly Hirano)
Subject: Re: Removing the ^M character
Message-Id: <6o3h5q$c5c@Xenon.Stanford.EDU>
In article <6o3287$rj0$1@nntp1.ba.best.com>,
<mikane@shell3.ba.best.com> wrote:
>I am having trouble removing the ^M character from the end of a line.
>
>I have tried
>
>$line=~s/\r\n$//;
>$line=s/\r$//;
>$line=s/\n$//;
>
>neither is working for me.
>
>Is there another method?
>
>I want to keep carriage returns within $line and delete the trailing.
$line =~ s/\015//;
--
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: Thu, 09 Jul 1998 16:36:04 -0500
From: John Adams <John.Adams@BentonvilleAR.ncr.com>
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <35A537C4.6863@BentonvilleAR.ncr.com>
> In article <6lsl68$jtr$1@csnews.cs.colorado.edu>,
> tchrist@mox.perl.com (Tom Christiansen) wrote:
> > The ``no experience required'' is a give-away that the book hopes to address
> > rank beginners. In fact, it says you don't have to be a programmer (p xvii).
> > Then later (p26) it says that we're all ``computer nerds'' so won't mind
> > using I as a verb. This seems contradictory.
Seems is not is, even though it might seem that way.
I worked with a guy not too long ago who could just run rings around me
with anything UNIX, including physically working on the machines
(despite the fact that he had a malformed and largely useless hand).
He was just plain better than me.
Then (I was theoretically his superior at the time) I asked him to make
a simple hack to a shell script. A _really_ simple hack. I wrote a rough
of it out for him and said something along the lines of, "See me if you
have any problems," and forgot about it...until MY boss (for whom the
hack was being done) asked me why it hadn't been done.
The guy just couldn't script. I doubt that he'll ever learn to program.
And he most certainly was a computer nerd. I miss him--he was a great
guy--still answers my emails when something he maintained gets
fussy--I'm a little sorry he got that good job in Ohio.
ObBuffaloSpringfield: No Acronym Here
John "if test 11 fails again, I'm going home to have a fit" A
------------------------------
Date: 09 Jul 1998 23:35:23 +0200
From: Gisle Aas <aas@sn.no>
Subject: Re: secure HTTPS connection module?
Message-Id: <m3emvuhfms.fsf@furu.g.aas.no>
Douglas Galbraith <douglas@home.com> writes:
> Is there a module specifically used for HTTPS connections? (I've
> grep'ed the doc html pages, and can't find anything.)
>
> I've tried the script below, and "$content" is always empty. I've tried
> several secure sites, and gotten the same results (but when I've tried
> this url with a browser, I DO get a response).
The program works for me. Do you have SSLeay installed on your
machine? The LWP README says:
If you want to access sites using the https protocol, then you need to
install the Crypt-SSLeay modules first. (The Net::SSLeay module is not
supported any more.)
> #!/usr/bin/perl -w
> use LWP::UserAgent;
>
> $ua = LWP::UserAgent->new;
> $request = HTTP::Request->new(GET =>
> 'https://trading27.schwab.com/trading/miniquote?QuotesSecurityName=IBM');
> $response = $ua->request($request);
> $content = $response->content();
> print $content . "\n";
Might be a good idea to check the outcome of the request:
if ($response->is_success) {
print $response->content;
} else {
print $response->status_line, "\n";
}
--
Gisle Aas
------------------------------
Date: Thu, 9 Jul 1998 14:39:39 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Silly things to do in Perl (or: is that Laptop waterproof?)
Message-Id: <MPG.100ed8752ce21c4e9896fc@nntp.hpl.hp.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
In article <35A52A2A.A70A5D7D@yahoo.com> on Thu, 09 Jul 1998 16:38:04 -
0400, Dave Bushong <spamfree@yahoo.com> says...
> F.Quednau wrote:
>
> > $marker = shift;
> > $what = $marker eq "morse" ? "morse_to_alphabet" : "alphabet_to_morse";
> >
> > $morse{a} = ".-"; $morse{q} = "--.-";$morse{6} = "--...";
> > $morse{b} = "-...";$morse{r} = ".-."; $morse{7} = "---..";
...
> I would also suggest that you do something like $morse{a} = "didah", since when
> you read it out loud it sounds like Morse code sounds.
I assume you mean "ditdah" so it would be easier to back-
convert regularly.
> Here is a brute force conversion program, originally from Dave Jenkins'
> tomorsedi.sed program, then converted with s2p and trimmed ever-so-slightly:
>
> #!/usr/local/bin/perl
>
> while (<>) {
> $_ = lc $_;
> chomp;
> s/-/_/g;
> s/\./\.-\.-\.- /g;
> s/\$/\.\.\.-\.\.- /g;
> s/\?/\.\.--\.\. /g;
...<and on and on and on and on>
"Brute force" indeed! It is not a Perl approach. Why do you want to
subject every character to God-knows-how-many scans?
The hash approach seems most appropriate, though the initialization shown
above has two problems: it is much too wordy, and it fails on -w.
my %morse = (
'a' => '.-',
'b' => '-...',
...
And, as the encodings are unique, the reverse-transformation hash is
trivial to generate:
my %alpha = reverse %morse;
The conversion of each line (after chomping) is simply:
s/(.)/$morse{lc $1} /g;
To ensure that every character is in the hash, one might do a pre-scan:
/([^a-zA-Z\d ])/ and die "Can't translate '$1'.";
or replace them quietly by something that *is* in the hash, say '_':
tr/a-zA-Z0-9 /_/c;
Lots less processing, and much easier to read and maintain.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 9 Jul 1998 21:50:12 GMT
From: "Ken Stephenson" <ken_stephenson@corp.srs.com>
Subject: sort utility
Message-Id: <01bdab83$7ed69720$1432f026@ken.corp.srs.com>
I am looking for a perl sort subroutine with similar capabilities to the
Unix sort utility that I can uses when porting to Windows 95. Specifically
I need to be able to perform case insenstive sorts, dictionary sorts, and
specify sort fields on arrays and files. I was kind of surprised that some
of these basic features are not built into the Perl sort function.
Any suggestions would be greatly appreciated.
Ken Sytephenson
------------------------------
Date: Thu, 09 Jul 1998 22:04:55 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: sort utility
Message-Id: <6o3eue$sm5$3@strato.ultra.net>
[ posted and mailed ]
"Ken Stephenson" <ken_stephenson@corp.srs.com> wrote:
-> I am looking for a perl sort subroutine with similar capabilities to the
-> Unix sort utility that I can uses when porting to Windows 95. Specifically
-> I need to be able to perform case insenstive sorts, dictionary sorts, and
-> specify sort fields on arrays and files. I was kind of surprised that some
-> of these basic features are not built into the Perl sort function.
RTFFAQs
`How_do_I_sort_an_array_by (anything)?'
`How do I sort a hash (optionally by value instead of key)?'
Come straight from PerlFAQ4
Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972
Ext: 1949 and let the jerk that answers know
that his toll free number was sent as spam. "
------------------------------
Date: Thu, 9 Jul 1998 15:09:03 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: sort utility
Message-Id: <MPG.100edf5b683b9d5a9896fd@nntp.hpl.hp.com>
In article <01bdab83$7ed69720$1432f026@ken.corp.srs.com> on 9 Jul 1998
21:50:12 GMT, Ken Stephenson <ken_stephenson@corp.srs.com> says...
> I am looking for a perl sort subroutine with similar capabilities to the
> Unix sort utility that I can uses when porting to Windows 95. Specifically
> I need to be able to perform case insenstive sorts, dictionary sorts, and
> specify sort fields on arrays and files. I was kind of surprised that some
> of these basic features are not built into the Perl sort function.
By email, you will receive an automatic response telling you, among other
things, how to find the Perl FAQ. Search it for 'sort' and you will
find (in perlfaq4):
How do I sort an array by (anything)?
Isn't that amazing?
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 09 Jul 1998 22:34:04 GMT
From: tnguru@termnetinc.com (Ben Coleman)
Subject: Re: sort utility
Message-Id: <35a54213.178574085@news.mindspring.com>
On 9 Jul 1998 21:50:12 GMT, "Ken Stephenson" <ken_stephenson@corp.srs.com>
wrote:
>I am looking for a perl sort subroutine with similar capabilities to the
>Unix sort utility that I can uses when porting to Windows 95. Specifically
>I need to be able to perform case insenstive sorts, dictionary sorts, and
>specify sort fields on arrays
All these need is the appropriate comparison subroutine. It's not that
hard. See the examples given in perlfunc. Also take a look at the
Sort::Fields module on CPAN.
>and files.
Take a look at File::Sort.
Ben
--
Ben Coleman
Senior Systems Analyst
TermNet Merchant Services, Inc.
Atlanta, GA
------------------------------
Date: Thu, 09 Jul 1998 16:22:56 -0500
From: Dan Baker <dtbaker_@flash.net>
Subject: Re: trigger sending a Free Newsletter
Message-Id: <35A534B0.6356@flash.net>
HO BigD wrote:
>
> Hello,
>
> I need help! I am trying to set up a "subscribe to our newsletter" type of form
> on our website. Does anyone know of a perl script that will do this? I know
> they are available but have been unable to find one.
>
> Thanks,
>
> Darren
------------------
This is not a perl solution, but if you don't want to mess with the
upkeep of the database, or sending bulk mail at all, you can accomplish
the same thing by using NetMind to do it for you. I've used it on
several websites, and it's a super way to let readers control their own
notification when you update a page. check out http://www.netmind.com
Dan
------------------------------
Date: 9 Jul 1998 22:56:04 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: using a variable only once
Message-Id: <6o3hq4$3o5@news-central.tiac.net>
In article <01bdab73$dae87ca0$915c5093@lfalkenhagen.dhs.state.tx.us>,
Lee Falkenhagen <falkenl@hotmail.com> wrote:
>In my main program, I declare several global variables such as
>$::CURDAY = "4/1/98";
>
>If I do not use that variable anywhere else in the main program, but, do
>use it in a function I call, I get the following error:
>
>Name "main::CURDAY" used only once: possible typo at ./irsbatch.pl line 35.
>
>Is there a way to get rid of this error?
You can say something like
use vars qw/$CURDAY/;
in the main package (use vars can't declare variables in another package)
or if you're declaring constants you can say
use constant CURDAY => 'whatever';
perldoc will display the documentation for both vars and constant (if your
installation has them...)
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: Thu, 09 Jul 1998 21:15:39 GMT
From: John Porter <jdporter@min.net>
Subject: Re: what's wrong with this code?
Message-Id: <35A534C3.2446@min.net>
Mark Castillo wrote:
>
> hi, every time i run this it always says prints "Down!".
> I try it with other hosts, and it always says it.
Works fine for me. Maybe there's something wrong with your
IP configuration, e.g. DNS. Did you try it with IP numbers
too? What happens when you use the 'ping' command at the
prompt? As in
% ping localhost
--
John Porter
------------------------------
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 3110
**************************************