[15756] in Perl-Users-Digest
Perl-Users Digest, Issue: 3169 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 25 21:10:38 2000
Date: Thu, 25 May 2000 18:10:17 -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: <959303416-v9-i3169@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 25 May 2000 Volume: 9 Number: 3169
Today's topics:
Re: Newbie - need to rip images from URL (Randal L. Schwartz)
Re: Newbie - need to rip images from URL patrickshroads@my-deja.com
Re: Newbie-- Sendmail <agichen@my-deja.com>
Re: NEWBIE: Variable = Command Line Results <mikek@worldwebserver.com>
Re: newsgroup archives <lr@hpl.hp.com>
Re: newsgroup archives <godzilla@stomp.stomp.tokyo>
Re: Oraperl hangup - help! <Ray.Decker@vt.edu>
oraperl works on one machine but not another mikimoore@my-deja.com
Re: Perl unusable as a programming language <lr@hpl.hp.com>
Re: Q: C-Forge? ymiron@my-deja.com
Timing ? <Info@dynasoft.co.nz>
Re: Timing ? (Abigail)
using perldoc [was Re: forking] <Jonathan.L.Ericson@jpl.nasa.gov>
Re: What alternative to PPM ? <rootbeer@redcat.com>
Re: What alternative to PPM ? cfrjlr@my-deja.com
Where to download Perl binary? <hstan@technologist.com>
Re: Where to download Perl binary? <jeff@vpservices.com>
Where to dwnld perl 5 <hstan@technologist.com>
Re: Where to dwnld perl 5 (Clinton A. Pierce)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 25 May 2000 15:15:34 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Newbie - need to rip images from URL
Message-Id: <m1vh02i8e1.fsf@halfdome.holdit.com>
>>>>> "Makarand" == Makarand Kulkarni <makarand_kulkarni@My-Deja.com> writes:
>> I have a MS SQL Server 7 database table with URLs of images. On a
>> regular basis I need to rip the image from that url (download the image
>> to my machine). So I guess I need some sort of Database library and
>> some sort of HTTP or some thing. Am I in the ballpark? Any ideas? And
>> how would I even go about doing this whole thing?
Too much typing. Replace all this...
Makarand> #!/usr/local/bin/perl5 -w
Makarand> use LWP::UserAgent;
Makarand> # this is the gif to grab
Makarand> my $url ="http://developer.irt.org/images/irt-sm.gif";
Makarand> # Create a user agent object
Makarand> my $ua = new LWP::UserAgent;
Makarand> # Create a request
Makarand> my $req = new HTTP::Request GET => $url ;
Makarand> $req->content_type('application/x-www-form-urlencoded');
Makarand> # Pass request to the user agent and get a response back
Makarand> my $res = $ua->request($req);
Makarand> binmode ( STDOUT );
Makarand> print STDOUT $res->content ; # you can capture this to a file eg. X.gif
Makarand> and view with browser.
Makarand> ---
with this:
use LWP::Simple;
my $url ="http://developer.irt.org/images/irt-sm.gif";
getprint($url);
<aside type="insightful, but slightly tongue in cheek">
Why do people insist on doing it the hard way? Why don't people read
"perldoc lwpcook"? Why do people read "blind leading the blind" web
articles instead of going back to the authoritative sources? Why why why?
</aside>
--
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, 25 May 2000 22:49:45 GMT
From: patrickshroads@my-deja.com
Subject: Re: Newbie - need to rip images from URL
Message-Id: <8gkam3$tf$1@nnrp1.deja.com>
Thanks so much for your prompt reply... however you overestimated my
PERL knowledge :)
How would I capture the response to a file?
Thanks
In article <392D9D26.DFDFC029@My-Deja.com>,
Makarand Kulkarni <makarand_kulkarni@My-Deja.com> wrote:
> > I have a MS SQL Server 7 database table with URLs of images. On a
> > regular basis I need to rip the image from that url (download the
image
> > to my machine). So I guess I need some sort of Database library and
> > some sort of HTTP or some thing. Am I in the ballpark? Any ideas?
And
> > how would I even go about doing this whole thing?
>
> #!/usr/local/bin/perl5 -w
>
> use LWP::UserAgent;
>
> # this is the gif to grab
> my $url ="http://developer.irt.org/images/irt-sm.gif";
>
> # Create a user agent object
> my $ua = new LWP::UserAgent;
>
> # Create a request
> my $req = new HTTP::Request GET => $url ;
> $req->content_type('application/x-www-form-urlencoded');
>
> # Pass request to the user agent and get a response back
> my $res = $ua->request($req);
> binmode ( STDOUT );
> print STDOUT $res->content ; # you can capture this to a file eg.
X.gif
> and view with browser.
> ---
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 26 May 2000 00:39:48 GMT
From: Agi <agichen@my-deja.com>
Subject: Re: Newbie-- Sendmail
Message-Id: <8gkh4j$5i7$1@nnrp1.deja.com>
Sir,
Thanks for your suggestions !!
Best Regards,
Agi Chen
In article <392D379B.EAF4AB0D@mail.uca.edu>,
Cameron Dorey <camerond@mail.uca.edu> wrote:
> Agi wrote:
> >
> > Hello,theres
> > I want to sent a HTML file to someone using Perl.
> > Which module can achieve my goal ??
> >
> > ps.I'm new in Perl.
>
> Are you working on Windows, as your headers suggest? If so, just read
> the Activestate FAQ about sending mail from Winxx.
>
> Finding the FAQ ->**on your hard disk through the start menu**<- will
> help you infinitely more than just getting a quick answer to this
> specific question.
>
> Cameron
>
> --
> Cameron Dorey
> Associate Professor of Chemistry
> University of Central Arkansas
> Phone: 501-450-5938
> camerond@mail.uca.edu
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 25 May 2000 22:07:10 GMT
From: Mike King <mikek@worldwebserver.com>
Subject: Re: NEWBIE: Variable = Command Line Results
Message-Id: <392D840C.835B5406@worldwebserver.com>
Julian Cook wrote:
>
> Hello folks!
> As usual, I bow to the collective genius of my peers.
> I ask what may be quite possibly the simplest question that this forum
> has seen
> in a while probably
>
> Here's my code. (Line numbers added only for clarity and wishful BASIC
> thinking..hee hee)
>
> 1 #!/usr/local/bin/perl
> 2 $file = "testfile.txt";
> 3 $count = 'wc -l < $file';
Line 3 should read:
$count = `wc -l <$file`;
But that's kind of sily, because you could use perl to count the lines
in the file easily and faster:
$count = 0;
open FILE, "$file" or die "$!\n";
while(<FILE>)
{
$count++;
}
close FILE;
# $count now contains the number of lines in $file
-Mike King
--
Administrator - ZenSearch Inc.
http://www.zensearch.com
Assoc. System Administrator - World Web Server, Inc.
http://www.worldwebserver.com
Get Paid to Surf the Web!
http://www.alladvantage.com/home.asp?refid=ANT-431
http://www.getpaid4.com/?mike_k
------------------------------
Date: Thu, 25 May 2000 16:28:49 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: newsgroup archives
Message-Id: <MPG.139757086ee7245798aae3@nntp.hpl.hp.com>
In article <392DA26F.31093EBA@stomp.stomp.tokyo> on Thu, 25 May 2000
15:00:15 -0700, Godzilla! <godzilla@stomp.stomp.tokyo> says...
> Eli Mansour wrote:
>
> > Is there archives for this newsgroup.
>
> Deja Vu is a fairly decent source for
> archived articles:
>
> http://www.dejanews.com/
...
> ... Anyhow,
> upper right, funny looking arrow thing
> which is a hot link. This will direct
> you into their search facility.
This will do it faster. I bookmarked it, because who can remember? :-)
http://www.deja.com/home_ps.shtml
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 25 May 2000 16:50:55 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: newsgroup archives
Message-Id: <392DBC5F.159DDCEF@stomp.stomp.tokyo>
Larry Rosler wrote:
>
> In article <392DA26F.31093EBA@stomp.stomp.tokyo> on Thu, 25 May 2000
> 15:00:15 -0700, Godzilla! <godzilla@stomp.stomp.tokyo> says...
> > Eli Mansour wrote:
> > > Is there archives for this newsgroup.
> > Deja Vu is a fairly decent source for
> > archived articles:
> > http://www.dejanews.com/
> This will do it faster. I bookmarked it, because who can remember? :-)
Certainly not me. I am an airhead. This
I will never deny and explains why my
daughter keeps a rope tied around my
right ankle when at home and in shopping
malls. I wander off, both verbally
and physically.
> http://www.deja.com/home_ps.shtml
Hey! Code which works correctly!
* bookmarked *
Hmm... why didn't I think of doing
it this way... well.. where was I..
Godzilla!
------------------------------
Date: Thu, 25 May 2000 20:55:40 -0400
From: Ray Decker <Ray.Decker@vt.edu>
Subject: Re: Oraperl hangup - help!
Message-Id: <392DCB8C.E3A6BB56@vt.edu>
Makarand Kulkarni wrote:
>
> > The following script hangs our Oracle instance after 16,285 records. It
>
> If you think this problem is Oraperl specific then you should try using
> DBI and DBD::oracle. Oraperl was useful in the good old days when
> Perl 4 was around. Oraperl as it exists for Perl 5 is just a cool wrapper
> around DBI and DBD::Oracle. However, it does not expose all of the
> power that DBI can provide to users.
> --
Actually, this problem first surfaced with a C program using OCI
directly. Then just recently popped up again when I started on this
perl application. It has been around for a while, but since it takes
10,000 to 20,000 transactions it hasn't happened often.
I have a C/OCI program that does the same thing that the Oraperl DO
does, oopen, oparse, oexec, and oclose. It hangs after the same number
of transactions. I personally think that it's an Oracle problem. I'm
not a real experienced OCI programmer and quite frankly trusted Oraperl
more than myself to make the right decisions on the OCI parms.
This seems so basic, just repeated inserts, that I was hoping someone
would have already have experienced it and solved it.
The Oraperl program is some much simplier that it seemed a reasonable
place to start searching for a solution.
------------------------------
Date: Thu, 25 May 2000 21:59:40 GMT
From: mikimoore@my-deja.com
Subject: oraperl works on one machine but not another
Message-Id: <8gk7o3$un8$1@nnrp1.deja.com>
Background -
The following code is run on two UNIX systems both SUNS.
The code tests a fix used to select data
from an Oracle table in which
the field is defined as a char (not a varchar). A char
field requires the entire length of the string be matched
(must be blank-filled). Thus, the perl script
must create a blank filled string before
being bound to the oracle cursor.
TEST 1 - The first test hardcodes the
substitution variable into the select
statement. This works fine on both
systems.
TEST 2 - The second test uses an
unpadded string. This test fails on
both system (the original situation we
are trying to fix.
TEST 3 - The last test uses a padded string.
This test is the solution. It works fine
on the test system yet fails on the
production system.
Any ideas why the production system cannot
get a successful return from a select using
a padded string? They are using the same
executable for perl and the same ascii
cgi-lib.pl file.
****************************************
code:
#!/fakedir/perl
use Oraperl;
require "./cgi-lib.pl";
$ENV{ORACLE_HOME} = "/fakedir/8.1.5";
$user="fakeuser";
$pswd="fakepwd";
$lda = &ora_login("fakesid",$user,$pswd) || die("cannot login");
print "\n";
print "----------------------------------\n";
print "TEST 1 - Success on both machines.\n";
print "starting hardcoded select.\n";
$sel_stmt="select id from miki_char_test where id = 'zz' ";
$sel_cur=&ora_open($lda,$sel_stmt);
while (($id) = &ora_fetch($sel_cur))
{
warn "Truncated!!!" if $ora_errno == 1406;
print "-----> $id\n";
}
warn $ora_errstr if $ora_errno;
print "done with hardcoded select.\n\n";
print "----------------------------------\n";
print "TEST 2 - Failure on both machines.\n";
print "starting unpadded select.\n";
$sel_stmt="select id from miki_char_test where id = :1";
$sel_cur=&ora_open($lda,$sel_stmt);
&ora_bind($sel_cur,'zz');
while (($id) = &ora_fetch($sel_cur))
{
warn "Truncated!!!" if $ora_errno == 1406;
print "-----> $id\n";
}
warn $ora_errstr if $ora_errno;
print "done with unpadded select.\n\n";
print "----------------------------------\n";
print "TEST 3 - Success on test machine.\n";
print " Failure on production machine\n";
print "starting padded select.\n";
&ora_bind($sel_cur,'zz ');
while (($id) = &ora_fetch($sel_cur))
{
warn "Truncated!!!" if $ora_errno == 1406;
print "-----> $id\n";
}
warn $ora_errstr if $ora_errno;
print "done with padded select.\n\n";
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 25 May 2000 14:20:13 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Perl unusable as a programming language
Message-Id: <MPG.139738e4cf27566f98aae2@nntp.hpl.hp.com>
In article <8gjh00$cni$1@nnrp1.deja.com> on Thu, 25 May 2000 15:31:12
GMT, The Glauber <theglauber@my-deja.com> says...
...
> After reading a lot of posts in this thread, i'm not sure if the
> problem is the quality of the perl interpreter or the lack of formal
> definition of the language. Which one is it?
>
> Certainly Perl has enough features already? Should the effort now go
> towards cleaning up the interpreter? (Or towards learning Java? :-))
There is no glory in improving quality of implementation.
A company selling commercial software products (Micro$..t excepted, of
course :-) can -- and usually does -- impose quality criteria and
metrics on its employees. But not on volunteers.
I wonder how other open-source efforts, in particular Linux, deal with
quality-of-implementation-and-documentation issues.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 25 May 2000 23:28:18 GMT
From: ymiron@my-deja.com
Subject: Re: Q: C-Forge?
Message-Id: <8gkcu2$2io$1@nnrp1.deja.com>
A time limited version of the full commercial package can be
obtained here:
http://www.codeforge.com/cgi-bin/Custom/NevinKaplan/Register.cgi?
Register=Evaluation
I'll keep my _very_ biased opinion of the IDE to
myself: :)
Best Regards,
Yuri Mironoff
Code Forge, Inc
In article <mtgW4.20$Dj2.4619@dummy.bahnhof.se>,
"Thomas Åhlen" <thomas2@dalnet.se> wrote:
> Well searching some more and i found this one which looks really nice.
> Since it is commercial i can't donwload it and try it in Perl mode.
>
> Anyone with perl coding experiance using this editor/IDE?
>
> http://www.codeforge.com/
>
> -Thomas Å
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 26 May 2000 10:39:09 +1200
From: "Lew" <Info@dynasoft.co.nz>
Subject: Timing ?
Message-Id: <iYhX4.24713$usz4.17760435@news.xtra.co.nz>
I need to activate some code after a time period,
tried the following without success.
Any ideas why ?
#!/usr/bin/perl
use CGI qw(:standard);
print header;
$a = "Testing 123<br>";
print $a;
&timer;
sub timer {
$SIG{'SIGALRM'} = sub{&drawer};
alarm(5);
}
sub drawer {
$a = "Print this after 5 seconds";
print $a;
}
Thanks,
Lew.
------------------------------
Date: 25 May 2000 23:10:33 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Timing ?
Message-Id: <8gkbt9$86a$2@news.panix.com>
On Fri, 26 May 2000 10:39:09 +1200, Lew <Info@dynasoft.co.nz> wrote:
++ I need to activate some code after a time period,
++ tried the following without success.
++
++ Any ideas why ?
You finish the program before the alarm gets activated.
You could just do a sleep, although I'm baffled why you would want to
delay printing stuff in a CGI program in the first place.
Abigail
------------------------------
Date: Thu, 25 May 2000 16:13:22 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: using perldoc [was Re: forking]
Message-Id: <392DB392.3AF83AF4@jpl.nasa.gov>
bhelton@my-deja.com wrote:
> I'm trying to do something I thought would be simple. It may still be
> and I just have been using the wrong approach. I want to fork from my
> perl program and run a du -sk from the child process and while the du -
> sk is calculating disk usage I want the parent to report to the screen
> the progress. Nothing fancy, I just want to do like a lot of unix
> package scripts do and have #'s scroll across for every second the
> child process is running calculating the disk usage. Any pointers
> would be more than appreciated. Thanks,
Have you read 'perldoc -f fork'? What about perlipc? perlopentut is
also useful. Hopefully you know how to print #'s and count seconds. If
you can't get something working after reading the documentation and the
FAQS, post some code.
Jon
--
Knowledge is that which remains when what is
learned is forgotten. - Mr. King
------------------------------
Date: Thu, 25 May 2000 15:10:34 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: What alternative to PPM ?
Message-Id: <Pine.GSO.4.10.10005251459400.14618-100000@user2.teleport.com>
On Thu, 25 May 2000 cfrjlr@my-deja.com wrote:
> We are testing behind a secure firewall where we do not have access to
> internet (deliberately).
>
> What alternatives are there to using PPM to install perl packages on
> our test machines ?
You mean, like Linux? :-)
> For example, we would like to install perl tk.
Yes, that works on Linux. So, what's the problem? :-)
I suspect that you are using Windows, and you really want to see what the
PPM FAQ says about this.
http://www.activestate.com/Products/ActivePerl/docs/faq/ActivePerl-faq2.html
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 25 May 2000 23:15:20 GMT
From: cfrjlr@my-deja.com
Subject: Re: What alternative to PPM ?
Message-Id: <8gkc5r$1ss$1@nnrp1.deja.com>
Thanks to Tom and Glauber.
In article <Pine.GSO.4.10.10005251459400.14618-
100000@user2.teleport.com>,
Tom Phoenix <rootbeer@redcat.com> wrote:
> On Thu, 25 May 2000 cfrjlr@my-deja.com wrote:
>
> > We are testing behind a secure firewall where we do not have access
to
> > internet (deliberately).
> >
> > What alternatives are there to using PPM to install perl packages on
> > our test machines ?
>
> You mean, like Linux? :-)
>
We have no customers using Linux, we do not support that environment.
>
> I suspect that you are using Windows, and you really want to see what
the
yes
> PPM FAQ says about this.
>
>
http://www.activestate.com/Products/ActivePerl/docs/faq/ActivePerl-
faq2.html
>
Ah yes. Upon reading the FAQ there is a section which begins thus:
"If you use a proxy server or firewall, you might have trouble running
PPM. Here is the solution."
Thanks again,
Charles R.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 26 May 2000 01:37:33 +0100
From: Hock Seng Tan <hstan@technologist.com>
Subject: Where to download Perl binary?
Message-Id: <392DC74D.741C12AD@technologist.com>
Hi there,
I am totally new with perl, do you know where I can download a copy of
Perl
ver. 5 for use under Windows platform ? and is it free ?
Thanks,
Hock
------------------------------
Date: Thu, 25 May 2000 17:41:52 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Where to download Perl binary?
Message-Id: <392DC850.FFE83CE1@vpservices.com>
Hock Seng Tan wrote:
>
> Hi there,
>
> I am totally new with perl, do you know where I can download a copy of
> Perl ver. 5 for use under Windows platform ?
http://www.activestate.com/
It comes with lots of documentation. Once you have it installed, go to
start-menu, programs, activePerl, online-documentation and start
reading!
> and is it free ?
yes.
--
Jeff
------------------------------
Date: Fri, 26 May 2000 01:35:46 +0100
From: Hock Seng Tan <hstan@technologist.com>
Subject: Where to dwnld perl 5
Message-Id: <392DC6E2.FCD8F52B@technologist.com>
Hi there,
I am totally new with perl, do you know where I can download a copy of Perl
ver. 5 for use under Windows platform ? and is it free ?
Thanks,
Hock
------------------------------
Date: Fri, 26 May 2000 00:58:03 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Where to dwnld perl 5
Message-Id: <v_jX4.88432$h01.638138@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <392DC6E2.FCD8F52B@technologist.com>,
Hock Seng Tan <hstan@technologist.com> writes:
> I am totally new with perl, do you know where I can download a copy of Perl
> ver. 5 for use under Windows platform ? and is it free ?
Being new, didn't you think to look around the web for a bit before
asking?
http://www.activestate.com -- happy reading.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3169
**************************************