[22040] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4262 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 14 11:05:37 2002

Date: Sat, 14 Dec 2002 08:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 14 Dec 2002     Volume: 10 Number: 4262

Today's topics:
    Re: another sorting question (Aaron)
    Re: can I ship perl interpreter & do I need to send imp <goldbb2@earthlink.net>
        Debugger parses differently? <jboes@qtm.net>
        Hashing several million rows of data (T Conti)
        HELP: MYSQL, IMAGES and PERL <fede72bari@tiscali.it>
    Re: how to download a website protected with NTLM-authe <occitan@esperanto.org>
    Re: open2 program dies <goldbb2@earthlink.net>
    Re: open2 program dies <xxxxxxx@xxx.xxx>
        OT: Re: Get current date / time? <flavell@mail.cern.ch>
        Syntax of subroutine declarations, relating to use and  <Z@wersh.com>
    Re: unknown import: lib Calc at C:/Perl/lib/Math/BigInt <goldbb2@earthlink.net>
    Re: Where can I find book about perl4 <dave@dave.org.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 13 Dec 2002 22:29:09 -0800
From: Chewy2426@aol.com (Aaron)
Subject: Re: another sorting question
Message-Id: <7036ffb9.0212132229.7a78cba6@posting.google.com>

As always, thanks for your guys' help!

got it to work.

next time I'll remember to put more information.

again, thanks!!

-Aaron

Chewy2426@aol.com (Aaron) wrote in message news:<7036ffb9.0212131419.1f08d410@posting.google.com>...
> I have the hardest time sorting stuff.
> 
> I have an array with this contents:
> 2002-12-12,ascend_rtr,CA1905R1,88.87,76783
> 2002-12-12,cabletron_sw,CA1022V1,99.65,86100
> 2002-12-12,ascend_rtr,CA1022R1,99.67,86113
> 2002-12-12,ascend_rtr,CA0313R1,100.00,86400
> 
> I want to sort this information by the uptime. If it's lower then 100%
> I want it at the top of the list... kinda like it is now (88.87).
> 
> I tried $value = (@data,split /,/)[4]; but that didn't work.
> 
> Any ideas would be greatly appreciated.
> 
> thanks!


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

Date: Sat, 14 Dec 2002 00:30:35 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: can I ship perl interpreter & do I need to send imported modules
Message-Id: <3DFAC1FB.E54A09A6@earthlink.net>

Malcolm Dew-Jones wrote:
[snip]
> If I'm working temporarily on someone elses PC then I usually copy a
> minimal number of my things I "must" have into a single directory -
> and that includes a few key perl files, (forget which exactly, but
> it's very minimal to gain access to use perl).

strict.pm and warnings.pm are all you need :)

j/k, but you don't need all that much more than that.

Hmm... curiously, warnings.pm in 5.6.1 has 'use Carp' in it!  So if your
code does 'use warnings', you invariably load Carp.  This seems like a
waste of memory...  Ok, I see -- Carp is actually a thin wrapper in
front of Carp::Heavy, which is only loaded up if one of the Carp
functions is actually called.  Nevermind :)

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Sat, 14 Dec 2002 07:23:57 -0500
From: Jeff Boes <jboes@qtm.net>
Subject: Debugger parses differently?
Message-Id: <im8mvuslherc24v9166g0ff9ne5p28fraq@4ax.com>

Here's a puzzle: this code --

1 && $a = 1;

is perfectly acceptable Perl, and parses in perl with or without the '-d' flag.

However, this code --

use constant DEBUG => 1;
DEBUG && $a = 1;

parses without '-d', but not with '-d':

Can't modify logical and (&&) in scalar assignment at testdbg.pl line 5, near
"1;"

You have to add parentheses to get it through the debugger:

DEBUG && ($a = 1);

--
~~~~~~~~~~~~~~~~|It is by caffeine alone I set my mind in motion, 
Jeffery Boes    |It is by the beans of Java that thoughts acquire speed, 
jboes@qtm.net   |The hands acquire shaking, the shaking becomes a warning, 
UIN 3394914     |It is by caffeine alone I set my mind in motion. 


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


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

Date: 14 Dec 2002 04:25:58 -0800
From: tconti@hotmail.com (T Conti)
Subject: Hashing several million rows of data
Message-Id: <5e0d3eda.0212140425.237a98b0@posting.google.com>

Howdy:

I am writing a script to preprocess a large file of data.  The files
could get up to 4 million rows.  I want to ensure that each row in the
file is unique based on a key column as defined by the key colum (i.e.
column 2 should be unique).  The key column 2 will be between 20 - 100
bytes of ascii characters.  I imagine that as more data is loaded into
a hash its search performance degrades.  I thought of using multiple
hashes to implement this. I was just wondering if anyone had any input
on what is a good input for the optimal use of hashes for a large
volume of data.

Thanks,
Tom


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

Date: Sat, 14 Dec 2002 13:57:35 +0100
From: "Federico Bari" <fede72bari@tiscali.it>
Subject: HELP: MYSQL, IMAGES and PERL
Message-Id: <atf9tg$vci$1@lacerta.tiscalinet.it>

Hi all,

    i have the need to store images in a mysql data base and then show them
in html pages. I'd like realize a perl script that can be called from html
source as location for the image; for example

<img src="/cgi-bin/show_image_n.pl=876">

where the show_image_n.pl take the binary code of image 876 from a mysql
database and "print" it. I tried but i doesn't work. Somebody could help me?
maybe I have to print som especial header befor prinf the image code?

Thank you very much, from italy

        Federico.




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

Date: Sat, 14 Dec 2002 13:04:56 +0100
From: Daniel Pfeiffer <occitan@esperanto.org>
Subject: Re: how to download a website protected with NTLM-authentication?
Message-Id: <20021214130456.4ddac3de.occitan@esperanto.org>

ZZT <a@b.c> skribis:
> is there a module and chance to get a site within perl?
> wget is not supporting NTLM but maybe there is a http-get module for 
> perl that support NTLM.

Just try http://NTLogin:NTPassword@www.a.b/... which I presume is the web server that goes with your email address.

This used to work from a browser, some years ago, when I needed this.

coralament / best Grötens / liebe Grüße / best regards / elkorajn salutojn
Daniel Pfeiffer

-- GPL 3: take the wind out of Palladium's sails! --
 ------
  -- My other stuff here too, sawfish, make.pl...: --
   ------
    -- http://dapfy.bei.t-online.de/ --


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

Date: Sat, 14 Dec 2002 02:10:00 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: open2 program dies
Message-Id: <3DFAD948.9367C350@earthlink.net>

Garry Williams wrote:
> Mike Wilson wrote:
[snipped stuff: when writing to pipe that sends to stdin of child
process, the parent process is killed if the child process exits]
> 
> You probably want to catch SIGPIPE.  See perlcar and look at the %SIG
> entry.
> 
> For example:
> 
>   $SIG{PIPE} = sub {
>       warn "child seems to have exited...";
>       $child_exited = 1;
>   };
> 
> Or maybe you will read the child's stdout and get end of file
> eventually.  In that case, you may want to ignore SIGPIPE and rely on
> EOF:
> 
>   $SIG{PIPE} = 'IGNORE';

When ignoring SIGPIPE, what you want to do to know if the child process
is still laive is to check the return value of your print() statements.
They will return a true value if the print succeeded (the child process
still lives), or a false value if the print() failed (the child process
has died).

Yes, you'll get EOF from the read-pipe if the child process has exited,
but it's quite possible (likely, even) that the OP wants to know of the
child process's death when he's still writing, before he tries to read.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Sat, 14 Dec 2002 15:10:42 GMT
From: "Brad" <xxxxxxx@xxx.xxx>
Subject: Re: open2 program dies
Message-Id: <SRHK9.27838$y14.2481641@news1.east.cox.net>


"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3DFAD948.9367C350@earthlink.net...
> Garry Williams wrote:
> > Mike Wilson wrote:
> [snipped stuff: when writing to pipe that sends to stdin of child
> process, the parent process is killed if the child process exits]
> >
> > You probably want to catch SIGPIPE.  See perlcar and look at the %SIG
> > entry.
> >
> > For example:
> >
> >   $SIG{PIPE} = sub {
> >       warn "child seems to have exited...";
> >       $child_exited = 1;
> >   };
> >
> > Or maybe you will read the child's stdout and get end of file
> > eventually.  In that case, you may want to ignore SIGPIPE and rely on
> > EOF:
> >
> >   $SIG{PIPE} = 'IGNORE';
>
Actually, on Unix anyway, the best way to know if a child has died is to
catch the SIGCHLD signal.  I believe a SIGCHLD will be issued prior to any
other SIGNAL due to a child's death.

[snip]

Brad





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

Date: Sat, 14 Dec 2002 16:18:39 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: OT: Re: Get current date / time?
Message-Id: <Pine.LNX.4.40.0212141513200.25180-100000@lxplus071.cern.ch>

On Dec 13, Helgi Briem inscribed on the eternal scroll:

> On Thu, 12 Dec 2002 19:26:16 +0100, "Alan J. Flavell"

> >Y2K was a good moment to make a break with the past and do the same
> >with date formats.  How about it?
>
> Why don't you tell them to convert over to the metric
> system while they're at it?

Insisting on coupling one relatively simple change to another much
more radical change is a good way to ensure that neither of them will
be successful!

> It's been standard in the
> rest of the world for about a 100 years.

I don't think that's quite accurate.  Or do you distinguish between
"standard" and "in everyday use"?  The introduction of metric units
into everyday life in various parts of the former British Empire has
been relatively recent (and the British themselves are still hovering
on the brink, as they have been doing for 30 years or more...)

I found it quite amusing that both the Germans and the French still
refer to a "pound" (Pfund, Livre) as a convenient unit of weight,
albeit referring to 500g as a metric multiple.  There still seems to
be some variation as to whether sweets are sold on the basis of 100g
or 125g (i.e a quarter of a "pound") as the basic multiple of weight.

cheers

-- 
   Caution: sysadmin.  Keep away from bright light and naked flames.
   Always read the instructions on the package.  May contain traces of nut.



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

Date: Sat, 14 Dec 2002 05:26:29 GMT
From: David B. Nagle <Z@wersh.com>
Subject: Syntax of subroutine declarations, relating to use and variable scope
Message-Id: <p6glvu0uldsoaphg137eudjsh0qlaa2ofh@4ax.com>

I was looking at the code in News::Article and came across some syntax
that I had never encountered before. I tried very hard to find
documentation on it, but was unable to find anything that seemed to
actually address it. Here are two example code segments that illustrate
the syntax:

    sub post;
    
    use Net::NNTP ();
    
    ; sub post
    {
        # Code removed
    }
    
    
    sub _unique_name;
    
    my $unique_count = "aa";
    
    ; sub _unique_name
    {
        # Code removed
    }

I've never seen Perl code that duplicates the sub declaration like that
before, with statements in between. Plus, the use of the extra
semicolon before the duplicate sub statements is completely new (and
rather strange) to me. I think that I somewhat understand what the
syntax is for: in the first case, the Net::NNTP module is only loaded
if the post method is called, and is only in scope for that method; in
the second case, I'm guessing that $unique_count is a static variable
whose value is retained across calls, though I'm not really sure.

The module also includes the statement "use SelfLoader;", and I had the
thought that this syntax might be related to SelfLoader. However, after
scanning through the documentation on the SelfLoader module, I wasn't
able to find anything related.

Is this syntax documented somewhere? I'd like to read about it, instead
of making blind assumptions that would certainly get me in trouble if I
tried to work off them. :)

-- 
@perl=map{$_=~/[PERL]/?1:0}split//,'PErLPErlpErlpERLPerLPerlPeRlPERlP'.
'ErLPErlPeRLPeRlPErLPErlPerlpeRLpERlpErLPerLPeRlpeRLpeRlperLperl';while
(@perl){$perl+=2**$Perl++*pop@perl;unless($Perl%4){print((split//,'Ju'.
'stknocha Perl')[$perl]);$perl=$Perl=0;}}# Z@wersh.com http://wersh.com


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

Date: Sat, 14 Dec 2002 03:23:38 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: unknown import: lib Calc at C:/Perl/lib/Math/BigInt.pm
Message-Id: <3DFAEA8A.777D2B7C@earthlink.net>

Anno Siegel wrote:
[snip]
> Oh, and Bit::Vector is not related to Math::BigInt, it is (among
> other things) an alternative to Math::BigInt.  Without having looked
> in detail, I'd expect it to be somewhat harder to use and quite a bit
> more efficient.

For a compromise, you can install Math::BigInt::BitVec, which will allow
you to use Math::BigInt, and have it use Bit::Vector as a backend.

This will have the ease of use of M::BI, combined with (most of) the
speed of B::V.  It's a compromise in that there is a tiny loss of speed
due to using M::BI in front of B::V.

-- 
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r  coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);


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

Date: Sat, 14 Dec 2002 09:18:03 +0000
From: "Dave Cross" <dave@dave.org.uk>
Subject: Re: Where can I find book about perl4
Message-Id: <pan.2002.12.14.09.18.03.495148@dave.org.uk>

On Fri, 13 Dec 2002 07:50:49 +0000, Phov wrote:

> Our root refused to upgrade perl 4 to perl 5.  are there any perl4
> books or resource online.  Can anyone help me to locate them.

I recommend upgrading your sysadmin to one who knows what he's talking
about :)

Dave...

-- 
  Love is a fire of flaming brandy
  Upon a crepe suzette



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

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


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