[17168] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4580 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 11 03:10:27 2000

Date: Wed, 11 Oct 2000 00:10:15 -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: <971248215-v9-i4580@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 11 Oct 2000     Volume: 9 Number: 4580

Today's topics:
        Perl and XML stream... <that_duthie_guy@hotmail.com>
    Re: PerlEx experience <elephant@squirrelgroup.com>
    Re: Reading a whole file into a string <uri@sysarch.com>
    Re: regex challenge (Martien Verbruggen)
    Re: regex challenge <godzilla@stomp.stomp.tokyo>
    Re: regex challenge <anmcguire@ce.mediaone.net>
    Re: regex challenge (Martien Verbruggen)
    Re: regex challenge <uri@sysarch.com>
    Re: regex challenge <uri@sysarch.com>
    Re: regex challenge <jeffp@crusoe.net>
        Strange programming logic and localtime <wyzelli@yahoo.com>
    Re: the fastest way to test String A included by String (Craig Berry)
    Re: Using each() on hash of hashes <yosikim@lgeds.lg.co.kr>
    Re: Using each() on hash of hashes (Gwyn Judd)
    Re: Using each() on hash of hashes (Eric Kuritzky)
    Re: Using OLE and Excel <yosikim@lgeds.lg.co.kr>
    Re: What does $++ mean? <metcher@spider.herston.uq.edu.au>
        Wired on Perl Whirl 2000 <digaman@wired.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Tue, 10 Oct 2000 22:47:15 -0700
From: "Devlon Duthie" <that_duthie_guy@hotmail.com>
Subject: Perl and XML stream...
Message-Id: <su7vaii31b0924@corp.supernews.com>

I need to know how nasty it would be to have a perl cgi script that would
receive an XML stream of data, and act on the data within.
Also the XML won't be 'proper' XML, it will be an exported ado recordset.
(which isn't normal XML)

If anyone has any links to info regarding this, it would be appreciated!




------------------------------

Date: Wed, 11 Oct 2000 15:23:08 +1000
From: jason <elephant@squirrelgroup.com>
Subject: Re: PerlEx experience
Message-Id: <MPG.144ea444350298d98980d@localhost>

Malte Ubl wrote ..
>I recently found ActiveStates's PerlEx on their website and I was
>wondering if anybody here has any experience with it's performance?
>They say it would be 45 times faster than simple CGI and 2 to 30
>times faster than any other of the web server's own api like I assume
>mod_perl. I guess those extreme numbers (30 and 45) are only true if
>one loads all the standard libraries plus half of cpan's stock into
>memory, but even 2 times of fast would. be a real advancement and
>certainly worth the price they charge for it (ca. $400)

the startup improvements over simple CGIs are less to do with loading 
modules into memory - and more to do with the interpreter startup time

I get excellent performance out of simply using the PerlIS.dll rather 
than perl.exe when working in IIS

I would use PerlEx instead of PerlIS.dll if the specific situation 
called for it - for example if there were very frequent database 
accesses that required connection pooling .. or (as you suggest) if 
there were large volumes of code to load (although that can usually be 
avoided with careful programming)

PerlEx gives you database accessing speeds that are similar to ASP .. 
which brings up the other situation that I'd use it - when someone was 
going to do performance comparisons 'between'* Perl and ASP

I consider the USD$395 price tag perfectly reasonable for the 
performance increase in those specific situations (and let's face it - I 
never pay the cost personally)

my only gripe about PerlEx is that they couldn't bring themselves to 
give away a developer version that didn't have it's performance 
annoyingly crippled .. 2 seconds is a long time during development

* 'between' is in quotes because the two are not really directly 
comparable .. but that doesn't stop management from doing comparisons ;)

-- 
  jason -- elephant@squirrelgroup.com --


------------------------------

Date: Wed, 11 Oct 2000 04:15:39 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Reading a whole file into a string
Message-Id: <x7vgv0ypw6.fsf@home.sysarch.com>

>>>>> "G" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:

  G> Uri Guttman ignorantly rants:
  >> > Godzilla! well exemplifies what he doesn't understand:

where did that line come from? i never wrote it so don't attribute it to
me even if it is true.

  G> I am quite convinced you are psychotically obsessed with me.

more than i should be, but i like perl too much to let you poison this
group. so i will spend the energy required to constantly correct you and
make sure no one ever listens to your drivel and bad code. others do
this too. hmm, could it be a conspiracy, or are you just paranoid? or
are you the loon who can't handle technical feedback unlike everyone
else?

this is not the movie '12 angry men' and you are not henry fonda
fighting the other 11 jurors for acquittal. rather, we are the larger
and correct group and you are the nut case who can't tell reality from
delusion. we will keep telling you, 'you are wrong' until you get it and
wise up. you post your real name now, join the human race and admit you
don't know programming and maybe you can learn. worse off mental cases
have recovered than you, but this is not the group to help that part of
your illness. so go away, get mentally healthy, and when you can
interact properly here and listen to your technical betters, you might
be welcomed back. until then get lost!

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: Wed, 11 Oct 2000 04:14:20 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: regex challenge
Message-Id: <slrn8u7q8j.8q8.mgjv@verbruggen.comdyn.com.au>

On Wed, 11 Oct 2000 03:36:47 GMT,
	Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> On Wed, 11 Oct 2000 03:14:41 GMT,
> 	Uri Guttman <uri@sysarch.com> wrote:
> > 
> > bleh! let's cheat a little:
> > 
> > 	s/(\w\w) (\w\w) /$1$2:/g ; chop ;
> 
> Heh, good one. You need to cheat a little more though :)
> 
> s/(" )?(\w\w) (\w\w) "?/$2$3:/g; chop;

Look ma: No chop, single line. Butt-ugly though

$_ = join ':', map { tr/" //d, $_ or () } split /(\w\w \w\w)/;

Martien

PS. Does anyone know how long perl has had trouble with 

# perl -e '"$""'

but not with

# perl -e 'qw($")'

? And is this considered a bug (if it's known)? 

It's been there at least since 5.004. Looks a bit like perl's parser
has trouble identifying that the second '"' ispart of the variable
name. It's a pity. $" could be such a good obfuscation tool.
-- 
Martien Verbruggen              | 
Interactive Media Division      | If at first you don't succeed,
Commercial Dynamics Pty. Ltd.   | destroy all evidence that you tried.
NSW, Australia                  | 


------------------------------

Date: Tue, 10 Oct 2000 21:15:46 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: regex challenge
Message-Id: <39E3E972.AD5E8527@stomp.stomp.tokyo>

Uri Guttman blathered:

 
> > Godzilla! wrote an article at too high of a language
              level for his reading comprehension skill level:

 
> > > Matt Martini wrote:
> > > (snipped)
 
> you snipped the important part and didn't read the subject. typical lack
> of reading comprehension from moronzilla.
 
> From: Matt Martini <martini@invision.net>
> Subject: regex challenge
> Newsgroups: comp.lang.perl.misc
> Date: Tue, 10 Oct 2000 22:04:15 -0400
> Organization: Posted via Supernews, http://www.supernews.com
> Reply-To: martini@invision.net
> Path: typhoon.ne.mediaone.net!chnws05.ne.mediaone.net!24.147.2.43!chnws02.mediaone.net!newsfeed2.skycache.com!newsfeed.skycache.com!Cidera!newsfeed.direct.ca!look.ca!logbridge.uoregon.edu!sn-xit-03!sn-post-01!supernews.com!corp.supernews.com!not-for-mail
> Message-ID: <39E3CA9F.21ABE4D0@invision.net>
> X-Mailer: Mozilla 4.75 (Macintosh; U; PPC)
> X-Accept-Language: en,en-US
> MIME-Version: 1.0
> Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353"
> Content-Transfer-Encoding: 7bit
> X-Complaints-To: newsabuse@supernews.com
> Lines: 41
> Xref: chnws05.ne.mediaone.net comp.lang.perl.misc:277593



You are correct. I missed all this header information.
Thank you for posting this. I shall be more careful
about reading all header content. This is important.


Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


------------------------------

Date: Tue, 10 Oct 2000 23:12:35 -0500
From: "Andrew N. McGuire " <anmcguire@ce.mediaone.net>
Subject: Re: regex challenge
Message-Id: <Pine.LNX.4.21.0010102306110.18432-100000@hawk.ce.mediaone.net>

On Tue, 10 Oct 2000, Jeff Pinyan quoth:

JP> [posted & mailed]
JP> 
JP> On Oct 10, Matt Martini said:
JP> 
JP> >The SNMP module returns mac addresses in the format:
JP> >
JP> >    " AB 21 34 65 78 09 "
JP> >
JP> >Yes, including the quotes and leading/trainling spaces.  I want to
JP> >convert this into a more standard
JP> >notation for mac addresses:
JP> >
JP> >    AB21:3465:7809
JP> 
JP> Depending how exact the MAC address is formatted, this should work:
JP> 
JP>   ($addr = substr($MAC,2,-2)) =~ s/ /('',':')[$i++%2]/eg;
JP> 
JP> That alternates between '' and ':' for replacements for spaces.

Here is my way, it alternates, just differently:

s/" | "//g;
1 while s/ // && s/ /:/;

anm
-- 
package News::NNTPClient;use subs q;warn;;sub warn{0}package main;use
News::NNTPClient;$;=News::NNTPClient->new();($==>$$)=($;->group(($|||
((<comp.lang.perl.misc>)))));for$)(<$=>..<$$>){map{$\=v12;die 1?qq{$1
}:q--while s<^.+(j..T .{6}(r) p.R. .{5}\2).+>[$1]mig}$;->article($))}



------------------------------

Date: Wed, 11 Oct 2000 04:21:47 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: regex challenge
Message-Id: <slrn8u7qmi.8q8.mgjv@verbruggen.comdyn.com.au>

On Tue, 10 Oct 2000 23:12:35 -0500,
	Andrew N. McGuire  <anmcguire@ce.mediaone.net> wrote:
> 
> s/" | "//g;
> 1 while s/ // && s/ /:/;

This one gets my vote.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd.   | cynical. It's perfectly easy to be
NSW, Australia                  | cynical.


------------------------------

Date: Wed, 11 Oct 2000 04:17:32 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: regex challenge
Message-Id: <x7snq4ypt6.fsf@home.sysarch.com>

>>>>> "MV" == Martien Verbruggen <mgjv@tradingpost.com.au> writes:

  MV> On Wed, 11 Oct 2000 03:14:41 GMT,
  MV> 	Uri Guttman <uri@sysarch.com> wrote:
  >> 
  >> s/(\w\w) (\w\w) /$1$2:/g ; chop ;

  MV> Heh, good one. You need to cheat a little more though :)

  MV> s/(" )?(\w\w) (\w\w) "?/$2$3:/g; chop;

  MV> or 

  MV> s/(?:" )?(\w\w) (\w\w) "?/$1$2:/g; chop;

  MV> Since 

  MV> $_ = '" AB 21 34 65 78 09 "';

yeah, i was using simpler test data. forgot about the outside ""

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: Wed, 11 Oct 2000 04:21:07 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: regex challenge
Message-Id: <x7pul8ypn2.fsf@home.sysarch.com>

>>>>> "G" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:

  G> Uri Guttman blathered:
  >> > Godzilla! wrote an article at too high of a language
  G>               level for his reading comprehension skill level:

typical misquote (rather made up quote).

  >> you snipped the important part and didn't read the subject. typical lack
  >> of reading comprehension from moronzilla.
 
  >> Subject: regex challenge

  G> You are correct. I missed all this header information.
  G> Thank you for posting this. I shall be more careful
  G> about reading all header content. This is important.

just read the subject header. so how could you have claimed the above
article and then apologize for the lack of header parsing skills?

oh, it is moronzilla! logic need not apply. 

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: Wed, 11 Oct 2000 00:28:59 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: regex challenge
Message-Id: <Pine.GSO.4.21.0010110028320.14163-100000@crusoe.crusoe.net>

On Oct 10, Andrew N. McGuire  said:

>On Tue, 10 Oct 2000, Jeff Pinyan quoth:
>
>JP>   ($addr = substr($MAC,2,-2)) =~ s/ /('',':')[$i++%2]/eg;
>
>s/" | "//g;
>1 while s/ // && s/ /:/;

Daaaaaaaaaaaaamn.

-- 
Jeff "japhy" Pinyan     japhy@pobox.com     http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine            http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc.    http://www.perlarchive.com/
CPAN - #1 Perl Resource  (my id:  PINYAN)        http://search.cpan.org/





------------------------------

Date: Wed, 11 Oct 2000 16:18:01 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Strange programming logic and localtime
Message-Id: <H%TE5.19$Dr4.3708@vic.nntp.telstra.net>

Having read this group for a couple of years now I thought I had seen
most of the wierd ways of dealing with localtime but this one gave me a
chuckle:

$year = ($year - 100) + 2000;

The things people think of!

Wyzelli

--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;




------------------------------

Date: Wed, 11 Oct 2000 04:54:51 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: the fastest way to test String A included by String B
Message-Id: <su7skr4gh2p8c3@corp.supernews.com>

Larry Rosler (lr@hpl.hp.com) wrote:
: > Not necessarily fastest, but this has a pleasing directness to it:
: > 
: >   my %h;
: >   @h{@A, @B} = (1) x (@A + @B);
: >   my $is_subset = keys %h == @A;
: 
: Sure, and I'll bet it is almost the fastest.  To make it faster, why are 
: you assigning values that are never used?
: 
:     @h{@A, @B} = ();

You know, sometime way back when I got it in my head that the rhs of a
hash slice assignment had to have the right number of elements or you'd
get warnings.  I should really put a post-it on my monitor until I unlearn
that.

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "Quidquid latine dictum sit, altum viditur."
   |


------------------------------

Date: Wed, 11 Oct 2000 13:23:16 +0900
From: Yongsik Kim <yosikim@lgeds.lg.co.kr>
Subject: Re: Using each() on hash of hashes
Message-Id: <39E3EB34.6ECF1631@lgeds.lg.co.kr>

refer Hashes of Hashes from
http://www.perl.com/pub/doc/manual/html/pod/perldsc.html#HASHES_OF_HASHES


dustintodd@my-deja.com wrote:
> 
> My brain has jumped out of my head and is floping around on the ground.
> If I wish to iterate through a hash using while and each, but the hash
> is actually stored inside another hash. I am not sure how to get
> reference to has stored inside a hash that I can then give to each().
> Please help.
> 
> - Dustin -
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.


------------------------------

Date: Wed, 11 Oct 2000 04:34:08 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Using each() on hash of hashes
Message-Id: <slrn8u7rdo.3sj.tjla@thislove.dyndns.org>

I was shocked! How could dustintodd@my-deja.com <dustintodd@my-deja.com>
say such a terrible thing:
>My brain has jumped out of my head and is floping around on the ground.
>If I wish to iterate through a hash using while and each, but the hash
>is actually stored inside another hash. I am not sure how to get
>reference to has stored inside a hash that I can then give to each().
>Please help.

Have a look at:

perldoc perldsc

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Do, or do not. There is no try.

		-- George Lucas, "The Empire Strikes Back" (Yoda)


------------------------------

Date: 11 Oct 2000 05:54:49 GMT
From: kuritzky@math.berkeley.edu (Eric Kuritzky)
Subject: Re: Using each() on hash of hashes
Message-Id: <8s0vb9$mkh$1@agate.berkeley.edu>

In article <slrn8u7rdo.3sj.tjla@thislove.dyndns.org>,
Gwyn Judd <tjla@guvfybir.qlaqaf.bet> wrote:
>I was shocked! How could dustintodd@my-deja.com <dustintodd@my-deja.com>
>say such a terrible thing:
>>My brain has jumped out of my head and is floping around on the ground.
>>If I wish to iterate through a hash using while and each, but the hash
                                            ^^^^^^^^^^^^^^^
>>is actually stored inside another hash. I am not sure how to get
>>reference to has stored inside a hash that I can then give to each().
>>Please help.
>
>Have a look at:
>
>perldoc perldsc

This doesn't use while and each, which is what the original poster
wanted.  Using while and each saves memory.  Try this instead:

 %HoH = (
        flintstones => {
                lead      => "fred",
                pal       => "barney",
        },
        jetsons     => {
                lead      => "george",
                wife      => "jane",
                "his boy" => "elroy",
        },
        simpsons    => {
                lead      => "homer",
                wife      => "marge",
                kid       => "bart",
        },
 );

while(my($family,$hashref)=each(%HoH)){
   print "$family => {\n";
   while(my($role,$name)=each(%$hashref)){print qq(\t$role => "$name",\n)};
   print "},\n"};



------------------------------

Date: Wed, 11 Oct 2000 13:46:25 +0900
From: Yongsik Kim <yosikim@lgeds.lg.co.kr>
Subject: Re: Using OLE and Excel
Message-Id: <39E3F0A0.F166265A@lgeds.lg.co.kr>

if you installed OLE, OLE.pm has its documentation and examples in it.

http://www.activestate.com/Products/ActivePerl/docs/site/lib/Win32/OLE.html#examples


hajir@my-deja.com wrote:
> 
> I want to know how to INSERT a row into the worksheet for excel.
> 
> Thanks
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.


------------------------------

Date: Wed, 11 Oct 2000 15:56:44 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: What does $++ mean?
Message-Id: <39E4011C.B9E67C18@spider.herston.uq.edu.au>

> What variable would that be?
> 
> $+ +;  syntax error as a lone plus after a variable doesn't make sense.
>        $+ is read-only anyway and can't be modified.
> 
> $ ++;  syntax error as a lone dollar sign doesn't make sense, and certainly
>        isn't a variable.
> 

Isn't $+ the version number for the next version of perl (magical lookahead
variable)?  So $++ would actually speed up the development process by allowing
us to skip a version.  This is pure genius.  Unfortunately, it won't compile
until the version after that.

Jaime metcher


------------------------------

Date: Wed, 11 Oct 2000 04:42:55 GMT
From: Steve Silberman <digaman@wired.com>
To: neil@geekcruises.com
Subject: Wired on Perl Whirl 2000
Message-Id: <8s0r4f$eus$1@nnrp1.deja.com>

Hello folks:

My article on Perl Whirl 2000 that appeared in the October issue of
Wired magazine (8.10) is finally online.  My assignment was to
write about the maiden voyage of Geek Cruises
(www.geekcruises.com), but since Larry Wall, Tom Christiansen,
Mark-Jason Dominus, Randal Schwartz, "Ziggy" Turoff, Uri
Guttman, D. Jasmine Merced, and other illustrious personages
were onboard, I also ended up writing about Perl -- a bit of its
history, some of the human drama around it, and the diverse ways
the 130-plus programmers on the cruise use Perl for work and
creativity.

Most of the article is about the ways that hackers amuse
themselves on a cruise ship, but the insightful comments that
Larry makes about diversity in open-source communities may be
of particular interest to readers of this newsgroup.

The standard-issue link is here:
http://www.wired.com/wired/archive/8.10/cruise.html

A preferable click-free, ad-free link is here:
http://www.wired.com/wired/archive/8.10/cruise_pr.html

And Mark-Jason Dominus's newbie-friendly guide to essential Perl
resources is here:
http://www.wired.com/wired/archive/8.10/perl.html

Enjoy!


Steve Silberman
contributing editor
Wired





Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

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 4580
**************************************


home help back first fref pref prev next nref lref last post