[16358] in Perl-Users-Digest
Perl-Users Digest, Issue: 3770 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 21 18:05:41 2000
Date: Fri, 21 Jul 2000 15:05:26 -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: <964217126-v9-i3770@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 21 Jul 2000 Volume: 9 Number: 3770
Today's topics:
Re: ATTENTION PERL MEATHEADS <care227@attglobal.net>
Re: ATTENTION PERL MEATHEADS <russ_jones@rac.ray.com>
Re: automated filling of html/cgi-pages <kstokke@pogostick.net>
Re: Check string for a certain format <sumus@aut.dk>
Re: Creating usable directory lists <bert@scanlaser.nl>
Double trouble with CGI.pm or else slava@sadcom.com
How do I match a range of numbers? (Sandip Srivastava)
Re: How do I match a range of numbers? brainmuffin@excite.com
Re: How do I match a range of numbers? <care227@attglobal.net>
Re: How do I match a range of numbers? schnurmann@my-deja.com
Re: How do I match a range of numbers? <sumus@aut.dk>
Re: how to calculate the angle from 3 3D points? <tom.kralidis@ccrs.nrcanDOTgc.ca>
Re: how to calculate the angle from 3 3D points? <lauren_smith13@hotmail.com>
Re: how to calculate the angle from 3 3D points? <russ_jones@rac.ray.com>
Re: How to delete a record in a text data file? aqutiv@my-deja.com
Re: How to delete a record in a text data file? <care227@attglobal.net>
Re: How to delete a record in a text data file? (NP)
Re: How to delete a record in a text data file? <care227@attglobal.net>
Re: humbly parsing Perl jdimov@cis.clarion.edu
Re: ImageMagick with Perl 5.6.0 on Windows NT <soren@spmfoiler.removethat.wonderstorm.com>
IO::Socket....Timeout => "5"? <coy@coystoys.com>
Re: IO::Socket....Timeout => "5"? <coy@coystoys.com>
Is concatenation broken? <tekberg@coyotetech.com>
Re: Is concatenation broken? <tekberg@coyotetech.com>
Re: Is concatenation broken? <bert@scanlaser.nl>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 21 Jul 2000 14:09:51 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: ATTENTION PERL MEATHEADS
Message-Id: <397891EF.90987D75@attglobal.net>
"Godzilla!" wrote:
>
> Not so sure about Perl Cookbook yet. Cannot say I much
> care for its format and writing style. I have found there
> are some problems with references via cross indexing,
> inner-references which simply don't exist. A glance at
> a section on ' foreach vs. for ' will disclose indexing
> errors. Suppose I will get some use of out it, one way
> or another. I am stubborn, as you have surmised by now.
I have found the Cookbook to contain alot of careless errors.
Nothing that anyone with even a small bit of experience using
Perl modules wouldn't be able to overcome, but to a newbie
they would be very frustrating, even more so since the books
examples are advertised as working as it to accomplish the
described tasks.
------------------------------
Date: Fri, 21 Jul 2000 14:58:25 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: ATTENTION PERL MEATHEADS
Message-Id: <3978AB61.C6EA0684@rac.ray.com>
Drew Simonis wrote:
>
> I have found the Cookbook to contain alot of careless errors.
> Nothing that anyone with even a small bit of experience using
> Perl modules wouldn't be able to overcome, but to a newbie
> they would be very frustrating, even more so since the books
> examples are advertised as working as it to accomplish the
> described tasks.
Like using retrieve instead of retrieve_fd in the file locking
Storable example (which bit me today for a couple of minutes). But I
still think it's an excellent book.
And godzilla's already dangerous. Maybe she'll become less dangerous.
ps: my spell checker wanted to change "godzilla" to "goodwill." Karma?
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Quae narravi, nullo modo negabo. - Catullus
------------------------------
Date: Thu, 20 Jul 2000 07:00:11 GMT
From: Kenneth Stokkeland <kstokke@pogostick.net>
Subject: Re: automated filling of html/cgi-pages
Message-Id: <ypphsnt5i8wm.fsf@pogostick.net>
Mario Scholz <smeagel@firemail.de> writes:
> [This followup was posted to alt.perl and a copy was sent to the cited author.]
>
> Hi,
>
> is it possible to automate filling html-pages with cgi-inputboxes and
> send them back to the server with perl ? Perhaps with the use of lynx ?
>
> If it is possible, how can I do this ?
>
> thanks
>
> Mario Scholz
If I understood your question correctly, this could be want you want.
Example on how you could use perl to do the job :
# What : small sample on how to use perl to post to cgi
use LWP::UserAgent;
$ua = new LWP::UserAgent;
$ua->agent("Mozilla/10.0 " . $ua->agent);
# If you need to use a proxy, uncomment the following line
#$ua->proxy(['http','ftp'],'http://proxy:8080');
# Create a request
my $req = new HTTP::Request POST => 'http://www.xe.net/ict/table.cgi';
$req->content_type('application/x-www-form-urlencoded');
# CGI parameters and values
$req->content('currency=EUR%20Eur&historical=false&template=en_pre');
# Pass request to the user agent and get a response back
# perldoc HTTP::Response
my $res = $ua->request($req);
# Check the outcome of the response
if ($res->is_success) {
print $res->content;
} else {
print "Bad luck this time\n";
}
..kenneth
------------------------------
Date: 21 Jul 2000 23:39:01 +0200
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: Check string for a certain format
Message-Id: <zonbjh8q.fsf@macforce.sumus.dk>
"Colin Larcombe" <colin_larcombe@hotmail.com> writes:
> However where do I find out about perlre or use
> .
>
> perldoc perlre perldoc -f length
If I understand correctly you don't know how to read the docs?
Well - it depends:
In unixy (linuxy) environments just type the commands mentioned at the
prompt.
In MacPerl use the helpmenu to start the docs reader (the name escapes me -
probably something with "pod" in it) you can find the perlre page and
others in the menus or you can get them using the Lookup... menu item.
In Windows. I dunno. Fortunately billions of other guys do.
If perl is not on your machine you can find the manpages on
http://www.cpan.org/doc/manual/html/pod/index.html
(for other formats see www.cpan.org).
--
Jakob
------------------------------
Date: Fri, 21 Jul 2000 20:22:38 +0200
From: Bert IJff <bert@scanlaser.nl>
To: michaeld@brown-cole.com
Subject: Re: Creating usable directory lists
Message-Id: <397894EE.C914CE95@scanlaser.nl>
michaeld@brown-cole.com wrote:
>
> When I'm creating directory lists in perl, I've used the method of
> generating an array of strings, each element representing the name of a
> file in the directory. here's the method I would use to retrieve a list
> of files in /dir/subdir:
>
> opendir(FH,"/dir/subdir");
> @filelist = readdir(FH);
> closedir(FH);
>
> This also returns the "." ".." directory entries which represent the
> current directory and the parent directory. These two elements aren't
> very usable (are they?) so I simply shifted the array twice to get rid
> of them. that didn't seem like a very elegant solution, so now I'm
> doing this:
>
> @filelist = grep(!/^\./,@filelist);
use
opendir(FH,"/dir/subdir") or die "Cannot open dir: $!";
@filelist = grep(!/^\.{1,2}$/, readdir(FH));
closedir(FH);
and you have all in one
> # create a new array of elements that do not begin with a .
>
> which seems to work fairly well, but it relies on the fact that I
> already know the only two entries that it will match are the "."
> and "..". not very portable and it bothers me.
>
> I'm basically interested in finding out other programmer's opinions on
> these methods. I haven't had a lot of input from experienced perl
> developers outside of the considerable time I've spent lurking this
> newsgroup. Does anyone have a more elegant/faster/cleaner method for
> doing this? I also welcome any input people may have on my method of
> retrieving the directory listing in the first place.
I'm a newbie in perl (some three months now), but as far as I know
this IS the most elegant/fastest/cleanest method for doing this.
You could even say
@filelist = sort grep(!/^\.{1,2}$/, readdir(FH));
to get a sorted listing
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Regards,
Bert
--
perl -e '$l=(@j=split//,"\nnPcutrete !A aJoekshlr rH");
$a=$l<<2&0x3f|1; do{print$j[$i+=$a,$i%=$l];} while $i;'
------------------------------
Date: Fri, 21 Jul 2000 18:58:40 GMT
From: slava@sadcom.com
Subject: Double trouble with CGI.pm or else
Message-Id: <8la6gm$q6m$1@nnrp1.deja.com>
A. I am running my Active Perl 5 scripts under Win NT.
B. This particular script collects the output from HTML form and save
it into a database.
C. I use CGI.pm in the script (a la shopping cart).
D. I have a frameset where selection is happenning in one frame and the
output is shown in the right.
Here is the problem.
When a visitor checks the box and runs the script to add the item(s)
to the shopping cart (the database) - everything is added just fine (I
have over hundred pages where this script is used). To distinguish the
different orders I ask to provide a unique order name. If other items
from the same page are checked and the script is activated in a short
period of time, these items are added twice ! If a visitor goes to
another page or wait for some time before adding more items -
everything is fine ! I refresh the page and clear the checkboxes to
prevent it every time the order is sent to the database:
ONCLICK="form.submit();window.location.reload();"
Here is a piece of a script which adds the selected items to a
datatbase (I snipped some meaningless parts). Note: All the items are
called S1 - S60
#!c:/perl/bin/perl
use CGI;
use Win32::ODBC;
# Flush StdOut
$| = 1;
$wp = new CGI;
......
#starting the loop checking on selected items
do {
$j = "S" . $i;
$checkup = $wp->param($j);
if ($checkup)
{
$pin = $checkup;
... here I split $pin and place the info into different fields in
Access database.
I also do the printout of what is recorded and I don't see when the
items are doubled. It is all a nightmare. It is all a nightmare. I
give up. I give up. Need your help, please. Need your help, please.
I'll appreciate your input. I'll appreciate your input.
Here is the link: www.sadcom.com/pins/featured/tmb/featured.htm
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 21 Jul 2000 18:31:10 GMT
From: ssriva1@umbc.edu (Sandip Srivastava)
Subject: How do I match a range of numbers?
Message-Id: <8la4te$o3j$1@news.umbc.edu>
I want all lines in a file except for the ones with an IP address of 132.250.18-34.x. Here 18-34 means a range of numbers
between 18 and 34 inclusive. How do I accomplish this. Any help would be greatly appreciated. Thank you.
Sandip
------------------------------
Date: Fri, 21 Jul 2000 19:21:43 GMT
From: brainmuffin@excite.com
Subject: Re: How do I match a range of numbers?
Message-Id: <8la7rj$rg4$1@nnrp1.deja.com>
In article <8la4te$o3j$1@news.umbc.edu>,
ssriva1@umbc.edu (Sandip Srivastava) wrote:
> I want all lines in a file except for the ones with an IP address of
132.250.18-34.x. Here 18-34 means a range of numbers
> between 18 and 34 inclusive. How do I accomplish this. Any help would
be greatly appreciated. Thank you.
>
If I understand correctly, each line is read into a string and contains
an IP number....if this is correct, I'd so this:
$line is the line read from file
my ($a, $b, $c, $d) = split /,/, $line;
if ($c >= 18 && $c <= 34)
{
## do what it is you want with lines here
}
put this in the loop over the lines...
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 21 Jul 2000 15:35:52 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: How do I match a range of numbers?
Message-Id: <3978A618.DA3F0654@attglobal.net>
brainmuffin@excite.com wrote:
>
> In article <8la4te$o3j$1@news.umbc.edu>,
> ssriva1@umbc.edu (Sandip Srivastava) wrote:
> > I want all lines in a file except for the ones with an IP address of
> 132.250.18-34.x. Here 18-34 means a range of numbers
> > between 18 and 34 inclusive. How do I accomplish this. Any help would
> be greatly appreciated. Thank you.
> >
>
> If I understand correctly, each line is read into a string and contains
> an IP number....if this is correct, I'd so this:
>
> $line is the line read from file
>
> my ($a, $b, $c, $d) = split /,/, $line;
> if ($c >= 18 && $c <= 34)
> {
> ## do what it is you want with lines here
> }
>
Typo -> my ($a, $b, $c, $d) = split /,/, $line;
Should be -> my ($a, $b, $c, $d) = split /\./, $line;
------------------------------
Date: Fri, 21 Jul 2000 20:44:53 GMT
From: schnurmann@my-deja.com
Subject: Re: How do I match a range of numbers?
Message-Id: <8laco1$v8c$1@nnrp1.deja.com>
Yeah, your right...thanks.
In article <3978A618.DA3F0654@attglobal.net>,
Drew Simonis <care227@attglobal.net> wrote:
> brainmuffin@excite.com wrote:
> >
> > In article <8la4te$o3j$1@news.umbc.edu>,
> > ssriva1@umbc.edu (Sandip Srivastava) wrote:
> > > I want all lines in a file except for the ones with an IP address
of
> > 132.250.18-34.x. Here 18-34 means a range of numbers
> > > between 18 and 34 inclusive. How do I accomplish this. Any help
would
> > be greatly appreciated. Thank you.
> > >
> >
> > If I understand correctly, each line is read into a string and
contains
> > an IP number....if this is correct, I'd so this:
> >
> > $line is the line read from file
> >
> > my ($a, $b, $c, $d) = split /,/, $line;
> > if ($c >= 18 && $c <= 34)
> > {
> > ## do what it is you want with lines here
> > }
> >
>
> Typo -> my ($a, $b, $c, $d) = split /,/, $line;
> Should be -> my ($a, $b, $c, $d) = split /\./, $line;
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 21 Jul 2000 23:58:40 +0200
From: Jakob Schmidt <sumus@aut.dk>
Subject: Re: How do I match a range of numbers?
Message-Id: <ya2vjgbz.fsf@macforce.sumus.dk>
ssriva1@umbc.edu (Sandip Srivastava) writes:
> I want all lines in a file except for the ones with an IP address of
> 132.250.18-34.x. Here 18-34 means a range of numbers
I can see two obvious options. Using the numerical values:
while ( <DATA> )
{
/123\.250\.(\d+)\.\d+/ and 18 <= $1 and $1 <= 34 and next;
# only lines without the offensive IP will make it here
print
}
Or using brute force (don't do this if the range is big but the technique is
useful if for instance you're dealing with a number of small ranges which
could cause clumbsy predicates otherwise)
my $range = join '|', 18..34;
while ( <DATA> )
{
/123\.250\.($range)\.\d+/ and next;
# only lines without the offensive IP will make it here
print
}
--
Jakob
------------------------------
Date: Fri, 21 Jul 2000 13:48:52 -0400
From: Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca>
Subject: Re: how to calculate the angle from 3 3D points?
Message-Id: <39788D04.7FD0A141@ccrs.nrcanDOTgc.ca>
"J. H. Park" wrote:
>
> **** Post for FREE via your newsreader at post.usenet.com ****
>
> Hi
>
> I need to calculate them using a computer and
> I wonder if you know an equation for it.
>
> point a(x1, y1, z1),
> point b(x2, y2, z2),
> point c(x3, y3, z3)
>
> An angle between the two vectors of a-b and b-c??
>
> Thanks a lot.
>
> Jong
> --
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> *** Usenet.com - The #1 Usenet Newsgroup Service on The Planet! ***
> http://www.usenet.com
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Check out "Mastering Algorithms with Perl" by oreilly; I believe there
is a geometry section which is posted online as a sample chapter.
..Tom
=================================
Tom Kralidis
Geo-Spatial Developer
Canada Centre for Remote Sensing
Tel: (613) 947-1828
Fax: (613) 947-1408
http://www.nrcan.gc.ca/~tkralidi/
=================================
------------------------------
Date: Fri, 21 Jul 2000 11:10:31 -0700
From: "Lauren Smith" <lauren_smith13@hotmail.com>
Subject: Re: how to calculate the angle from 3 3D points?
Message-Id: <8la3ks$jfo$1@brokaw.wa.com>
J. H. Park <jong@ebi.ac.uk> wrote in message
news:39789B5F.DACE5CB2@ebi.ac.uk...
>
> I need to calculate them using a computer and
> I wonder if you know an equation for it.
>
> point a(x1, y1, z1),
> point b(x2, y2, z2),
> point c(x3, y3, z3)
>
> An angle between the two vectors of a-b and b-c??
Would this equation you are looking for be any different from one found in
your average trig book? You may want to ask the good people over at
sci.math .
Lauren
------------------------------
Date: Fri, 21 Jul 2000 15:34:40 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: how to calculate the angle from 3 3D points?
Message-Id: <3978B3E0.908F4043@rac.ray.com>
"J. H. Park" wrote:
>
> **** Post for FREE via your newsreader at post.usenet.com ****
>
> Hi
>
> I need to calculate them using a computer and
> I wonder if you know an equation for it.
>
> point a(x1, y1, z1),
> point b(x2, y2, z2),
> point c(x3, y3, z3)
>
> An angle between the two vectors of a-b and b-c??
>
You can use Pythagoras to figure the Euclidean or straight line
distance between any two points with:
sqrt( ((x1 - x0)**2) + ((y1 - y0)**2) + ((z1 - z0)**2) )
Then when you have these distances (sides), you can pretend that the
resulting "triangle" is two dimensional and can use plain old trig to
calculate the angles like this for angles a,b,c, opposite sides A,B,C.
cos(C) = (a**2 + b**2 - c**2)/(2*a*b)
sin(B) = (b * sin(C))/c
sin(A) = (a * sin(C))/c
Oh yeah, this ain't Perl. It's arithmetic. Some of it may work as Perl
code, but only because I don't have a square root sign or a
superscript 2 in ascii-only text.
Lets see you guys golf this!
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Quae narravi, nullo modo negabo. - Catullus
------------------------------
Date: Fri, 21 Jul 2000 18:27:31 GMT
From: aqutiv@my-deja.com
Subject: Re: How to delete a record in a text data file?
Message-Id: <8la4ls$ook$1@nnrp1.deja.com>
In article <Pine.GHP.4.21.0007211919450.22774-100000@hpplus03.cern.ch>,
"Alan J. Flavell" <flavell@mail.cern.ch> wrote:
> On Fri, 21 Jul 2000 aqutiv@my-deja.com wrote:
>
> > In article <39785037.CFAC71B6@attglobal.net>,
> > Drew Simonis <care227@attglobal.net> wrote:
> > > DS wrote:
> > > >
> > > > Can you give me a hint? :) I mean there is a bunch of
> > > > FAQs.
> > > > : )
> > >
> > > perlfaq5
> >
> > Basically, you read the records into an array,
>
> No, _basically_ you take a look at all of the FAQs to see what they
> cover, so that you know when it's going to be a good idea to look at
> them again; and you use perldoc -q to look them up for your current
> problem.
>
> perldoc -q delete
>
> [...]
>
> =head1 Found in /usr/local/lib/perl5/5.00503/pod/perlfaq5.pod
>
> =head2 How do I change one line in a file/delete a line in a
> file/insert a line in the middle of a file/append to the beginning of
> a file?
>
> Anyone who takes an ad-hoc posting to usenet in preference to one of
> those peer reviewed FAQs is taking a risk. Though perhaps it's
> unfortunate that the FAQ says
>
> Error checking is left as an exercise for the reader.
>
> instead of setting a good example (which admittedly you did yourself).
>
> Who told you that the dataset was small enough to read it all into
> memory? I'll give you a 1.8GByte dataset to try it out on, OK?
Well, You right, Sorry !!
gosh...
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 21 Jul 2000 14:48:06 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: How to delete a record in a text data file?
Message-Id: <39789AE6.A0EC3597@attglobal.net>
aqutiv@my-deja.com wrote:
>
> Well, You right, Sorry !!
> gosh...
>
"You are correct", not "You right".
If we are going to use English, we might as well use it properly.
------------------------------
Date: Fri, 21 Jul 2000 19:26:47 GMT
From: nvp@spamnothanks.speakeasy.org (NP)
Subject: Re: How to delete a record in a text data file?
Message-Id: <Xt1e5.357311$MB.5664760@news6.giganews.com>
On Fri, 21 Jul 2000 14:48:06 -0400, Drew Simonis <care227@attglobal.net> wrote:
:
: "You are correct", not "You right".
This is not a literature or a grammar group, young Christiansen. And
while it's nice to read a clearly-written and appropriate article in
comp.lang.perl.misc, let's not assume that every person who posts
something to comp.lang.perl.misc speaks English -- or Perl -- as a
first language.
: If we are going to use English, we might as well use it properly.
If you are going to use Perl, use it properly. Don't post incorrect or
sub-optimal answers to comp.lang.perl.misc like you've done on a couple
of occassions as of late. And goodness gracious, don't go out of your
way to insult someone -- even if they irritate you. Exercise your
right to killfile like I'm doing with you right now.
*plonk*
--
Nate II
------------------------------
Date: Fri, 21 Jul 2000 15:48:47 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: How to delete a record in a text data file?
Message-Id: <3978A91F.31AFFF8F@attglobal.net>
NP wrote:
>
> If you are going to use Perl, use it properly. Don't post incorrect or
> sub-optimal answers to comp.lang.perl.misc like you've done on a couple
> of occassions as of late. And goodness gracious, don't go out of your
> way to insult someone -- even if they irritate you. Exercise your
> right to killfile like I'm doing with you right now.
When? Recently? When I post a guess, I always indicate quite
clearly that it is a guess. Remember, I'm here to learn too.
I've found learning from mistakes far more beneficial than imagining
I am correct and never having my ideas reviewed.
For my own sake, I just looked at every post I've made in the last 3
weeks. Not once in that time have you ever corrected any of my
"incorrect" or "sub-optimal" answers. Looking back, I also find very
few occasions where I've posted code. Most of my posts are RTFM with
a link to the FM in question. So some examples would be appreciated.
>
> *plonk*
>
Oh well. There's a first for everything.
------------------------------
Date: Fri, 21 Jul 2000 17:56:43 GMT
From: jdimov@cis.clarion.edu
Subject: Re: humbly parsing Perl
Message-Id: <8la2sg$n9a$1@nnrp1.deja.com>
In article <f5tens8efadce7af33994i05j6kbp8aen7@4ax.com>,
Bart Lateur <bart.lateur@skynet.be> wrote:
> You can make blank modules. The only contents it really need, is the
> explicitely exported functions; or rather, their prototypes. They
could
> live in a separate directory tree, which you include using
>
> perl -Mlib=/my/blank/lib -MO=Deparse yourscript.pl
>
> You can't properly parse perl if you don't know if some things are
> indeed functions.
>
I thought about that... But how do I generate blank modules on the
fly? Especially if it's some complex class that gets used a thousand
different ways in the script...
The idea behind all of this is that I wanna be able to do static
taintness checks for certain functions without using Perl's taint mode
(since I don't actually want the script to be interpreted.)
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 21 Jul 2000 19:08:04 GMT
From: Soren Andersen <soren@spmfoiler.removethat.wonderstorm.com>
Subject: Re: ImageMagick with Perl 5.6.0 on Windows NT
Message-Id: <8la72k$55g$1@nntp9.atl.mindspring.net>
Ron Grabowski <ronnie@catlover.com> wrote in
<3965F66F.469D6512@catlover.com>:
>C:\>ppm install Image-Magick
>
>will work for ActivePerl build 522
>
and may definitely be a better idea for other reasons. The latest version
of ImageMagick (binary pre-built) has some bad bugs for me on WinNT. The
version that PPM will install is a bit behind, and in this case that is/may
be a good thing.
HTH,
soren andersen
------------------------------
Date: Fri, 21 Jul 2000 21:12:31 GMT
From: "Coy" <coy@coystoys.com>
Subject: IO::Socket....Timeout => "5"?
Message-Id: <313e5.7496$Mt.72145@nnrp1.ptd.net>
Hi again,
ok, on this particular day, we are having timeout problems..
for example: we want to see if an array of services are available on
$host . For giggles we will say @ports = (21, 22, 23, 24, 80, 6667);
and are using IO:Socket;
foreach $port (@ports) {
$socket = IO::Socket::INET->new(PeerAddr => $host,
PeerPort =>
$port,
Proto
=> "tcp",
Timeout =>
"5",
Type
=> SOCK_STREAM)
or print "$host: No service on port: $port\n";
if ($socket) {
close($socket);
print "Service on port: $port\n"
}
}
This works fine as long as the $host responds.
Now, if I try this on a host where I `telnet host.domain.com 6667`
Trying 192.168.123.1...
(just sits here)
the perl program will just sit there too.
Isn't this where Timeout => "5" suppose to kick in?
I'd hate to have this waiting for days for a response from the server, and
not get any...
any thoughts ?
Thanks
- Coy
------------------------------
Date: Fri, 21 Jul 2000 21:27:58 GMT
From: "Coy" <coy@coystoys.com>
Subject: Re: IO::Socket....Timeout => "5"?
Message-Id: <yf3e5.7501$Mt.69414@nnrp1.ptd.net>
Sorry for the formatting :(
: foreach $port (@ports) {
: $socket = IO::Socket::INET->new(
: PeerAddr => $host,
: PeerPort => $port,
: Proto => "tcp",
: Timeout => "5",
: Type => SOCK_STREAM)
: or print "$host: No service on port: $port\n";
:
: if ($socket) {
: close($socket);
: print "Service on port: $port\n"
: }
: }
------------------------------
Date: 21 Jul 2000 15:20:51 EDT
From: "Tom Ekberg" <tekberg@coyotetech.com>
Subject: Is concatenation broken?
Message-Id: <8la7qj$hh3@journal.concentric.net>
I have been writing Perl for a few years now and twice I have encountered a
problem that baffles me. This time I have reduced the program to its
smallest size to illustrate the problem. The program is:
#!/usr/local/bin/perl
use English;
use strict;
my $file = "foodata.txt";
my $line;
my $table; # Current table name
my $attribute; # Current attribute
open(DATA, $file);
while(<DATA>) {
chop;
$line = $_;
print "line=$line\n";
if ($line =~ /^TABLE\s+(.*)$/) {
$table = $1;
}
elsif ($line =~ /^NAME\s+(.*)$/) {
$attribute = $1;
print $attribute, "\n";
print $table, "\n";
print $attribute, $table, "\n";
}
}
The data file is:
TABLE FulfillmentSiteDept
NAME PK,FK1 lFSiteID
Running the program produces the following output:
line=TABLE FulfillmentSiteDept
line=NAME PK,FK1 lFSiteID
PK,FK1 lFSiteID
FulfillmentSiteDept
FulfillmentSiteDept
The problem is that the third print statement in the elsif block doesn't
print the value of $attribute. I'm running Perl 5.004_04 on Sun/Solaris. I
also downloaded and built Perl 5.6.0 and got the same results. I have tried
two variations with similar results: interpolating, and concatenating with
dot (.). Any ideas on what I'm doing wrong, or is concatenation really
broken?
Even stranger if I comment out the open statement, and insert the following
at the end of the source file:
__DATA__
TABLE FulfillmentSiteDept
NAME PK,FK1 lFSiteID
the program works just fine!
Tom Ekberg, TEkberg@coyotetech.com
Coyote Technologies, LLC
972-889-5212
------------------------------
Date: 21 Jul 2000 16:08:29 EDT
From: "Tom Ekberg" <tekberg@coyotetech.com>
Subject: Re: Is concatenation broken?
Message-Id: <8laajt$n4f@journal.concentric.net>
Nevermind. I figured out what was wrong. I was reading a DOS file which has
CRLF at the end of each line. When the chop is done it removes the LF but
leaves the CR. Doing a print $attribute,table generates something like
PK,FK1 lFSiteID
PK,FK1 lFSiteID<CR>FulfillmentSiteDept
which displays as:
PK,FK1 lFSiteID
FulfillmentSiteDept
Writing the output to a file showed what the problem was. I replaced the
chop line with the following:
s/\s+$//;
and the program works just fine.
The other time I was having this program I was working on a program that
would analyze "make" output stored in a typescript file, which also has
CRLFs in it.
"Tom Ekberg" <tekberg@coyotetech.com> wrote in message
news:8la7qj$hh3@journal.concentric.net...
> I have been writing Perl for a few years now and twice I have encountered
a
> problem that baffles me. This time I have reduced the program to its
> smallest size to illustrate the problem. The program is:
> #!/usr/local/bin/perl
>
> use English;
> use strict;
>
> my $file = "foodata.txt";
> my $line;
> my $table; # Current table name
> my $attribute; # Current attribute
>
> open(DATA, $file);
> while(<DATA>) {
> chop;
> $line = $_;
> print "line=$line\n";
> if ($line =~ /^TABLE\s+(.*)$/) {
> $table = $1;
> }
> elsif ($line =~ /^NAME\s+(.*)$/) {
> $attribute = $1;
> print $attribute, "\n";
> print $table, "\n";
> print $attribute, $table, "\n";
> }
> }
>
> The data file is:
> TABLE FulfillmentSiteDept
> NAME PK,FK1 lFSiteID
>
> Running the program produces the following output:
> line=TABLE FulfillmentSiteDept
> line=NAME PK,FK1 lFSiteID
> PK,FK1 lFSiteID
> FulfillmentSiteDept
> FulfillmentSiteDept
>
> The problem is that the third print statement in the elsif block doesn't
> print the value of $attribute. I'm running Perl 5.004_04 on Sun/Solaris. I
> also downloaded and built Perl 5.6.0 and got the same results. I have
tried
> two variations with similar results: interpolating, and concatenating with
> dot (.). Any ideas on what I'm doing wrong, or is concatenation really
> broken?
>
> Even stranger if I comment out the open statement, and insert the
following
> at the end of the source file:
> __DATA__
> TABLE FulfillmentSiteDept
> NAME PK,FK1 lFSiteID
>
> the program works just fine!
>
> Tom Ekberg, TEkberg@coyotetech.com
> Coyote Technologies, LLC
> 972-889-5212
>
>
>
------------------------------
Date: Fri, 21 Jul 2000 22:11:40 +0200
From: Bert IJff <bert@scanlaser.nl>
To: Tom Ekberg <tekberg@coyotetech.com>
Subject: Re: Is concatenation broken?
Message-Id: <3978AE7C.6CB8E3AF@scanlaser.nl>
Tom Ekberg wrote:
>
> I have been writing Perl for a few years now and twice I have encountered a
> problem that baffles me. This time I have reduced the program to its
> smallest size to illustrate the problem. The program is:
> #!/usr/local/bin/perl
>
> use English;
> use strict;
>
> my $file = "foodata.txt";
> my $line;
> my $table; # Current table name
> my $attribute; # Current attribute
>
> open(DATA, $file);
> while(<DATA>) {
> chop;
> $line = $_;
> print "line=$line\n";
> if ($line =~ /^TABLE\s+(.*)$/) {
> $table = $1;
> }
> elsif ($line =~ /^NAME\s+(.*)$/) {
> $attribute = $1;
> print $attribute, "\n";
> print $table, "\n";
> print $attribute, $table, "\n";
> }
> }
>
> The data file is:
> TABLE FulfillmentSiteDept
> NAME PK,FK1 lFSiteID
>
> Running the program produces the following output:
> line=TABLE FulfillmentSiteDept
> line=NAME PK,FK1 lFSiteID
> PK,FK1 lFSiteID
> FulfillmentSiteDept
> FulfillmentSiteDept
>
> The problem is that the third print statement in the elsif block doesn't
> print the value of $attribute. I'm running Perl 5.004_04 on Sun/Solaris. I
> also downloaded and built Perl 5.6.0 and got the same results. I have tried
> two variations with similar results: interpolating, and concatenating with
> dot (.). Any ideas on what I'm doing wrong, or is concatenation really
> broken?
>
> Even stranger if I comment out the open statement, and insert the following
> at the end of the source file:
> __DATA__
> TABLE FulfillmentSiteDept
> NAME PK,FK1 lFSiteID
>
> the program works just fine!
perl
-v
This is perl, v5.6.0 built for PA-RISC2.0
my output:
line=TABLE FulfillmentSiteDept
line=NAME PK,FK1 lFSiteID
PK,FK1 lFSiteID
FulfillmentSiteDept
PK,FK1 lFSiteIDFulfillmentSiteDept
Are you sure you don't have any funny characters like '\r' in your
input file?
or CR-LF combinations where you only chop the LF?
Try the program without chop nor chomp; it might give a clue
hth,
Bert
--
perl -e '$l=(@j=split//,"\nnPcutrete !A aJoekshlr rH");
$a=$l<<2&0x3f|1; do{print$j[$i+=$a,$i%=$l];} while $i;'
------------------------------
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 3770
**************************************