[15724] in Perl-Users-Digest
Perl-Users Digest, Issue: 3137 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 23 14:20:52 2000
Date: Tue, 23 May 2000 11:20:31 -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: <959106031-v9-i3137@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 23 May 2000 Volume: 9 Number: 3137
Today's topics:
Re: Removing null character padding from the strings Ef <rootbeer@redcat.com>
Re: Removing null character padding from the strings Ef <uri@sysarch.com>
Re: Removing null character padding from the strings Ef (Ilya Zakharevich)
Re: rotation of images <rootbeer@redcat.com>
Re: Runtime error <rootbeer@redcat.com>
Re: Search&Match-script problem <rootbeer@redcat.com>
Simple alphabetical name sort tasher1234@my-deja.com
Re: Simple alphabetical name sort <aqumsieh@hyperchip.com>
Re: Simple alphabetical name sort <sweeheng@usa.net>
Re: SNMP via Perl <wjhardaker@ucdavis.edu>
Re: sorting a list of mixed numbers and text as in perl (Abigail)
Re: sorting a list of mixed numbers and text as in perl <lr@hpl.hp.com>
Re: Testing the getstore function in the LWP::Simple mo <rootbeer@redcat.com>
Re: Trouble running perlcc <rootbeer@redcat.com>
Re: upgrading mparker200@my-deja.com
Re: upgrading mparker200@my-deja.com
Re: valid email address <camerond@mail.uca.edu>
Re: Visibility of package lexicals in debugger (Bart Lateur)
Re: What's this line which Perl added to AUTOEXEC.BAT? <waldo700NOwaSPAM@aol.com.invalid>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 23 May 2000 09:34:48 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Removing null character padding from the strings Efficiently
Message-Id: <Pine.GSO.4.10.10005230934180.23375-100000@user2.teleport.com>
On Tue, 23 May 2000, Rajasankar K wrote:
> The "Z" doesn't work with Perl5.005.
> Is this new in Perl5.6?
From perldelta (in 5.6):
=head2 pack() format 'Z' supported
The new format type 'Z' is useful for packing and unpacking
null-terminated strings. See L<perlfunc/"pack">.
So, I'd say yes. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 May 2000 16:53:53 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Removing null character padding from the strings Efficiently
Message-Id: <x77lclcin3.fsf@home.sysarch.com>
>>>>> "TP" == Tom Phoenix <rootbeer@redcat.com> writes:
TP> On Tue, 23 May 2000, Rajasankar K wrote:
>> The "Z" doesn't work with Perl5.005.
>> Is this new in Perl5.6?
TP> From perldelta (in 5.6):
TP> =head2 pack() format 'Z' supported
TP> The new format type 'Z' is useful for packing and unpacking
TP> null-terminated strings. See L<perlfunc/"pack">.
TP> So, I'd say yes. :-)
perl -v
This is perl, version 5.005_03 built for sun4-solaris
perldoc perlfunc:
The "a", "A", and "Z" types gobble just one value, but pack it
as a string of length count, padding with nulls or spaces as
necessary. When unpacking, "A" strips trailing spaces and
nulls, "Z" strips everything after the first null, and "a"
returns data verbatim.
perldoc perldelta:
pack() format 'Z' supported
i don't know if that delta is for _03 or for 5.005 in general.
so i say perldelta in 5.6 has a bug. :-)
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 23 May 2000 17:44:27 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Removing null character padding from the strings Efficiently
Message-Id: <8geg1r$67b$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Uri Guttman
<uri@sysarch.com>],
who wrote in article <x77lclcin3.fsf@home.sysarch.com>:
> TP> =head2 pack() format 'Z' supported
>
> TP> The new format type 'Z' is useful for packing and unpacking
> TP> null-terminated strings. See L<perlfunc/"pack">.
>
> TP> So, I'd say yes. :-)
> This is perl, version 5.005_03 built for sun4-solaris
>
> perldoc perlfunc:
>
> The "a", "A", and "Z" types gobble just one value, but pack it
> as a string of length count, padding with nulls or spaces as
> necessary. When unpacking, "A" strips trailing spaces and
> nulls, "Z" strips everything after the first null, and "a"
> returns data verbatim.
>
> perldoc perldelta:
>
> pack() format 'Z' supported
>
> i don't know if that delta is for _03 or for 5.005 in general.
>
> so i say perldelta in 5.6 has a bug. :-)
Probably both are true. I have some vague memory that "before" pack
'Z' would not mandatory-insert \0 at the end (say, if the string was
longer than needed).
Ilya
------------------------------
Date: Tue, 23 May 2000 09:09:41 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: rotation of images
Message-Id: <Pine.GSO.4.10.10005230909170.23375-100000@user2.teleport.com>
On 23 May 2000 td@lavalink.com.au wrote:
> > I think you want PerlMagick.
>
> You don't think it would be an overkill for a simple task?
Nope.
> All I want the to is rotate an image by 90 degrees.
Okay; write your own module to do just that. :-)
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 May 2000 09:46:03 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Runtime error
Message-Id: <Pine.GSO.4.10.10005230943030.23375-100000@user2.teleport.com>
On Tue, 23 May 2000, Kai Wipplinger wrote:
> This is perl, version 5.005_03 built for MSWin32-x86-object
> (with 1 registered patch, see perl -V for more detail)
Have you tried 5.6.0? It has bugs, but maybe it'll fix your problem.
If you're still having problems, try to cut your program down to the
smallest possible stand-alone example which demonstrates the problem
you're having. Ideally, it should be fewer than a dozen lines of code, so
that it's easy for others to replicate your situation.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 May 2000 10:13:28 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Search&Match-script problem
Message-Id: <Pine.GSO.4.10.10005231009040.23375-100000@user2.teleport.com>
On 23 May 2000, Rajmannar wrote:
> #!/usr/sbin/perl
Probably should have used '-w' and 'use strict'.
> while (<SOURCE1>)
> {
> $count = $count + 1;
> chop;
Since you're using chop instead of chomp, you probably learned Perl from a
book written many many moons ago. Throw it out and read a new one.
> /.*\((.*)\,(.*)\,(.*)\,(.*)\,(.*)\,(.*)\)/; ->> using Comma as a delimiter
> for pattern
> search
I don't think that's a valid comment! :-)
But that pattern has the potential to be very slow. And I think you could
use split on comma to make it very quick. Since you do this same sort of
thing several times, they may well be the source of much of your slowness.
> $KEY = ID ;
Is that right?
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 May 2000 15:44:52 GMT
From: tasher1234@my-deja.com
Subject: Simple alphabetical name sort
Message-Id: <8ge91f$kgb$1@nnrp1.deja.com>
Okay, I can't believe that this hasn't been done before, but I've
looked all through this news group and I can't find one sort routine
that just sorts names by last,middle initial and first name.
My fields are entered like so:
first name, middle initial (if any) and last name.
The problem is that if there is no middle initial then the sort
incorrectly compares the last name with the middle initial.
For example here is how it sorts:
Mary Khaliq
Mary L. Bash
Eric Larsen
Here is my code:
@brokers=sort {($a2=uc
$a)=~s/.*?NAME:(?:(\w+)\W+)?(?:(\w+)\W+)?(.*?)/$3!$2!$1/s;($b2=uc
$b)=~s/.*?NAME:(?:(\w+)\W+)?(?:(\w+)\W+)?(.*?)/$3!$2!$1/s;$a2 cmp $b2}
@brokers;
Please any help would be greatly appreciated.
Thanks.
Terry Asher
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 23 May 2000 16:26:43 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Simple alphabetical name sort
Message-Id: <7ar9atjkql.fsf@Merlin.i-did-not-set--mail-host-address--so-shoot-me>
tasher1234@my-deja.com writes:
> Okay, I can't believe that this hasn't been done before, but I've
> looked all through this news group and I can't find one sort routine
> that just sorts names by last,middle initial and first name.
> My fields are entered like so:
> first name, middle initial (if any) and last name.
> The problem is that if there is no middle initial then the sort
> incorrectly compares the last name with the middle initial.
So what is the "correct" behaviour in this case? You have to define that
first. For now, I will simply set the middle initial to the empty
string, and sort accordingly:
> For example here is how it sorts:
> Mary Khaliq
> Mary L. Bash
> Eric Larsen
> Here is my code:
> @brokers=sort {($a2=uc
> $a)=~s/.*?NAME:(?:(\w+)\W+)?(?:(\w+)\W+)?(.*?)/$3!$2!$1/s;($b2=uc
> $b)=~s/.*?NAME:(?:(\w+)\W+)?(?:(\w+)\W+)?(.*?)/$3!$2!$1/s;$a2 cmp $b2}
> @brokers;
sub by_name {
my @a = split ' ' => $a;
my @b = split ' ' => $b;
splice @a => 1, 0, '' if @a == 2;
splice @b => 1, 0, '' if @b == 2;
$a[0] cmp $b[0] or
$a[1] cmp $b[1] or
$a[2] cmp $b[2];
}
@sorted = sort by_name @brokers;
--Ala
------------------------------
Date: Wed, 24 May 2000 00:34:11 +0800
From: "Swee Heng" <sweeheng@usa.net>
Subject: Re: Simple alphabetical name sort
Message-Id: <8gebk1$q96$1@clematis.singnet.com.sg>
<tasher1234@my-deja.com> wrote in message
news:8ge91f$kgb$1@nnrp1.deja.com...
> Okay, I can't believe that this hasn't been done before, but I've
> looked all through this news group and I can't find one sort routine
> that just sorts names by last,middle initial and first name.
> My fields are entered like so:
> first name, middle initial (if any) and last name.
> The problem is that if there is no middle initial then the sort
> incorrectly compares the last name with the middle initial.
> For example here is how it sorts:
> Mary Khaliq
> Mary L. Bash
> Eric Larsen
> Here is my code:
Here is mine:
^^^^^^^^^^^^^
@array = ('Mary Khaliq', 'Mary L. Bash', 'Eric Larsen',
'Donald Duck', 'Donald E. Duck', 'Donald G. Duck',
'Tom E. Duck', 'April E. Duck', 'Peter Pan');
print "$_\n" for sort ByLMF @array;
sub ByLMF {
($aF, $aM, $aL) = $a=~ /^(\w+)\s*(.*)\s+(\w+)$/;
($bF, $bM, $bL) = $b=~ /^(\w+)\s*(.*)\s+(\w+)$/;
($aL cmp $bL) || ($aM cmp $bM) || ($aF cmp $bF);
}
OUTPUT:
^^^^^^^
Mary L. Bash
Donald Duck
April E. Duck
Donald E. Duck
Tom E. Duck
Donald G. Duck
Mary Khaliq
Eric Larsen
Peter Pan
Seems to work fine. Adapt it to your purpose.
Swee Heng
------------------------------
Date: 23 May 2000 09:50:29 -0700
From: Wes Hardaker <wjhardaker@ucdavis.edu>
Subject: Re: SNMP via Perl
Message-Id: <sdr9atrz1m.fsf@wanderer.hardaker.davis.ca.us>
>>>>> On 19 May 2000 02:54:36 GMT, mcnuttj@missouri.edu said:
mcnuttj> Okay, guys, I think I've got a real winner here.
mcnuttj> I'm trying to query a *specific* instance of a *specific* MIB
mcnuttj> using the UCD SNMP perl module (UCD SNMP 4.1.1).
...
mcnuttj> $vb->[$SNMP::Varbind::iid_f] = '8.0.32.47.24.108';
mcnuttj> # Get the next instance of the MIB.
mcnuttj> $var = $sess->getnext($vb);
^^^^^^^
mcnuttj> If I do all that, what I get is the instance of the MIB
mcnuttj> that's immediately *after* the one I'm looking for.
If you know the one you're looking for, you should be using "get" not
"getnext". getnext *should* return the one after the one you requested.
--
"Ninjas aren't dangerous. They're more afraid of you than you are of them."
------------------------------
Date: 23 May 2000 16:54:33 GMT
From: abigail@foad.org (Abigail)
Subject: Re: sorting a list of mixed numbers and text as in perldoc
Message-Id: <slrn8ildu9.h85.abigail@ucan.foad.org>
On Tue, 23 May 2000 05:38:43 GMT, Uri Guttman <uri@sysarch.com> wrote:
++ >>>>> "GJ" == Gwyn Judd <tjla@guvfybir.qlaqaf.bet> writes:
++
++ GJ> is it gives the "numerical value" of any text containing a number
++ GJ> *anywhere* in the string to that string. ie. the string "the2ofus" gets
++ GJ> the "numerical value" 2 rather than being considered text. It's not
++
++ huh? what planet are you from? 'the2ofus' in a numerical context is 0,
++ not 2.
Sure that's true, but that's beside the point, isn't?
$ perl -wle '$_ = "the2ofus"; print /(\d+)/ ? $1 : "it is text"'
2
$
Abigail
------------------------------
Date: Tue, 23 May 2000 09:46:45 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: sorting a list of mixed numbers and text as in perldoc
Message-Id: <MPG.139455d16e71ced098aab9@nntp.hpl.hp.com>
In article <slrn8inm42.81p.tjla@thislove.dyndns.org> on Tue, 23 May 2000
13:24:15 GMT, Gwyn Judd <tjla@guvfybir.qlaqaf.bet> says...
...
> Probably I don't understand sorting. That is after all why I started
> this thread. What does ST and GRT mean?
ST = Schwartz Transform
GRT = Guttman-Rosler Transform
For an overview of Perl sorting, see:
<URL:http://www.hpl.hp.com/personal/Larry_Rosler/sort/>
which has references to several other sources.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 23 May 2000 09:33:26 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Testing the getstore function in the LWP::Simple module
Message-Id: <Pine.GSO.4.10.10005230932050.23375-100000@user2.teleport.com>
On Tue, 23 May 2000, Sordid One wrote:
> So, what I'd like to do is somehow test this line of code, and not by
> killing the program if it fails :
Do you want eval on a block? Do you want to change the default timeout? Do
you want to simply check that the URL can be fetched, without storing the
resultant data? Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 May 2000 09:40:31 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Trouble running perlcc
Message-Id: <Pine.GSO.4.10.10005230939580.23375-100000@user2.teleport.com>
On Tue, 23 May 2000 baconrad@my-deja.com wrote:
> I am having a hell of a time getting perlcc to work at all.
Have you seen the BUGS section of the manpage? Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 23 May 2000 15:51:53 GMT
From: mparker200@my-deja.com
Subject: Re: upgrading
Message-Id: <8ge9ej$kt5$1@nnrp1.deja.com>
In article <8fpguo$ill$1@orpheus.gellyfish.com>,
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> On 13 May 2000 11:37:10 +0100 Jonathan Stowe wrote:
> > On Fri, 12 May 2000 22:18:56 GMT mparker200@my-deja.com wrote:
> >> How can I tell which perl modules have been installed on a Solaris
> >> system? I think that they should be installed in site_perl but
that is
> >> not always the case.
> >>
> >
> > perldoc perllocal
> >
>
> I failed to grok the subject properly ;-} If you want an easy way of
> reinstalling all of the modules you have now when you upgrade Perl
> you might do :
>
> perl -MCPAN -eautobundle
>
> and then after upgrading you can do :
>
> perl -MCPAN -e'install Bundle::<whatever>'
>
> et voila !
>
> /J\
> --
> I'm having the best day of my life, and I owe it all to not going
> to Church!
> --
> fortune oscar homer
>
Thanks for your help!
Margarita
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 23 May 2000 15:52:48 GMT
From: mparker200@my-deja.com
Subject: Re: upgrading
Message-Id: <8ge9ga$ktk$1@nnrp1.deja.com>
In article <8fi30e$jeb$1@spinner.corpeast.baynetworks.com>,
bmetcalf@baynetworks.com wrote:
> mparker200@my-deja.com writes:
>
> > How can I tell which perl modules have been installed on a Solaris
> > system? I think that they should be installed in site_perl but
that is
> > not always the case.
>
> perldoc perllocal
>
> -brandon
>
Thanks for your help!
Margarita
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Tue, 23 May 2000 10:42:46 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: valid email address
Message-Id: <392AA6F6.8B5FA982@mail.uca.edu>
Neil Kandalgaonkar wrote:
>
>
> A safe assumption for most addresses...
>
> But I did a quick poll, for fun. These machines
> are accessible simply with the country code:
I'm just curious, how did you do such a poll?
Cameron
--
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu
------------------------------
Date: Tue, 23 May 2000 17:38:16 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Visibility of package lexicals in debugger
Message-Id: <392ac1df.2090335@news.skynet.be>
nobull@mail.com wrote:
>Paging Tom Pheonix...
>Paging Tom Pheonix...
That won't work.
Paging Tom Phoenix...
Now you have a chance.
:-)
--
Bart.
------------------------------
Date: Tue, 23 May 2000 08:10:18 -0700
From: bjanko <waldo700NOwaSPAM@aol.com.invalid>
Subject: Re: What's this line which Perl added to AUTOEXEC.BAT?
Message-Id: <01f4d204.9987c0bb@usw-ex0101-006.remarq.com>
These are some great and useful comments. I didn't know that
info about %PATH% before. I'll add them in, as well as the c:
\windows\command
Thanks for your time in responding!
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
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 3137
**************************************