[18709] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 877 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 11 18:06:39 2001

Date: Fri, 11 May 2001 15:05:19 -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: <989618719-v10-i877@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 11 May 2001     Volume: 10 Number: 877

Today's topics:
    Re: 1 billion seconds bug <ilya@math.ohio-state.edu>
    Re: 1 billion seconds bug <bart.lateur@skynet.be>
        any faster way to do.......? <dontuspamme@nospammers.com>
    Re: Base 6 sieve. (Abigail)
    Re: Bcc contents from file <webmaster@webdragon.unmunge.net>
    Re: Cabal Guidelines for comp.lang.perl.misc ($Revision <godzilla@stomp.stomp.tokyo>
    Re: Cabal Guidelines for comp.lang.perl.misc ($Revision (Anno Siegel)
    Re: Cabal Guidelines for comp.lang.perl.misc ($Revision <lmoran@wtsg.com>
    Re: Cabal Guidelines for comp.lang.perl.misc ($Revision nobull@mail.com
    Re: Cabal Guidelines for comp.lang.perl.misc ($Revision <godzilla@stomp.stomp.tokyo>
    Re: Cabal Guidelines for comp.lang.perl.misc ($Revision <flavell@mail.cern.ch>
    Re: Cabal Guidelines for comp.lang.perl.misc ($Revision <lmoran@wtsg.com>
    Re: Cabal Guidelines for comp.lang.perl.misc ($Revision <uri@sysarch.com>
    Re: Cabal Guidelines for comp.lang.perl.misc ($Revision <godzilla@stomp.stomp.tokyo>
        can Perl do multiplexed output? <dontuspamme@nospammers.com>
    Re: can Perl do multiplexed output? <jurgenex@hotmail.com>
    Re: can Perl do multiplexed output? (Logan Shaw)
    Re: Cannot install perl-5.6.1: problem in "make test" (M.J.T. Guy)
    Re: CGI=HASH(0x176ef80) Help Please! <webmaster@webdragon.unmunge.net>
    Re: collect versions of loaded modules (Logan Shaw)
    Re: Converting a tab-delimited file? <amnuts@talker.com>
    Re: DES-CBC without Crypt::CBC <simon@super-simon.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 11 May 2001 19:40:02 GMT
From: Ilya Zakharevich <ilya@math.ohio-state.edu>
Subject: Re: 1 billion seconds bug
Message-Id: <9dhf6i$o6k$1@agate.berkeley.edu>

[A complimentary Cc of this posting was sent to
Bart Lateur 
<bart.lateur@skynet.be>], who wrote in article <otenft4l5j6ckmqcrqj8gv4jhe2kvrh84v@4ax.com>:
> But the OP said that *every* computer in the world would soon switch to
> a time() of 1 billion, all a the same time. Clearly, this can't be true.

IMO, *this* point is also moot.  Obviously, doorstop-computers won't.
So what?  "Working" computers will, for an appropriate value of "working".

Ilya


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

Date: Fri, 11 May 2001 20:26:43 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: 1 billion seconds bug
Message-Id: <0qioft0hkr2118mtgofaed8s9jgrnav30q@4ax.com>

Ilya Zakharevich wrote:

>> But the OP said that *every* computer in the world would soon switch to
>> a time() of 1 billion, all a the same time. Clearly, this can't be true.
>
>IMO, *this* point is also moot.  Obviously, doorstop-computers won't.
>So what?  "Working" computers will, for an appropriate value of "working".

So a Mac isn't a working computer? Not even a working Mac?

-- 
	Bart.


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

Date: Fri, 11 May 2001 12:06:46 -0700
From: "kalasend at YAHOO dot COM" <dontuspamme@nospammers.com>
Subject: any faster way to do.......?
Message-Id: <EIWK6.28$DB3.5795@chrome-fe.eng.netapp.com>

hi,

    I have a Perl CGI script that does something, which require traversing
and reading files in a rather deep directory tree. It takes some time, for
sure, and for everyone. I was thinking to write the generated HTML onto disk
at the same time. So the next person who view the page doesn't need to wait
as long as the first did.

    BUT, how can I take care of updating the HTML file? i.e. if the
directory that I need to traverse has been modified, how can the script
know? Does having the script traverse and only checking the time stamp of
files take equally long as reading the files?

thanks,
ben




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

Date: Fri, 11 May 2001 21:59:53 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Base 6 sieve.
Message-Id: <slrn9foo6p.q7g.abigail@tsathoggua.rlyeh.net>

Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMDCCCX September
MCMXCIII in <URL:news:9dgmsd$s3q$1@mamenchi.zrz.TU-Berlin.DE>:
%%  
%% > bitindices. So, it should be much faster to keep track of the bit
%% > indices, as that's the only thing we are interested in.
%%  
%%  It's strange but true that the algorithm doesn't need to know the
%%  non-prime number it is about to scrub.  Going directly from one sieve
%%  index to the next is certainly a possibility, though I don't see
%%  first sight why it would have to be faster.  The relationship of one
%%  sieve index to the next looks rather complex.
%%  
%%  Lessee... it looks as though for each n there are two alternating
%%  increments involved.  If this were provable it could indeed speed
%%  up the scrub loop, even if we have to invest some time to find what
%%  the increments are for each n and which comes first.


The calculations for that are pretty straigthforward.
See program (which is identical to the one posted a few days ago,
except for the scrub routine. This one has a core loop that rocks).

#!/opt/perl/bin/perl -l

# A sieve based on base 6. Only possible primes are those numbers p
# for which p mod 6 == 1, or p mod 6 == 5.
#
# Let n = 6 * k + l (0 <= l < 6). Then the bit b associated with n is
# b = 2 * k + [undef, 0, undef, undef, undef, 1] -> [l]
# In reverse, given a bit b, the corresponding number n is
# n = 6 * int (b / 2) + [1, 5] -> [b % 2].

use strict;
use warnings 'all';

sub scrub    ($);
sub findnext ($);

my $max   = $ARGV [0] || 1000;

my @PRIMES    = (2, 3);
my $BASE      =  6;     # LCM of @PRIMES.
my $BITS_BASE =  2;
my $BITS_BYTE =  8;

my $bits  = $BITS_BASE * int ($max / $BASE) + ($max % $BASE ? $BITS_BASE : 0);
my $bytes = int ($bits / $BITS_BYTE) + ($bits % $BITS_BYTE ? 1 : 0);
my $sieve = "\xFF" x $bytes;

# Numbers less than the base are special.
foreach my $prime (@PRIMES) {
    print $prime
}

my $i = 5;

for (; $i && $i <= sqrt ($max); $i = findnext $i) {
    print $i;
    scrub $i;
}

for (; $i && $i <        $max ; $i = findnext $i) {
    print $i;
}

exit;




my ($offset1, $offset2);
INIT {
    $offset1 = [undef, 0, undef, undef, undef, 1];
    $offset2 = [1, 5];
}

# Scrub out all multiples of the given argument. It's easy to see that
# all multiples less than the square already have been crossed out, and
# we only have to scrub out the odd multiples.
sub scrub ($) {
    use integer;
    my $n = shift;
    my $m = $n;
    if ($m % 3 == 1) {
        my $c = $n * $m;
        vec ($sieve, $BITS_BASE * ($c / $BASE) + $offset1 -> [$c % $BASE],
                     1) = 0;
        $m += 4;
    }

    my $c     = $n * $m;

    # $b is the bit index in the sieve, $b1 and $b2 are the increments
    # in the loop.
    my $b     = $BITS_BASE * ($c / $BASE) + $offset1 -> [$c % $BASE];
    my $b1    = (2 * $n / ($BASE / $BITS_BASE));
    my $b2    = (4 * $n / ($BASE / $BITS_BASE));

    # Exactly one of $b1, $b2 needs to be incremented by 1, 
    # depending on the parity of $c.
   ($c % 6 == 1 ? $b2 : $b1) += 1;

    # Make sure we don't go out of range.
    my $l     = $bits - $b1 - $b2;

    # Core loop, we want to minimize work here.
    while ($b <= $l) {
        vec ($sieve, $b, 1) = 0; $b += $b1;
        vec ($sieve, $b, 1) = 0; $b += $b2;
    }

    # Basically a copy of the previous loop, but with extra checks.
    # Checks don't hurt now as this loop is performed only once.
    {
        last if $b > $bits;
        vec ($sieve, $b, 1) = 0; $b += $b1;
        last if $b > $bits;
        vec ($sieve, $b, 1) = 0; $b += $b2;
    }

}

# Find the next prime number after the given number.
sub findnext ($) {
    use integer;
    my $n = shift;
    my $i = $BITS_BASE * ($n / $BASE) + $offset1 -> [$n % $BASE] + 1;
    while ($i <= $bits) {
        if (vec ($sieve, $i, 1)) {
            return $BASE * ($i / $BITS_BASE) + $offset2 -> [$i % $BITS_BASE]
        }
        $i ++
    }
    undef;
}


__END__
-- 
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()


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

Date: 11 May 2001 18:54:16 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Bcc contents from file
Message-Id: <9dhcgo$jad$2@216.155.32.19>

In article <9dbl6h$1252$1@earth.superlink.net>, Arek@nospam.tv (Arek P) 
wrote:

 | I think that U are yet another victim of confusion as to what pl means
 | in this group; U want to post Your english-written questions to 
 | comp.lang.perl.misc...U will probably get a reply much faster...

after four or five years of this, I still completely fail to grok the 
advantage of sounding like a rebus puzzle in order to avoid typing two 
additional letters (yo) before the u. I mean, the old BBS issues of 
bandwidth over 1200bps modems are LONG gone. (Yes I'm old enough to 
remember those days, and how the shorthand actually got started) 

particularly when typing something like comp.lang.perl.misc could have 
been abbreviated to c.l.p.m., or confusion could have been ... etc. etc.

Yours for a clearer-speaking, more intelligent-sounding internet 
population,

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


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

Date: Fri, 11 May 2001 08:38:48 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Cabal Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <3AFC0788.7110E254@stomp.stomp.tokyo>

Anno Siegel wrote:
 
> Eric Bohlman wrote:
> > Andras Malatinszky wrote:
> > > tadmc wrote:

(snipped)

> I disagree with you and the previous poster.  Tad's document lays out
> what we think an acceptable posting and what we don't.  It's like
> setting up the terms of a contract.  *Because* we are talking to adults
> (though not exclusively), the terms should be as clear as possible.


After following this thread, it is clear to me some regulars
here have appointed themselves to be in charge of this newsgroup,
otherwords, your use of "we" and associated acquiescence, indicates
what you, plural, feel to be a legitimate cabal populated by a
peer group silently approved select few.

My presumption is, in light of a cabal claiming authority over
this newsgroup, no call for vote will afforded asking for
a majority vote approval of this FAQ and approval of posting
this FAQ.


* raises a Che Guevara clinched fist *

Godzilla!


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

Date: 11 May 2001 16:12:42 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Cabal Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <9dh31q$89s$1@mamenchi.zrz.TU-Berlin.DE>

According to Godzilla! <godzilla@stomp.stomp.tokyo>:
> Anno Siegel wrote:
>  
> > Eric Bohlman wrote:
> > > Andras Malatinszky wrote:
> > > > tadmc wrote:
> 
> (snipped)
> 
> > I disagree with you and the previous poster.  Tad's document lays out
> > what we think an acceptable posting and what we don't.  It's like
> > setting up the terms of a contract.  *Because* we are talking to adults
> > (though not exclusively), the terms should be as clear as possible.
> 
> 
> After following this thread, it is clear to me some regulars
> here have appointed themselves to be in charge of this newsgroup,
> otherwords, your use of "we" and associated acquiescence, indicates
> what you, plural, feel to be a legitimate cabal populated by a
> peer group silently approved select few.

"We" means "the people participating in the discussion at hand",
no more, no less.

> My presumption is, in light of a cabal claiming authority over
> this newsgroup, no call for vote will afforded asking for
> a majority vote approval of this FAQ and approval of posting
> this FAQ.

What cabal?  What authority is being claimed?

[snip Che Guevara]

Anno


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

Date: Fri, 11 May 2001 12:18:22 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: Cabal Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <114oft8talb5d9eq0a3pfb71kuctkord2l@4ax.com>

On Fri, 11 May 2001 08:38:48 -0700, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote wonderful things about sparkplugs:

--SNIP--
>My presumption is, in light of a cabal claiming authority over
>this newsgroup, no call for vote will afforded asking for
>a majority vote approval of this FAQ and approval of posting
>this FAQ.
>
>
>* raises a Che Guevara clinched fist *
>
>Godzilla!

Dangit Kira I was pulling for you there for a while.  You seemed to be
less of a nut-case for quite a few posts... 

Not terribly glad to see you returning to form, but not all that
surprised.

(PS -- Hundreds of rules can be made, guidelines or otherwise.  If
people won't RTFM what on Earth makes anyone think they'll RTFF?)

--
print "\x{263a}" 


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

Date: 11 May 2001 17:38:47 +0100
From: nobull@mail.com
Subject: Re: Cabal Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <u9itj74z8o.fsf@wcl-l.bham.ac.uk>

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

> Anno Siegel wrote:
>  
> > Eric Bohlman wrote:
> > > Andras Malatinszky wrote:
> > > > tadmc wrote:
> 
> (snipped)
> 
> > I disagree with you and the previous poster.  Tad's document lays out
> > what we think an acceptable posting and what we don't.  It's like
> > setting up the terms of a contract.  *Because* we are talking to adults
> > (though not exclusively), the terms should be as clear as possible.
> 
> 
> After following this thread, it is clear to me some regulars
> here have appointed themselves to be in charge of this newsgroup,
> otherwords, your use of "we" and associated acquiescence, indicates
> what you, plural, feel to be a legitimate cabal populated by a
> peer group silently approved select few.

Yes, do you have a problem with this?  This is nature.  It's how the
world is.  It's basically how all social groups naturally organise
themselves.  Members who display a willingness and competance to act
as organisers become "in charge" and remain in charge unless and until
they act in way that gives suffient poeple cause to wish to change the
status quo.

> My presumption is, in light of a cabal claiming authority over
> this newsgroup, no call for vote will afforded asking for
> a majority vote approval of this FAQ and approval of posting
> this FAQ.

I'd guess that your presumption was right.  I see no reason for a
vote.  If anyone wants there to be a vote and is prepared to go to all
the effort then they can call one.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 11 May 2001 10:21:09 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Cabal Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <3AFC1F85.7852D086@stomp.stomp.tokyo>

Lou Moran wrote:

> Godzilla! wrote:

(snippage not noted by Moran, context deliberately changed)

> > My presumption is, in light of a cabal claiming authority over
> > this newsgroup, no call for vote will afforded asking for
> > a majority vote approval of this FAQ and approval of posting
> > this FAQ.

> > * raises a Che Guevara clinched fist *
 
> Dangit Kira I was pulling for you there for a while.  You seemed to be
> less of a nut-case for quite a few posts...
 
> Not terribly glad to see you returning to form, but not all that
> surprised.
 
> (PS -- Hundreds of rules can be made, guidelines or otherwise.  If
> people won't RTFM what on Earth makes anyone think they'll RTFF?)



Shall I address you as Lou Moran, Anno Siegel or 
by your moniker, nobull? What is your preference?
Would you rather I address you by another of your
myriad fake personalities, perhaps as Ms. Mueller?


I am a firm believer in Democratic Ideals and a strong
supporter of USENET customs, which are established upon 
our principle of Freedom and certainly Freedom Of Speech.
It is a long established USENET custom to call for a 
vote on matters such as this.

It is clear you and a select few others do not share
these ideals of mine.

I find glossy black jack boots to be passé, tacky
and wish to be sure everyone is clear I would not
consider wearing those, nor a tan khaki shirt.


* in her best Sir William Wallace voice she shouts *

FREEDOM!


Has my post usurped your contrivances, Frank?


Godzilla!


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

Date: Fri, 11 May 2001 19:41:28 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Cabal Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <Pine.LNX.4.30.0105111931210.13386-100000@lxplus013.cern.ch>

On 11 May 2001 nobull@mail.com wrote:

> I'd guess that your presumption was right.  I see no reason for a
> vote.

I'd like to put on record that I don't want to vote on the issue, and
have no intention of calling for a vote on it.  In the event that a
vote was taken, I would support the draft as a regular posting.

Not that I'd expect its target audience to read it, but at least it's
there for when they start whining that nobody told them there were
any guidelines on proper group behaviour.

If it was felt that the term "must" was too brusque, then how about
"it's considered to be non-optional"?  Suggesting to replace it by
"should" is watering it down too far IMO.


A correction, if I may:

The "deja searchable archive" is no more.  Although the cited URL gets
currently redirected to something usable, I'd recommend updating it to
http://groups.google.com/

all the best



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

Date: Fri, 11 May 2001 13:50:57 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: Cabal Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <2b9oftguhg4fr8apgc21m57meqbp5qskl0@4ax.com>

On Fri, 11 May 2001 10:21:09 -0700, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote wonderful things about sparkplugs:

SNIP
>
>Shall I address you as Lou Moran, Anno Siegel or 
>by your moniker, nobull? What is your preference?
>Would you rather I address you by another of your
>myriad fake personalities, perhaps as Ms. Mueller?
>

Ha!  Have you ever seen how BAD my posted code is (You should see the
crap I'm running!)?  I ask questions like:

"What is this array I keep hearing so much about?"

Anno, & NoBull ANSWER questions!  I mostly post URLs.

These guys ARE a HUGE part of the group.  Hell, I'm a step up from
troll.  (which is two steps higher than you; you psycho.) Flattered
and confused you could morph me along with those folks.

<Who's Frank?>

SNIP

--
print "\x{263a}" 


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

Date: Fri, 11 May 2001 18:44:13 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Cabal Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <x78zk3bu93.fsf@home.sysarch.com>

>>>>> "LM" == Lou Moran <lmoran@wtsg.com> writes:

  LM> <godzilla@stomp.stomp.tokyo> wrote wonderful things about sparkplugs:

  >> Shall I address you as Lou Moran, Anno Siegel or 
  >> by your moniker, nobull? What is your preference?
  >> Would you rather I address you by another of your
  >> myriad fake personalities, perhaps as Ms. Mueller?

  LM> "What is this array I keep hearing so much about?"

  LM> Anno, & NoBull ANSWER questions!  I mostly post URLs.

this is one of moronzilla's most bizarre delusions, that most (if not
all) of the regular posters here are a single person (let alone a
cabal!). so someone would have the time and energy to create dozens of
personalities and post 200 messages a day discussing perl with
itself. now, since she is a known schizo and psycho, she is attributing
her illness on the rest of us.

any hope of her actually beig cured is fleeting. but to give her credit,
she actually has perl on her own box now and use those hated modules
like LWP and is not posting stupid web answers each time. on the other
hand she still has major trouble with logic and comprehension and still
only trolls innocent newbies.

oh, well. her vacation wasn't long enough. maybe she will try to learn
python or ruby and infect their groups instead.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: Fri, 11 May 2001 14:48:04 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Cabal Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <3AFC5E14.8F910EA5@stomp.stomp.tokyo>

Uri Guttman wrote:
 
> Lou Moran wrote:
> > Godzilla wrote:
 
> > > Shall I address you as Lou Moran, Anno Siegel or
> > > by your moniker, nobull? What is your preference?
> > > Would you rather I address you by another of your
> > > myriad fake personalities, perhaps as Ms. Mueller?
 
> > "What is this array I keep hearing so much about?"

> > Anno, & NoBull ANSWER questions!  I mostly post URLs.

> this is one of moronzilla's most bizarre delusions, that most (if not
> all) of the regular posters here are a single person (let alone a
> cabal!). so someone would have the time and energy to create dozens of
> personalities and post 200 messages a day discussing perl with
> itself. now, since she is a known schizo and psycho, she is attributing
> her illness on the rest of us.
 
> any hope of her actually beig cured is fleeting. but to give her credit,
> she actually has perl on her own box now and use those hated modules
> like LWP and is not posting stupid web answers each time. on the other
> hand she still has major trouble with logic and comprehension and still
> only trolls innocent newbies.
 
> oh, well. her vacation wasn't long enough. maybe she will try to learn
> python or ruby and infect their groups instead.


There you are Uri! I am so pleased you are once again
writing to me! I was beginning to think you are no
longer in love with me. Glory be, you love me!

* swoons *

Umm... Uri, you better shake a leg and play your cards
right if you truly have a hankering for me. You have
a lot of competition suddenly. I am sure you noticed.
All these boys suddenly appearing right after my post
about Democratic Ideals and all. There is one boy who
suddenly appeared who hasn't posted here for ages! 

Gosh what a response from my adoring fans and so quickly,
almost like these boys arrived together in crowd!! What
a pleasant coincidence, so many boys, including you,
courting me, all at once. This is all so sudden! This
coincidental timing is flabbergastingly stupefying!
I sure have enough flabber to gast and plenty of
stupid to go around!

Anywho Uri, clean yourself up, dress to impress! These
boys are easy to catch, but I am not so easy to catch
although quite a catch I am, yes ma'am!!

* back of hand to forehead, looks Heavenward *

He still loves me!

Godzilla!


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

Date: Fri, 11 May 2001 14:33:24 -0700
From: "kalasend at YAHOO dot COM" <dontuspamme@nospammers.com>
Subject: can Perl do multiplexed output?
Message-Id: <6SYK6.29$DB3.5880@chrome-fe.eng.netapp.com>

Hi,

    I need to write a program that outputs to both STDOUT and a disk file.
Is there anyway I can do this without calling "print" twice?

thanks,
ben





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

Date: Fri, 11 May 2001 14:42:44 -0700
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: can Perl do multiplexed output?
Message-Id: <3afc5d0a@news.microsoft.com>

"kalasend at YAHOO dot COM" <dontuspamme@nospammers.com> wrote in message
news:6SYK6.29$DB3.5880@chrome-fe.eng.netapp.com...
>     I need to write a program that outputs to both STDOUT and a disk file.
> Is there anyway I can do this without calling "print" twice?

You could just use "tee" to duplicate the output of any program into a file.

    myprogram | tee mydiskfile

jue




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

Date: 11 May 2001 16:48:53 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: can Perl do multiplexed output?
Message-Id: <9dhmo5$5f9$1@charity.cs.utexas.edu>

In article <6SYK6.29$DB3.5880@chrome-fe.eng.netapp.com>,
kalasend at YAHOO dot COM <dontuspamme@nospammers.com> wrote:
>    I need to write a program that outputs to both STDOUT and a disk file.
>Is there anyway I can do this without calling "print" twice?

Write a function that calls print twice and call it?

Or, write to standard output and pipe your program into the Unix
program "tee".

Or, create a pipe, fork, and have your child process copy what it reads
from the pipe to two output files.

Probably the best solution would be to write a module that subclasses
IO::Handle.  You might call it IO::Handle::Multiplexed.  Then, you can
just create an instance of it and give it several objects which are
IO::Handle objects, and let it do the work for you.

Any way you do it, error handling will probably take a little thought.

  - Logan
-- 
my  your   his  her   our   their   _its_
I'm you're he's she's we're they're _it's_


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

Date: 11 May 2001 17:35:40 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Cannot install perl-5.6.1: problem in "make test"
Message-Id: <9dh7tc$ih1$1@pegasus.csx.cam.ac.uk>

In article <9ddurf$5jj$1@hop.gmd.de>, Georg Wittig <Georg.Wittig@gmd.de> wrote:
>
>I have problems installing perl-5.6.1 which should be the newest
>stable version according to CPAN. Symptom: "./Configure" and "make"
>work fine, but "make test" produces the following error:
>
>        base/cond............ok
>        base/if..............ok
>        base/lex.............FAILED at test 47
>        Failed a basic test--cannot continue.
>        make: *** [test] Error 29
>
>As you can imagine, I hesitate to do a "make install" after this
>error message. :-)

>Is this a bug in 5.6.1, or did I do something wrong?

You certainly seem to have tried all the right things.   A few further
points to check:

a)   Before each experiment, did you do "make distclean"?
     Or alternatively start with a new source tree?
     You can get all sorts of wierd effects from the remains of
     previous failed builds.

b)   Does a vanilla config work?    I.e.

	make distclean
	./Configure -des
	make test
	[ Dont do "make install here ! ]

     If not, there's certainly a Perl problem; please tell perlbug@perl.org
     about it.   (See instructions in INSTALL under "Reporting Problems".)

     If it does work, it still might be a Perl problem.  Look at the
     differences between your config.sh and the "vanilla" one.
     Can you identify which change provokes the failure?    Try
     experimenting with "intermediate" versions of config.sh.

c)   Try running the test under the test harness  -  this will give some
     extra information which *might* give a clue.   (Tho' I'm not very
     hopeful ... )

		(assuming you've just had "make test" fail):
		cd t; ./perl harness

d)   Try running the test on its own:

		./perl t/basic/lex.t

e)   Try running the test under the Perl debugger.   Single step through
     the test to find the Perl operation which is failing.

		./perl -Ilib -d t/basic/lex.t

f)   If it still isn't clear what is going on, send a report of what
     you've found to perlbug@perl.org.    (Again, see "Reporting Problems".)


Good luck!


Mike Guy


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

Date: 11 May 2001 18:48:58 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: CGI=HASH(0x176ef80) Help Please!
Message-Id: <9dhc6q$jad$1@216.155.32.19>

In article <m38zk5no9r.fsf@dhcp9-172.support.tivoli.com>,
 Ren Maddox <ren@tivoli.com> wrote:

 | On 10 May 2001, anno4000@lublin.zrz.tu-berlin.de wrote:
 | 
 | > If the result is a scalar, ${ \ $query-param( 'fname')} works too.
 | > 
 | > This is occasionally advised, yes.  Has anyone ever used the device
 | > in serious code?
 | 
 | About five years ago I was using this exact construct in some
 | production code until I found out about $query->import_names
 | ($query->import at the time, I believe).  This method allows you to
 | import all of the parameters into a specific package.
 | 
 |   $query->import_names(PARAM);
 | 
 |   print "Name: $PARAM::first_name $PARAM::last_name\n";

you have to be careful about this if your program only uses those 
resulting variables once.. under warnings you can get literally hundreds 
of warnings sent to the weblogs every time your script is run. I myself 
had to do something along the lines of this, to avoid that problem:

[...]
# set up major input/output variables in such a way that it supresses 
# "used only once" warnings for the variables brought in via the 
# import_names() sub, but also keep some main-only vars separate from 
# the dupes to cut down on memory usage. 
BEGIN {
    @main::globals = 
      qw($mapname $author $version $release_date $filename 
         $last_update $email $website_url $website_name 
         $credits $other_levels_by_author $gametype $bot_able
         $single_player $teamplay $difficulty_settings $new_sounds 
         $new_textures $mutators $mods $construction_base $build_time
         $editors_used $ext_description $known_bugs $mod_type 
         $mod_description $authors_notes $game $weapons $power_ups 
         $new_music
        );
}
# this takes advantage of the fact that use vars is looking for 
# --list context--
use vars @main::globals, 
         qw($internal_comment1 $stylesheet $namefill $output_path 
            $htmlout $textout @htmldata @textdata $cwd $current_date);

# the namespace used will be ' import_names("UT"); ' later in the script
package UT; # slip into the package
use vars @main::globals; 
# and slide in our 'globals' that get imported to that namespace

package main; # then slide back out to main again. 
[...]

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


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

Date: 11 May 2001 10:39:33 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: collect versions of loaded modules
Message-Id: <9dh13l$lo3$1@ahab.cs.utexas.edu>

In article <9dgmft$ltf$1@nets3.rz.RWTH-Aachen.DE>,
Tim Lauterborn <Tim.Lauterborn@gmx.de> wrote:
>I would like to collect automatically the version information from the
>loaded modules of a perl program. Does anyone know how to do that by a
>function and not manually?

perldoc ExtUtils::Installed

  - Logan
-- 
my  your   his  her   our   their   _its_
I'm you're he's she's we're they're _it's_


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

Date: Fri, 11 May 2001 17:29:05 GMT
From: Andrew Collington <amnuts@talker.com>
Subject: Re: Converting a tab-delimited file?
Message-Id: <MPG.1565eaae4f92b6cb989697@news-server.neo.rr.com>

In article <m34rutnldo.fsf@dhcp9-172.support.tivoli.com>, ren@tivoli.com 
says...
> On Thu, 10 May 2001, amnuts@talker.com wrote:
> 
> > In article <d4alft80s81kitf52gpat9l7h6oott7m0j@4ax.com>, 
> > bart.lateur@skynet.be says...
> > 
> >> So, my advice is to look up the Text::CSV, or better yet, the
> >> Text::CSV_XS module. That'll help in getting the records read in
> >> properly.
> > 
> > Great!  I'll have a look into that right now.
> 
> Be forewarned, those modules do *not* handle multi-line records.  This
> is because CSV is not supposed to have embedded newlines.  Microsoft
> ignores this restriction.  I've worked around the problem in the past
> by assuming that any parsing error is a result of needing to include
> an additional line.  This is a pretty brain-dead approach.
> 
> A simple improvement would probably be to read as many lines as it
> takes to get another quote.  Yup -- I saw a significant improvement.
> Still have trouble if parse fails for some other reason, which I
> appear to be experiencing at this point.
> 
> Anyway, here's what I'm using now:
> 
> #!/usr/bin/perl
> use warnings;
> use strict;
> use Text::CSV;
> 
> my $csv = Text::CSV->new();
> my $file = shift;
> 
> open(FILE, $file) or die "Could not open $file, $!";
> $csv->parse(scalar<FILE>) or die $csv->error_input();
> my @headers = $csv->fields();
> print "Headers: @headers\n";
> 
> while (<FILE>) {
>   until ($csv->parse($_)) {  # assume an error means unbalanced quotes
>     die "Premature end of file:\n$_" if eof FILE;
>     while (my $line = <FILE>) {
>       $_ .= $line;
>       last if $line =~ tr/"//;  # so find another quote
>     }
>   }
>   my @fields = $csv->fields();
>   print "$headers[$_]: $fields[$_]\n" for 0..$#headers;
>   print "\n";
> }
> close FILE;

Thanks so much for this bit of code, but I kind of feel a little guilty 
that I didn't post here earlier saying I had found a different solution 
that involves parsing the excel spreadsheet directly (using 
Spreadsheet::ParseExcel), rather than me first converting it to a CSV.

However, your code was not for nothing!  It'll prove very helpful to me 
as a learning tool, and if I need to parse CSV files in the future then 
I'll have this handy function above.

Thanks once again!

Andy



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

Date: Fri, 11 May 2001 19:55:46 +0200
From: "Super-Simon" <simon@super-simon.com>
Subject: Re: DES-CBC without Crypt::CBC
Message-Id: <9dh8tf$4sq$1@news1.xs4all.nl>

> Are you aware that CBC is an mode of operation for DES and not a cipher
> per se?

Yes, I've a JavaScript which encrypt a string using DES in CBC-mode. What I
want is sending information secure over the web (no SSL-support on my
hostingserver), the perl-CGI script encrypts and the JavaScript client
decrypts.

>
> Cipher Block Chaining.  It should be part of a good DES impl'n.

I use Crypt::DES

If not:
>
> CBC = {0,0...};
> loop:
>   M = {M[0]^CBC[0], M[1]^CBC[1], ...};
>   C = DES(M,KEY);
>   CBC = C;
>
> So the nth block is dependent on all the previous blocks.  My added
> suggestion is to encrypt a message M' = {RAND, M[0], M[1], ...}.  And
> when decrypting, throw away the first block.  This will prevent people
> from being able to use knowledge of the first block of M as a starting
> point for an attack.
>
> JLC
>
Thanks!!!

Greetz,

Simon




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

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


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