[22738] in Perl-Users-Digest
Perl-Users Digest, Issue: 4959 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 8 18:07:02 2003
Date: Thu, 8 May 2003 15:05:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 8 May 2003 Volume: 10 Number: 4959
Today's topics:
Re: beautification: ip number translation <glex_nospam@qwest.net>
Re: beautification: ip number translation (none)" <""cvd\"@(none)
Re: Design Opinions - Dealing with Constants <emschwar@pobox.com>
Re: Hash memory consumption ctcgag@hotmail.com
Re: Hash memory consumption <mhunter@celeste.net.berkeley.edu>
Re: Hash memory consumption <mhunter@celeste.net.berkeley.edu>
Re: Help: Need nifty idea for efficiently linking objec <skuo@mtwhitney.nsc.com>
Re: how to enforce decimal interpretation of a number <mjcarman@mchsi.com>
Re: how to enforce decimal interpretation of a number <mfranz@users.sourceforge.banana>
Re: how to enforce decimal interpretation of a number <abigail@abigail.nl>
Re: Ina a binary file is a space padded text file conve <tassilo.parseval@rwth-aachen.de>
Re: Net::SMTP debug <bigus AT creationfactor DOT net>
Re: Newbie how to split file <goedicke@goedsole.com>
Re: Newbie how to split file <wksmith@optonline.net>
Re: Newbie how to split file <chang0@adelphia.net>
Re: Newbie how to split file <tzz@lifelogs.com>
Re: Newbie how to split file (Joe B)
Re: OT: Alternative to Xwin? (entropy123)
Re: Perl code to dump palm datebook? <ethan@draupnir.gso.saic.com>
Perl LWP and the https protocol <mooncm.lbkejwiAhEgSfSe@dAcEbSaS>
Re: Perl LWP and the https protocol <mothra@nowhereatall.com>
Re: Recursive copying question (Sara)
Single-threaded, long-running network server? <mikeother@comcast.net>
Re: Sorting book list <gopalan@cs.sc.edu>
Re: Sorting book list <wksmith@optonline.net>
Re: Sorting book list <gopalan@cs.sc.edu>
What does ${*$foo}{'bar'} mean? <jill_krugman@yahoo.com>
Re: What does ${*$foo}{'bar'} mean? <nobull@mail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 08 May 2003 10:50:57 -0500
From: Jeff D Gleixner <glex_nospam@qwest.net>
Subject: Re: beautification: ip number translation
Message-Id: <NZuua.96$Xp1.21013@news.uswest.net>
Costyn van Dongen wrote:
> Hi,
>
> I have some really ugly code that I'm sure someone here can think of
> something more elegant. The input is an IP number, or part of an ip
> number. My code then, based on how many octets are specified, generates
> a slice of SQL code, which will go into a larger SQL code piece later.
> INET_ATON converts an IP number from octets to integer.
[...]
Might want to look at Net::Netmask
------------------------------
Date: Thu, 08 May 2003 20:57:18 +0200
From: "@(none)" <""cvd\"@(none)">
Subject: Re: beautification: ip number translation
Message-Id: <3ebaa88f$0$2231$e4fe514c@dreader6.news.xs4all.nl>
Jeff D Gleixner wrote:
> Might want to look at Net::Netmask
Thanks, that looks like what I need. :-)
------------------------------
Date: 08 May 2003 10:51:43 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Design Opinions - Dealing with Constants
Message-Id: <etohe85wfds.fsf@wormtongue.emschwar>
Malte Ubl <ubl@schaffhausen.de> writes:
> this might be perlish:
>
> use Vars::From "config.pl";
>
> use Vars::From would then evaluate config.pl in a unique namespace and
> import all symbols to the current one.
Now that's nifty! I'll have to look that one up.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
------------------------------
Date: 08 May 2003 15:34:33 GMT
From: ctcgag@hotmail.com
Subject: Re: Hash memory consumption
Message-Id: <20030508113433.265$fO@newsreader.com>
mhunter@uclink.berkeley.edu wrote:
> On 28 Apr 2003 18:33:13 GMT, ctcgag@hotmail.com wrote:
> > > I followed a suggestion on this group to try pack'ing
> > > values to be stored instead of storing array references, but it
> > > hasn't helped much.
> >
> > Did you try tying it to disk?
>
> Unfortunately it's actually a hash of hashes, so that isn't straight
> forward. I was pointed at a class/package that does that but I couldn't
> make it work.
Ahh, that's a different beast.
...
> My thought was that the data structure overhead was the problem, somehow.
It could be, but the only way to know is to get good numbers. Large
hashes contain large numbers of scalars, and scalars are often pretty
memory inefficient.
> > Large hashes are pretty memory efficient, at least for general purpose
> > use. If you're use for the hash is not general purpose, I'd have to
> > know what is non-general about your purpose before suggesting ways to
> > improve it.
>
> Basically I have
>
> while (<HUGEDATA>)
> {
> my ($source, $dest, $d1,$d2,$d3,$d4,$d5) = split...;
> $hash{$source}->{$dest} += [$d1,$d2,$d3,$d4...];
> }
>
> Of course with lots more code to make that actually work.
That += can't do anything good to your arrayref, so I assume
that's not actually what you do.
How many distinct $source values are there? You have that number
of hashes, plus the one master hash. Each hash has ~80 bytes of overhead,
which is insignificant for a huge hash (because it's spread over thousands
of entries), but that ~80 bytes each adds up when there are 100,000 hashes
with only 2 entries each.
How many $dest values are there for each $source? In addition to ~80 bytes
overhead, each hash entry requires about 12-16 bytes overhead (i.e. 12-16
bytes more than it would take to store the key and value in an array),
unless the key is already key in another hash, then it's just 12-16 bytes
more than the value takes.
However, there isn't much you can do about all this, besides making
fewer hashes or fewer hash entries. Really, you need the numbers,
once you have those you can model the system to see where the
memory is going.
If I were in your shoes, I would go a different route:
1a) Use a system sort method to sort huge_data by source and target,
then just process it in a single pass without having to store
everything in memory (It seems you are only hashes for grouping
so this should be possible).
1b) or, run the program N times, computing a checksum%N on source and
processing a different result set each time.
2) and then, I'd look into whatever is generating the huge file, to
see if it can't do it in a better way.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service New Rate! $9.95/Month 50GB
------------------------------
Date: Thu, 8 May 2003 21:46:34 +0000 (UTC)
From: Mike Hunter <mhunter@celeste.net.berkeley.edu>
Subject: Re: Hash memory consumption
Message-Id: <slrnbbljv3.18l.mhunter@celeste.net.berkeley.edu>
On Wed, 07 May 2003 16:29:43 -0500, Michael Carman wrote:
> On 5/7/2003 2:48 PM, Mike Hunter wrote:
> > On 28 Apr 2003 18:33:13 GMT, ctcgag@hotmail.com wrote:
> >
> >>> My question is: Is there any way to reduce the consumption of
> >>> the hash data structure itself?
> >
> > Basically I have
> >
> > while (<HUGEDATA>)
> > {
> > my ($source, $dest, $d1,$d2,$d3,$d4,$d5) = split...;
> > $hash{$source}->{$dest} += [$d1,$d2,$d3,$d4...];
> > }
>
> What does 'print scalar %hash' show? Are there more $source keys or
> $dest keys?
There are a lot more dest keys. The number of source keys is small (10 to
20).
> If you're getting lots of key collisions it's possible that Perl is
> allocating more memory (buckets) for the hash without making good use of it.
Is there a way to change the key length to something large before I start
entering data?
> What kind of values are $source and $dest? (string vs integer, small
> numbers vs large, (nearly) sequential vs random...)
source and dest are 7 byte strings (ipv4 + port + ip_protocol)
------------------------------
Date: Thu, 8 May 2003 22:01:41 +0000 (UTC)
From: Mike Hunter <mhunter@celeste.net.berkeley.edu>
Subject: Re: Hash memory consumption
Message-Id: <slrnbblkre.18l.mhunter@celeste.net.berkeley.edu>
On Thu, 8 May 2003 21:46:34 +0000 (UTC), Mike Hunter wrote:
> On Wed, 07 May 2003 16:29:43 -0500, Michael Carman wrote:
> > On 5/7/2003 2:48 PM, Mike Hunter wrote:
> > > On 28 Apr 2003 18:33:13 GMT, ctcgag@hotmail.com wrote:
> > >
> > >>> My question is: Is there any way to reduce the consumption of
> > >>> the hash data structure itself?
> > >
> > > Basically I have
> > >
> > > while (<HUGEDATA>)
> > > {
> > > my ($source, $dest, $d1,$d2,$d3,$d4,$d5) = split...;
> > > $hash{$source}->{$dest} += [$d1,$d2,$d3,$d4...];
> > > }
> >
> > What does 'print scalar %hash' show? Are there more $source keys or
> > $dest keys?
>
> There are a lot more dest keys. The number of source keys is small (10 to
> 20).
Oops. That should be *= 65536.
------------------------------
Date: Thu, 8 May 2003 14:49:50 -0700
From: Steven Kuo <skuo@mtwhitney.nsc.com>
Subject: Re: Help: Need nifty idea for efficiently linking objects together and making comparisons,,,
Message-Id: <Pine.GSO.4.21.0305081444510.6141-100000@mtwhitney.nsc.com>
On 8 May 2003, Michael Zawrotny wrote:
> On 7 May 2003 20:32:41 -0700, entropy123 <email_entropy123@yahoo.com> wrote:
> > For example, starting with the knowledge of the bonds each atom has I
> > need to figure out if there is a ring structure. So, for a six carbon
> > molecule is it something like C-C-C-C-C-C or a ring structure.
> >
> > My idea is to take the bonding information and - starting with an
> > individual atom - create an array. If the array ever has the starting
> > atom as an element then I know I have a ring..
>
> Not necessarily.
>
> C
> |
> C-C-C-C
> |
> C
>
>
> Mike
>
>
I'll add:
What about diamond (Carbon atom connected to four others in
a tetrahedral structure, repeated to form a crystal)?
C
|
/ C-C
C \
C
Or a buckyball (C60)? I'm not going to draw that one ;)
--
Regards,
Steven
------------------------------
Date: Thu, 08 May 2003 09:34:29 -0500
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: how to enforce decimal interpretation of a number
Message-Id: <b9dptq$9u8@onews.collins.rockwell.com>
On 5/8/2003 8:31 AM, Melchior FRANZ wrote:
>
> I've got a table with decimal numbers, some of which are badly
> formatted, such as -002.345. Because of the leading zeros,
> Perl interprets the integer part as octal and appends the
> fractional part verbatim:
>
> $ perl -e '$x = -0010.345; print "$x\n"'
> -8345
The interpretation of numbers with leading zeros as octal only applies
to values in your source code, not to any data you read in (which is
treated as a string and "nummified" as necessary). So if it's your
source code that's badly formatted, why not fix it directly instead of
working around it?
-mjc
------------------------------
Date: Thu, 08 May 2003 17:28:17 +0200
From: Melchior FRANZ <mfranz@users.sourceforge.banana>
Subject: Re: how to enforce decimal interpretation of a number
Message-Id: <3eba7792$0$26136$91cee783@newsreader02.highway.telekom.at>
* Michael Carman -- Thursday 08 May 2003 16:34:
> The interpretation of numbers with leading zeros as octal only applies
> to values in your source code, not to any data you read in (which is
> treated as a string and "nummified" as necessary). So if it's your
> source code that's badly formatted, why not fix it directly instead of
> working around it?
Umm ... I don't know any more, in which situation exactly I had this
problem. I only had this silly substitution rule in a script (the one
that removes leading zeros), and wanted to get rid of it. When I tried
now to reproduce the problem on the command line, I was fooled by the
octal interpretation of numbers. (The weird numbers are in a database
that I cannot change, and they are to be used as hash keys and must
not be interpreted as strings. Adding 0 solved my problem.) Thanks to
all, and sorry for the stupid question.
m.
------------------------------
Date: 08 May 2003 21:57:00 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: how to enforce decimal interpretation of a number
Message-Id: <slrnbblklb.npo.abigail@alexandra.abigail.nl>
Michael Carman (mjcarman@mchsi.com) wrote on MMMDXXXVII September
MCMXCIII in <URL:news:b9dptq$9u8@onews.collins.rockwell.com>:
$$ On 5/8/2003 8:31 AM, Melchior FRANZ wrote:
$$ >
$$ > I've got a table with decimal numbers, some of which are badly
$$ > formatted, such as -002.345. Because of the leading zeros,
$$ > Perl interprets the integer part as octal and appends the
$$ > fractional part verbatim:
$$ >
$$ > $ perl -e '$x = -0010.345; print "$x\n"'
$$ > -8345
$$
$$ The interpretation of numbers with leading zeros as octal only applies
$$ to values in your source code, not to any data you read in (which is
$$ treated as a string and "nummified" as necessary). So if it's your
$$ source code that's badly formatted, why not fix it directly instead of
$$ working around it?
There is one case where data is considered code, and that place
is 'eval' - which included s///e.
I have been bitten by this myself. Stripping leading zeros is
usually a good solution.
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
------------------------------
Date: 8 May 2003 19:27:09 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Ina a binary file is a space padded text file converted to nulls ?
Message-Id: <b9eb2d$26o$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Anthony:
> Tassilo v. Parseval <tassilo.parseval@rwth-aachen.de> wrote in message
> news:b9dl5o$3uq$1@nets3.rz.RWTH-Aachen.DE...
>: Also sprach Anthony:
>:
>: > just say I had a twelve character hostname field and I'm converting
>: > it and other data to a binary file, if the text filed hostname is
>: > padded witrh spaces is this converted to nulls when converting it
>: > to binary. If not how do you do it ??
>:
>: How should we tell? You are using your own converting routine so you
>: should probably know. Show us your code and we can probably tell you
>: what it does (heh).
>
> well basically it was
> binmode NEW;
> print NEW <<EODATA;
> but if you use
> print . . . . pack
>
> is this any different ?
No change. You still need binmode() on your handle (at least on Windows
and possibly even on recent Red Hats). It certainly wont hurt even on
systems that don't need it. Very recently there was a thread about this
very topic. Look for the thread with the subject "How do you create a
biniary file in Perl.".
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Thu, 8 May 2003 16:09:52 +0100
From: "Bigus" <bigus AT creationfactor DOT net>
Subject: Re: Net::SMTP debug
Message-Id: <b9ds07$jme@newton.cc.rl.ac.uk>
"Bigus" <bigus AT creationfactor DOT net> wrote in message
news:b9doh1$r9e@newton.cc.rl.ac.uk...
> Hi
>
> I've been following a tutorial
> (http://perl.about.com/library/weekly/aa022000d.htm) on sending an email
> using Net::SMTP.
>
> Nice and simple and everything works fine, but... I want to change the
debug
> part of it.
>
> At present, the following lines from the script on that article feed all
the
> transaction conversation with the mail server to my browser:
>
> my $DEBUG = 1;
> if($DEBUG)
> {
> $| = 1;
> open(STDERR, ">&STDOUT");
> }
>
> Now, I don't actually want to feed the debug info to the browser, however,
I
> *do* want to know that the transaction went OK.
>
> So, given that one of the last lines in the transaction reads like this:
>
> <<< 250 2.0.0 h48Dkw013626 Message accepted for delivery
> Net::SMTP=GLOB(0x18857a8)
>
> I thought that if, instead of using STDERR (which I don't know how to
use),
> I fed all the transaction lines into a scalar or array, then I could test
> for the presence of the string "Message accepted for delivery" and if it
> can't find it then print out the whole transaction conversation to a log
> file and display a simple error message in the browser.
>
> The question is, how do I feed the debug transaction info into a variable?
I
> tried:
>
> $| = 1;
> $stdout = ">&STDOUT";
>
> but that didn't work (as you can probably see, I've never used this STDOUT
> thing before ;).
Actually, I guess that's pretty stupid of me.. I suppose STDERR lines are
sent as each line of the script is processed, so one could just test the
appropriate command to see if the "Message accepted for delivery" is the
result.. and I presume that would be the $smtp->dataend() command?
Bigus
------------------------------
Date: Thu, 08 May 2003 15:09:42 GMT
From: William Goedicke <goedicke@goedsole.com>
Subject: Re: Newbie how to split file
Message-Id: <m3wuh11nm9.fsf@mail.goedsole.com>
Dear Freidrich -
"Freidrich" <fclack50@yahoo.com> writes:
> I have file is 28 bytes
> and I need to have text name = 12 bytes char and textnumber = 16bytes
> numerics.
>
> Can please tell how to split,
> ($textname, $textnumber) = split(/ /$line)
( $textname, $textnumber ) =~ /(.{12})(.{16})/;
You should use regular expressions whenever matching text.
perldoc perlrequick
perldoc perlretut
Also read about assignment "en passant"
Yours - Billy
============================================================
William Goedicke goedicke@goedsole.com
http://www.goedsole.com:8080
============================================================
Lest we forget:
The Computer Professional's Credo: "To protect and to serve."
- William Goedicke
------------------------------
Date: Thu, 08 May 2003 15:28:07 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Newbie how to split file
Message-Id: <bIuua.21562$AG6.4337682@news4.srv.hcvlny.cv.net>
"Freidrich" <fclack50@yahoo.com> wrote in message
news:b9dpun$hupgo$1@ID-82947.news.dfncis.de...
> Hello,
>
> Pardon my English. new to Perl have not used it
>
> I have file is 28 bytes
> and I need to have text name = 12 bytes char and textnumber = 16bytes
> numerics.
>
> Can please tell how to split,
> ($textname, $textnumber) = split(/ /$line)
You do not need split, just the list context.
my $line = '1234567890123456789012345678';
($textname, $textnumber) = $line =~ /^(.{12})(.{16})$/;
if ( defined $textname and defined $textnumber){
print "$textname $textnumber\n";
} else{
print "Invalid line\n";
}
The regex probably should be changed to reduce the chance of false
matches. This requires knowledge of you data.
Hope this helps,
Bill
------------------------------
Date: Thu, 08 May 2003 16:00:43 GMT
From: ebchang <chang0@adelphia.net>
Subject: Re: Newbie how to split file
Message-Id: <Xns93757A30A969Fchang0adelphia.net@24.48.107.53>
"Freidrich" <fclack50@yahoo.com> wrote in news:b9dpun$hupgo$1@ID-
82947.news.dfncis.de:
> Hello,
>
> Pardon my English. new to Perl have not used it
>
> I have file is 28 bytes
> and I need to have text name = 12 bytes char and textnumber = 16bytes
> numerics.
>
> Can please tell how to split,
> ($textname, $textnumber) = split(/ /$line)
my ($textname, $textnumber) = (substr($line, 0, 12), substr($line, 12));
--
EBC
------------------------------
Date: Thu, 08 May 2003 13:23:18 -0400
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Newbie how to split file
Message-Id: <4nisslbbeh.fsf@lockgroove.bwh.harvard.edu>
On Thu, 08 May 2003, goedicke@goedsole.com wrote:
> Dear Freidrich -
>
> "Freidrich" <fclack50@yahoo.com> writes:
>
>> I have file is 28 bytes and I need to have text name = 12 bytes
>> char and textnumber = 16bytes numerics.
>>
>> Can please tell how to split,
>> ($textname, $textnumber) = split(/ /$line)
>
> ( $textname, $textnumber ) =~ /(.{12})(.{16})/;
>
> You should use regular expressions whenever matching text.
>
> perldoc perlrequick
> perldoc perlretut
>
> Also read about assignment "en passant"
Excellent suggestions, but the OP is not matching text. Also, be
careful with characters vs. bytes - your solution will match
characters, which are not the same as bytes. Note the OP said "bytes"
not letters or characters, that's why I'm bringing this up.
perldoc -f substr (as suggested by another poster, but also has the
character vs. bytes issue)
perldoc -f unpack (probably the best solution in this case)
perldoc -f pack
Ted
------------------------------
Date: 8 May 2003 12:57:19 -0700
From: Joe_Blakistone@performanceretail.com (Joe B)
Subject: Re: Newbie how to split file
Message-Id: <b7cae375.0305081157.7bfb9494@posting.google.com>
"Freidrich" <fclack50@yahoo.com> wrote in message news:<b9dpun$hupgo$1@ID-82947.news.dfncis.de>...
> Hello,
>
> Pardon my English. new to Perl have not used it
>
> I have file is 28 bytes
> and I need to have text name = 12 bytes char and textnumber = 16bytes
> numerics.
>
> Can please tell how to split,
> ($textname, $textnumber) = split(/ /$line)
>
>
> Freid.
Use the substr to split a fixed length format.
substr returns a string that is s substring of a larger string.
substr(FULLSTRING, POSITION, LENGTH)
Remember the first charecter is at position 0.
$textname = substr($line, 0, 12);
$textnumber = substr($line, 12, 28);
------------------------------
Date: 8 May 2003 11:11:53 -0700
From: email_entropy123@yahoo.com (entropy123)
Subject: Re: OT: Alternative to Xwin?
Message-Id: <90cdce37.0305081011.b38638f@posting.google.com>
Chris,
Yes I mean X-Win32 .... I pretty much like the app but I just can't
seem to get it working from home. When will I be able to get my hands
on this new module?
Thanks,
entropy
Christopher Fowler <cfowler@outpostsentinel.com> wrote in message news:<1052398335.950766@minime.linuxiceberg.com>...
> entropy123 wrote:
>
> > Hey all,
> >
> > I'd like to work more from home and can VPN/SSH work. However, no
> > matter what I can't seem to get Xwin working behind my firewall/router
> > combo. Is there an alternative comparable app to Xwin? Hopefully
> > free....
> >
> > Thanks,
> > entropy
>
> I'm not wure if you mean Xwin-32. But, Xwin-32 is the way to go. They
> are releasing a new module that uses the putty api to tunnel inside
> of SSH. I've seen demos and it works quite well.
>
> Chris
------------------------------
Date: 08 May 2003 11:28:09 -0700
From: Ethan Brown <ethan@draupnir.gso.saic.com>
Subject: Re: Perl code to dump palm datebook?
Message-Id: <vrhe85nvie.fsf@draupnir.gso.saic.com>
>>>>> "joe" == joe <joe@jolomo.net> writes:
joe> Does anyone have some perl code that will take the datebook.dat
joe> file from the palm hot-sync and output the entries in a log format
joe> something like:
joe> 2002 Dec 29 Sun 10:15 DFW -> ATL delta 1119
joe> 2003 Jan 9 Thu 14:00 Doctor appt
joe> 2003 Jan 9 Thu 16:00 Drinks @ Trader Vics
joe> 2003 Jan 12 Sun 13:00 Movie: It Happened One Night
joe> ie only print lines for times when there is data. If not from
joe> the datebook.dat maybe some other version of palm data (which?)
joe> I've looked at pilot-link & the PDB module, but they don't
joe> seem to do it.
joe> Thanks for any help
joe> --
joe> Joe Morris
joe> Live music in Atlanta http://jolomo.net/atlanta/shows.html
Hi Joe--
I wrote an perl application using the p5-palm modules. I found
I had to use some of the pilot-link applications to first dump
the palm database files to disk, and then use the modules to
do the decoding. Mail me at ethan@ethanbrown.NOSPAM.org (removing
the .NOSPAM.) and I'll send you a copy of my application.
Also, during my development I found a number of sample apps out on
the web. Google around a bit and see what you find.
--Ethan Brown
--Author: WheresTheGig.com
--In a band? Use http://www.WheresTheGig.com for free.
------------------------------
Date: Thu, 08 May 2003 17:56:12 GMT
From: "BSK" <mooncm.lbkejwiAhEgSfSe@dAcEbSaS>
Subject: Perl LWP and the https protocol
Message-Id: <0Twua.61843$ey1.5526131@newsread1.prod.itd.earthlink.net>
Hello All,
The LWP Perl module has been a great help to me by allowing me to automate a
lot of the standard things I do by way of the web -- except for one very
important thing. I interact quite a bit with my bank and broker by way of
the web and much of this interaction can be automated. However, the
interaction is controlled by the secure "https" protocol. The version of
LWP that I use is provided with the standard distribution of Active State
Perl and, specifically, the GET and POST functions of LWP work very nicely
with the standard non-secure http protocol.
Does anyone know if there are secure https versions of the LWP GET and POST
functions available anywhere?
Much thanks for your help.
BSK
[For AntiSpam: Email address is spelled
backwards. Remove every other letter
starting with 'a' in 'SaS'.]
------------------------------
Date: Thu, 8 May 2003 11:18:03 -0700
From: "Mothra" <mothra@nowhereatall.com>
Subject: Re: Perl LWP and the https protocol
Message-Id: <3eba9e1c$1@usenet.ugs.com>
"BSK" <mooncm.lbkejwiAhEgSfSe@dAcEbSaS> wrote in message
news:0Twua.61843$ey1.5526131@newsread1.prod.itd.earthlink.net...
> Hello All,
>
> Does anyone know if there are secure https versions of the LWP GET and
POST
> functions available anywhere?
>
> Much thanks for your help.
>
>
> BSK
You need to take a look at the lwpcook document. Basically,
you need the crypt-SSleay module to get the functionality you
are looking for.
Mothra
------------------------------
Date: 8 May 2003 12:54:02 -0700
From: genericax@hotmail.com (Sara)
Subject: Re: Recursive copying question
Message-Id: <776e0325.0305081154.2673ca31@posting.google.com>
merlyn@stonehenge.com (Randal L. Schwartz) wrote in message news:<fc942dbf91a78b091e4631e672573f37@TeraNews>...
>mes and dates. I
.
.
.
>
> Untested, but I usually do pretty good on this on the first try. :)
>
Hmmm I've *heard* that about you Randall! haha.. See you at OSCON..
-Gx
------------------------------
Date: Thu, 08 May 2003 16:20:24 -0400
From: "Michael L. Artz" <mikeother@comcast.net>
Subject: Single-threaded, long-running network server?
Message-Id: <XQGdnTWSqJfbIiejXTWcpA@comcast.com>
I am having a little design problem that I can't seem to wrap my head
aronud. I have an existing long running and processor intensive perl
script that I would like to modify to take commands from a network
socket. The script needs to be run single-threaded (i.e. no forking and
only one process can/should be running) due to synchronization issues.
My first thought was to just wrap a standard "listen, bind, select,
accept" loop around the computation, however at some point I need to run
the parts of the script that take a long time, and figured that I would
be dropping connections if too many queued up over the network.
I next thought of two other solutions: either (a) use an old-school IPC
shared variable to share data between the network server (which would
accept connections and add commands to the shared var) and the
long-running script (which would read/delete commands from the shared
var), or (b) have the server open a pipe to the long running process
(i.e. open LONGPIPE, "| myscript.pl") and modify the long running script
to do a select over STDIN.
I am sure that there is some existing idiom for this sort of work, but I
can't seem to find it, and thought that I would ask around a little
before I went and tried to code something that "works".
Any help would be appreciated.
Thanks
-Mike
------------------------------
Date: Thu, 8 May 2003 11:15:35 -0500
From: Gopi Sundaram <gopalan@cs.sc.edu>
Subject: Re: Sorting book list
Message-Id: <Pine.GSO.4.55.0305081100460.5419@rigel>
On Thu, 8 May 2003, Michael Budash wrote (quoting me):
>> I'm tring to sort my list of books. I store the list as an array of
>> hashes.
>
> nope. most likely you have an array of hashrefs. let's see some real
> data!
Here's the code:
http://www.zrox.net/Books/index.txt
> show us the data, or we can't really help.
The input data is here:
http://www.zrox.net/Books/books.txt
You can see the output here:
http://www.zrox.net/Books/
And if you look at the bottom, you'll see the "Arabian Nights" series is
not in order.
--
Gopi Sundaram
------------------------------
Date: Thu, 08 May 2003 19:09:15 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Sorting book list
Message-Id: <vXxua.22605$AG6.4860371@news4.srv.hcvlny.cv.net>
"Gopi Sundaram" <gopalan@cs.sc.edu> wrote in message
news:Pine.GSO.4.55.0305072351070.5146@rigel...
> I'm tring to sort my list of books. I store the list as an array of
> hashes.
>
> The sort order is the surname of the first author. If the book is part
> of a series, I want the books in the series to be in order. Not all
> books are in a series.
>
> The two fields in the hash I am interested in therefore, are 'series'
> and 'author'.
>
> The 'series' field looks like this for books:
>
> "Arabian Nights 1"
> "MVS 2"
> "Arabian Nights 2"
> "MVS 1"
>
> The 'author' field contains a comma-separated list of authors.
>
> If the "Arabian Nights" series was by Zipes, and the MVS series by
> Jackman, The sorted list would be
>
> MVS 1
> MVS 2
> Arabian Nights 1
> Arabian Nights 2
>
> Right now, what I do is, I check to see if the books are in a series.
If
> they aren't in any series, or if they belong to different series, then
> the comparison is by author. If they belong to the same series, then
the
> sorting is by series ordinal. The code for this is below my signature.
>
> This algorithm is flawed, because the members of a series need not
> be compared to establish the sort order, so they can appear out of
> order.
>
> So how would I sort this list as described above?
You did not say if it is possible to have books by different authors in
the same series. I assume that it is not. Otherwise, it is not clear
what order is intended.
The sort is almost trivial if you preprocess the array to set the series
field of each book to zero if it is not defined.
foreach (@array){
$_->series' = 0 if not defined $_->'series';
}
@array = sort {a->'author' cmp b->'author' or a->'series' <=>
b->'series'} @array;
Restore the original condition if necessary.
foreach (@array){
$_->'series' = undef unless $_->'series';
}
--my code not tested, but the idea is sound.
Bill
------------------------------
Date: Thu, 8 May 2003 15:14:05 -0500
From: Gopi Sundaram <gopalan@cs.sc.edu>
Subject: Re: Sorting book list
Message-Id: <Pine.GSO.4.55.0305081511140.2320@pollux>
On Thu, 8 May 2003, Bill Smith wrote:
> @array = sort {a->'author' cmp b->'author' or a->'series' <=>
> b->'series'} @array;
An author may have multiple series'. The 'series' key contains
"SeriesName seq_no", for example, "ArabianNights 1".
So the series sequence number should only be considered if $a and $b are
part of the same series.
------------------------------
Date: Thu, 8 May 2003 16:04:49 +0000 (UTC)
From: J Krugman <jill_krugman@yahoo.com>
Subject: What does ${*$foo}{'bar'} mean?
Message-Id: <b9dv71$4lu$1@reader1.panix.com>
I imagine that *$foo in ${*$foo}{'bar'} is somehow a hash reference,
but I don't understand the syntax.
-Jill
------------------------------
Date: 08 May 2003 18:05:00 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: What does ${*$foo}{'bar'} mean?
Message-Id: <u94r45xtc3.fsf@wcl-l.bham.ac.uk>
J Krugman <jill_krugman@yahoo.com> writes:
> I imagine that *$foo in ${*$foo}{'bar'} is somehow a hash reference,
> but I don't understand the syntax.
*$foo is a GLOB i.e. a symbol table entry with space for a scalar, an
array, a hash, a subroutine, a file handle and a directory handle (and
maybe other stuff I forget).
You can use a GLOB in a hash reference context and it means the hash
in the GLOB. (You can use it in a scalar reference context and it
mans the scalar in the GLOB and so on...).
This is often used with filehandles to store auxillary information in
the hash that happens to have the same name as the filehandle. This
is a slight simplicfication because it is possible to have a GLOB that
no longer really has any name.
open(FOO,">fooble") or die $!;
my $foo = \*FOO; # $foo now a reference to the symbol table entry FOO
${*$foo}{'bar'} = 'wibble'; # Actually sets $FOO{bar}
GLOBs are just plain weird things.
See: perldata/"Typeglobs and Filehandles"
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.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 V10 Issue 4959
***************************************