[24513] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6693 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 15 11:05:53 2004

Date: Tue, 15 Jun 2004 08:05:06 -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           Tue, 15 Jun 2004     Volume: 10 Number: 6693

Today's topics:
    Re: [Qs] re "Abigails Coding Guidelines" <socyl@987jk.com>
    Re: [Qs] re "Abigails Coding Guidelines" (Anno Siegel)
    Re: ActivePerl and Expect question <ThomasKratz@REMOVEwebCAPS.de>
        enlarge Variablenames <bla@bla.de>
    Re: enlarge Variablenames <ittyspam@yahoo.com>
    Re: enlarge Variablenames <bernard.el-haginDODGE_THIS@lido-tech.net>
    Re: enlarge Variablenames <jurgenex@hotmail.com>
    Re: enlarge Variablenames <bla@bla.de>
    Re: enlarge Variablenames <ittyspam@yahoo.com>
    Re: enlarge Variablenames <jurgenex@hotmail.com>
    Re: enlarge Variablenames <bernard.el-haginDODGE_THIS@lido-tech.net>
        How to compress on unix? (zeke)
    Re: How to compress on unix? <postmaster@castleamber.com>
    Re: How to compress on unix? <jwillmore@remove.adelphia.net>
        How to launch VFP from perl (zeke)
    Re: HTML::Parser not stripping out comments <boatingN.O.S.P.A.M@cox.net>
    Re: HTML::Parser not stripping out comments <boatingN.O.S.P.A.M@cox.net>
    Re: MIDI streaming (Alythh)
        OLE, WMI and ExecMethod - possible? (Daniel Berger)
    Re: rearrange "columns" of a multi-level hash? (Peter Scott)
    Re: Reasons to upgrade to latest version of Perl <spamtrap@dot-app.org>
    Re: Reasons to upgrade to latest version of Perl <ittyspam@yahoo.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 15 Jun 2004 11:50:36 +0000 (UTC)
From: kj <socyl@987jk.com>
Subject: Re: [Qs] re "Abigails Coding Guidelines"
Message-Id: <camnqc$2sh$1@reader2.panix.com>

In <calggn$n2o$1@news.simnet.is> "gnari" <gnari@simnet.is> writes:

>that is why it is best to have the signal handler do as little as
>possible, and try to defer most work to the program proper via
>flags.

Hmmm.  But to be at all useful, those flags would have to be global,
which, if I've followed the discussion, would make the handler
non-reentrant, no?

kj

-- 
NOTE: In my address everything before the period is backwards.


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

Date: 15 Jun 2004 12:32:46 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: [Qs] re "Abigails Coding Guidelines"
Message-Id: <camq9e$av8$1@mamenchi.zrz.TU-Berlin.DE>

kj  <socyl@987jk.com> wrote in comp.lang.perl.misc:
> In <calggn$n2o$1@news.simnet.is> "gnari" <gnari@simnet.is> writes:
> 
> >that is why it is best to have the signal handler do as little as
> >possible, and try to defer most work to the program proper via
> >flags.
> 
> Hmmm.  But to be at all useful, those flags would have to be global,
> which, if I've followed the discussion, would make the handler
> non-reentrant, no?

Yes, technically it does, and consequently there is a (tiny)
probability that a program of this type misses a signal.  Look
at an example.  This code tries to catch two SIGINTs and only
die on the third one.

    my $signal;
    $SIG{ INT} = sub { $signal = shift };

    my $killcount = 0;
    while ( 1 ) {
        sleep 1; # ... or do something useful
        if ( $signal ) {
            $killcount ++;
            # a signal that arrives before this point will be missed
            undef $signal;
        }
        die "3 kills" if $killcount >= 3;
    }

A signal that arrives after the signal handler has returned to the
main loop, but before "undef $signal" is executed will be ignored.

In the example this means that one out of so many (probably millions)
of ^Cs from the keyboard will be missed, which will usually be tolerable.

If missing a signal can't be afforded, the sig handler must block
signals, and the "if ( $signal ) {..."  code must unblock them again,
*after* undefing $signal.  The details how (and perhaps if) that can
be done depend much on the system.

Anno


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

Date: Tue, 15 Jun 2004 13:00:23 +0200
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: ActivePerl and Expect question
Message-Id: <40ced6c6$0$14517$bb690d87@news.main-rheiner.de>

Dipak Prasad wrote:

> Hi
> 
> I have a question regarding ActivePerl and Expect.  I am working with
> already existing ActivePerl (5.6.1 Build 635) s/w for Windows.  I need
> to integrate and automate an interactive CLI-Menu driven 3rd party s/w
> to the ActivePerl s/w.  I was planning to do that using Expect, when I
> found out that Expect is not supported by ActivePerl.  My question is
> there something equivalent to Expect provided by ActivePerl (I have
> never used Active Perl before), and/or is there a way to make Expect
> work with ActivePerl?
> 
> Thanks
> 
> Dipak Prasad

I don't now if it will match all your needs, but have a look at the (a bit 
unfortunaltly named) Win32::Setupsup module.

Thomas
-- 
open STDIN,"<&DATA";$=+=14;$%=50;while($_=(seek( #J~.> a>n~>>e~.......>r.
STDIN,$:*$=+$,+$%,0),getc)){/\./&&last;/\w| /&&( #.u.t.^..oP..r.>h>a~.e..
print,$_=$~);/~/&&++$:;/\^/&&--$:;/>/&&++$,;/</  #.>s^~h<t< ..~. ...c.^..
&&--$,;$:%=4;$,%=23;$~=$_;++$i==1?++$,:_;}__END__#....>>e>r^..>l^...>k^..


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

Date: Tue, 15 Jun 2004 15:26:55 +0200
From: Ugur Boss <bla@bla.de>
Subject: enlarge Variablenames
Message-Id: <camtf0$lvv$1@news.mch.sbs.de>

my Problem ist following:

	$nr1 = 1;
	$nr2 = 2;

	$name.$nr = "Hello";

I have tried following way:

	${"name".$nr} = "Hello";

But it doesn´t work. Is there another way to solve my problem?

greetings



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

Date: Tue, 15 Jun 2004 09:34:43 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: enlarge Variablenames
Message-Id: <20040615093244.K20623@dishwasher.cs.rpi.edu>

On Tue, 15 Jun 2004, Ugur Boss wrote:

> my Problem ist following:
>
> =09$nr1 =3D 1;
> =09$nr2 =3D 2;
>
> =09$name.$nr =3D "Hello";
>
> I have tried following way:
>
> =09${"name".$nr} =3D "Hello";
>
> But it doesn=B4t work. Is there another way to solve my problem?

You haven't described what your problem is.  What exactly are you trying
to achieve?

Note that I'm going to make a *guess* that you are trying to use a
variable as a variable name.  This is A Bad Idea.  For more information on
why this is A Bad Idea, and how to do what you *should* do instead, please
read the FAQ entry "How can I use a variable as a variable name":

perldoc -q 'variable name'

Paul Lalli


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

Date: Tue, 15 Jun 2004 15:36:51 +0200
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: enlarge Variablenames
Message-Id: <Xns95099F2104C0Delhber1lidotechnet@62.89.127.66>

Ugur Boss <bla@bla.de> wrote:

> my Problem ist following:
> 
>      $nr1 = 1;
>      $nr2 = 2;
> 
>      $name.$nr = "Hello";
> 
> I have tried following way:
> 
>      ${"name".$nr} = "Hello";
> 
> But it doesn´t work. Is there another way to solve my problem?


You haven't actually stated what your problem is, but use a hash.

===========
my %way_of_avoiding_evil_symrefs;

$way_of_avoiding_evil_symrefs{"name$nr"} = 'Hello';
===========

and then use $way_of_avoiding_evil_symrefs{"name$nr"} anywhere you'd 
use "name".$nr in your example above.


-- 
Cheers,
Bernard


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

Date: Tue, 15 Jun 2004 13:44:15 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: enlarge Variablenames
Message-Id: <P2Dzc.46715$TR1.12891@nwrddc01.gnilink.net>

Ugur Boss wrote:
> my Problem ist following:
>
> $nr1 = 1;
> $nr2 = 2;
>
> $name.$nr = "Hello";

This is not Perl. Are you thinking about a "record" like in Modula or
Pascal?
The closest Perl data structure would be a hash:
    $name{$nr} = "Hello";

jue




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

Date: Tue, 15 Jun 2004 15:46:33 +0200
From: Ugur Boss <bla@bla.de>
Subject: Re: enlarge Variablenames
Message-Id: <camujp$qcc$1@news.mch.sbs.de>

I try to enlarge the variablename of my scalar $name so that i have 
later a variable named $name666 or $name999 with the value "Hello".


Paul Lalli schrieb:

> On Tue, 15 Jun 2004, Ugur Boss wrote:
> 
> 
>>my Problem ist following:
>>
>>	$nr1 = 999;
>>	$nr2 = 666;
>>
>>	$name.$nr = "Hello";
>>
>>I have tried following way:
>>
>>	${"name".$nr} = "Hello";
>>
>>But it doesn´t work. Is there another way to solve my problem?
> 
> 
> You haven't described what your problem is.  What exactly are you trying
> to achieve?
> 
> Note that I'm going to make a *guess* that you are trying to use a
> variable as a variable name.  This is A Bad Idea.  For more information on
> why this is A Bad Idea, and how to do what you *should* do instead, please
> read the FAQ entry "How can I use a variable as a variable name":
> 
> perldoc -q 'variable name'
> 
> Paul Lalli



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

Date: Tue, 15 Jun 2004 09:52:08 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: enlarge Variablenames
Message-Id: <20040615095031.P20623@dishwasher.cs.rpi.edu>

[please post your replies *below* the text you are replying to]

On Tue, 15 Jun 2004, Ugur Boss wrote:

> Paul Lalli schrieb:
>
> > On Tue, 15 Jun 2004, Ugur Boss wrote:
> >
> >
> >>my Problem ist following:
> >>
> >>=09$nr1 =3D 999;
> >>=09$nr2 =3D 666;
> >>
> >>=09$name.$nr =3D "Hello";
> >>
> >>I have tried following way:
> >>
> >>=09${"name".$nr} =3D "Hello";
> >>
> >>But it doesn=B4t work. Is there another way to solve my problem?
> >
> >
> > You haven't described what your problem is.  What exactly are you tryin=
g
> > to achieve?
> >
> > Note that I'm going to make a *guess* that you are trying to use a
> > variable as a variable name.  This is A Bad Idea.  For more information=
 on
> > why this is A Bad Idea, and how to do what you *should* do instead, ple=
ase
> > read the FAQ entry "How can I use a variable as a variable name":
> >
> > perldoc -q 'variable name'
> >
> > Paul Lalli
>
> I try to enlarge the variablename of my scalar $name so that i have
> later a variable named $name666 or $name999 with the value "Hello".
>

Yes.  This is what I said.  You are trying to use a variable (in this case
$nr1 or $nr2) as part of a variable name.  This is not a good idea.
Please read the FAQ I mentioned in my previous reply.  If you do not
understand something in that FAQ, let us know what you don't understand.

Paul Lalli


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

Date: Tue, 15 Jun 2004 13:58:24 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: enlarge Variablenames
Message-Id: <4gDzc.46771$TR1.20338@nwrddc01.gnilink.net>

[Please do not top-post]
[Please trim the quoted text to a reasonble amout that is needed for
context]
Ugur Boss wrote:
> I try to enlarge the variablename of my scalar $name so that i have
> later a variable named $name666 or $name999 with the value "Hello".

This is A Bad Idea.
Please see 'perldoc -q "variable name"' why and what to do instead.

jue




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

Date: Tue, 15 Jun 2004 15:55:31 +0200
From: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net>
Subject: Re: enlarge Variablenames
Message-Id: <Xns9509A24BD77FAelhber1lidotechnet@62.89.127.66>



[please don't top-post]


Ugur Boss <bla@bla.de> wrote:

> Paul Lalli schrieb:
> 
>> On Tue, 15 Jun 2004, Ugur Boss wrote:
>> 
>> 
>>>my Problem ist following:
>>>
>>>     $nr1 = 999;
>>>     $nr2 = 666;
>>>
>>>     $name.$nr = "Hello";
>>>
>>>I have tried following way:
>>>
>>>     ${"name".$nr} = "Hello";
>>>
>>>But it doesn´t work. Is there another way to solve my problem?
>> 
>> 
>> You haven't described what your problem is.  What exactly are you
>> trying to achieve?
>> 
>> Note that I'm going to make a *guess* that you are trying to use
>> a variable as a variable name.  This is A Bad Idea.  For more
>> information on why this is A Bad Idea, and how to do what you
>> *should* do instead, please read the FAQ entry "How can I use a
>> variable as a variable name": 
>> 
>> perldoc -q 'variable name'
>
>
> I try to enlarge the variablename of my scalar $name so that i
> have later a variable named $name666 or $name999 with the value
> "Hello". 


Then why aren't you using an array?


-- 
Cheers,
Bernard


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

Date: 15 Jun 2004 06:54:10 -0700
From: mfzarno@nsa.gov (zeke)
Subject: How to compress on unix?
Message-Id: <e1810acf.0406150554.cecb944@posting.google.com>

Running ActivePerl on Windows2000PRO.  Need perl script to 'tell'
connected unix workstation to compress specified files on the unix
drive.  Not compressing/zipping on Windows platform.  Must use unix
command "compress".  Any assist/direction/samples appreciated!

Zeke


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

Date: Tue, 15 Jun 2004 08:58:09 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: How to compress on unix?
Message-Id: <40cf0075$0$215$58c7af7e@news.kabelfoon.nl>

zeke wrote:

> Running ActivePerl on Windows2000PRO.  Need perl script to 'tell'
> connected unix workstation to compress specified files on the unix
> drive.  Not compressing/zipping on Windows platform.  Must use unix
> command "compress".  Any assist/direction/samples appreciated!

man compress
SSH

-- 
John                               MexIT: http://johnbokma.com/mexit/
                            personal page:       http://johnbokma.com/
    Experienced Perl programmer available:     http://castleamber.com/
             Happy Customers: http://castleamber.com/testimonials.html


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

Date: Tue, 15 Jun 2004 10:34:46 -0400
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: How to compress on unix?
Message-Id: <pan.2004.06.15.14.34.42.852902@remove.adelphia.net>

On Tue, 15 Jun 2004 06:54:10 -0700, zeke wrote:

> Running ActivePerl on Windows2000PRO.  Need perl script to 'tell'
> connected unix workstation to compress specified files on the unix
> drive.  Not compressing/zipping on Windows platform.  Must use unix
> command "compress".  Any assist/direction/samples appreciated!

There are various compression modules on CPAN.  You could use one of them.
http://search.cpan.org/

Or, you could use the 'system' function (perldoc -f system) to execute the
`compress` command on the *NIX box.

HTH

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
 So, what's with this guy Gideon, anyway?  And why can't he ever 
 remember his Bible? 
 


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

Date: 15 Jun 2004 05:30:55 -0700
From: mfzarno@nsa.gov (zeke)
Subject: How to launch VFP from perl
Message-Id: <e1810acf.0406150430.1fea7d74@posting.google.com>

I have a VisualFoxPro program (.fxp extension) that I wish my perl
script to launch.  In addition I need to pass an argument from perl to
the VFP program, and lastly receive back from the VFP program an
argument (successful vs error condition at end of VFP program).  I can
do this in Mac environment, but am now required to do same in
Windows2000PRO environment.  All assists/direction/samples
appreciated!

zeke


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

Date: Tue, 15 Jun 2004 10:06:43 -0400
From: "Jay" <boatingN.O.S.P.A.M@cox.net>
Subject: Re: HTML::Parser not stripping out comments
Message-Id: <slDzc.5103$Gy.59@fed1read03>

"Gisle Aas" <gisle@ActiveState.com> wrote in message
news:m3d641b79l.fsf@eik.g.aas.no...
> "Jay" <boatingN.O.S.P.A.M@cox.net> writes:
>
>  > I'm trying to get HTML::Parser to strip out the comments using some of
the
> > sample code from the man page.  I'm using the ignore_elements and I
still
> > get  comments in the dtext.  Am I doing something wrong?
>
> Probably :)
>
> > CODE:
> > use HTML::Parser ();
> >
> >  # Create parser object
> >  $p = HTML::Parser->new( api_version => 3,
> >                          start_h => [\&start, "tagname, attr"],
> >                          end_h   => [\&end,   "tagname"],
> >     comment_h => [\&comment, "self,text"],
> >     text_h => [\&dtext, "self,text"],
> >                          marked_sections => 1,
>
> You really want marked_sections to be enabled?
>
> >                        );
> >
> >  $p->ignore_elements( qw(script, comment, style) );
>
> You need to remove all the "," here.  Otherwise they end up part of
> the strings passed to ignore_elements.  Also there is no <comment> tag
> in HTML, so there is not comment element either.
>
> The extra commas probably explain why you get the JavaScript comment
> reported to your &dtext callback.  Anything between <script> and
> </script> is reported as text. Even if it looks like a comment to you
> it's not really that.
>
> >  $p->strict_comment( [1] );
>
> I don't think you actually want strict_comment enabled either.  A
> plain 1 is also a perfectly fine true boolean.
>
> > # Parse directly from file
> >  $p->parse_file("0");
>
> That's a strange file name.
>
> Regards,
> Gisle

Thanks Gisle,
I will look at this some more with your reccomendations and post the
results.
yes, a strange filename.

Jay





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

Date: Tue, 15 Jun 2004 11:03:19 -0400
From: "Jay" <boatingN.O.S.P.A.M@cox.net>
Subject: Re: HTML::Parser not stripping out comments
Message-Id: <AaEzc.11626$wS2.4540@okepread03>

"Jay" <boatingN.O.S.P.A.M@cox.net> wrote in message
news:ARmzc.20666$Qv1.5290@lakeread03...
> I'm trying to get HTML::Parser to strip out the comments using some of the
> sample code from the man page.  I'm using the ignore_elements and I still
> get  comments in the dtext.  Am I doing something wrong?
>
> Tia,
> Jay
>
> CODE:
> use HTML::Parser ();
>
>  # Create parser object
>  $p = HTML::Parser->new( api_version => 3,
>                          start_h => [\&start, "tagname, attr"],
>                          end_h   => [\&end,   "tagname"],
>     comment_h => [\&comment, "self,text"],
>     text_h => [\&dtext, "self,text"],
>                          marked_sections => 1,
>                        );
>
>  $p->ignore_elements( qw(script, comment, style) );
>  $p->strict_comment( [1] );
> # Parse directly from file
>  $p->parse_file("0");
>
>
>     sub start {
>        my($self, $tagname, $attr, $attrseq, $origtext) = @_;
>        #...
>     }
>
>     sub end {
>         my($self, $tagname, $origtext) = @_;
>         #...
>     }
>
>     sub text {
>         my($self, $origtext, $is_cdata) = @_;
>         #...
>  }
>     sub comment{
>         #my($self, $origtext, $is_cdata) = @_;
>         #...
>  }
>
>     sub dtext {
>         my($self, $dtext ) = @_;
>  $dtext=~s/\s+/ /g;
>         print "DTEXT: $dtext\n";
>  }
>
> Example of some of the output from parsing some web page:
>
> DTEXT: <!-- /* You may give each page an identifying name, server, and
> channel on the next lines. */ var s_pageName="buy"; var s_server="CWEB15";
> var s_channel="buy"; var s_pageTyp
> e=""; var s_prop1="Autoweb Direct to Site"; var s_prop2="Autoweb Direct to
> Site 10714"; var s_prop3=""; var s_prop4=""; var s_prop5=""; var
s_prop6="";
> var s_prop7="buy|"; var s_pr
> op8=""; var s_prop9="buy|Autoweb Direct to Site|10714"; var
s_prop10="buy|";
> var s_prop11="Autoweb Direct to Site|10714|taweb"; var s_prop12="||"; var
> s_prop13="||||||buy||No"; var
>  s_prop14="Autoweb Direct to Site|10714|taweb|||||buy||No"; var
s_prop15="No
> Article|No Article"; var s_prop16=""; var s_prop17=""; var
s_prop18="Autoweb
> Direct to Site|10714|buy";
>  var s_prop19="Autoweb Direct to Site|10714||buy"; var
> s_prop20="buy||||sky|ban|Autoweb Direct to Site"; /* E-commerce Variables
*/
> var s_campaign="10714"; var s_state=""; var s_zi
> p=""; var s_events=""; var s_products=""; var s_purchaseID=""; var
> s_eVar1="Autoweb Direct to Site"; var s_eVar2="Autoweb Direct to Site
> 10714"; var s_eVar3="NT-sky-ban"; var s_eVa
> r4=""; var s_eVar5=""; /********* INSERT THE DOMAIN AND PATH TO YOUR CODE
> BELOW ************/ /********** DO NOT ALTER ANYTHING ELSE BELOW THIS
LINE!
> *************/ var s_code=' '/
> /-->
> DTEXT:
> DTEXT:


That did the trick, thanks alot.

Jay




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

Date: 15 Jun 2004 03:19:29 -0700
From: alythh@netscape.net (Alythh)
Subject: Re: MIDI streaming
Message-Id: <6a25ba72.0406150219.7329bdcc@posting.google.com>

Ben Morrow <usenet@morrow.me.uk> wrote in message news:<cafhps$7hk$3@wisteria.csv.warwick.ac.uk>...
> Quoth nenamiele@libero.it (Alx):
> > I'm trying to use the fine MIDI::simple module, but I'd like its
> > output not to be saved to a file, but streamed out.
> > (it is a "singing" cellular automata, and I'd like to listen to its
> > hisses and noises in the background).
> > Somebody here knows if it is possible?
> 
> Call write_score with an open filehandle instead of a filename.
> 
> Ben

Thanks for the suggestion, but it doesnt work: I tried streaming using
"write_score *STDOUT{IO}", but it doesnt work: by looking at the
output it seems to me that each write_score call rewrites from the
start the score, headers and so on... timidity plays the 1st note and
shuts down.

Alessandro


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

Date: 15 Jun 2004 07:56:41 -0700
From: djberg96@hotmail.com (Daniel Berger)
Subject: OLE, WMI and ExecMethod - possible?
Message-Id: <6e613a32.0406150656.678640fa@posting.google.com>

Hi all,

Is there a way to use ExecMethod() on a SWbemServices object via
Win32::OLE?  It seems you ought to be able to exec class methods
directly, rather than iterating all "InstancesOf" and calling method
on the objects individually.  Yes, I'm aware of how to do it that way,
but I think somethink like the syntax below ought to work:

use strict;
use Win32::OLE qw(in with);

my $wmi = Win32::OLE->GetObject("winmgmts:\\");
my $rv = $wmi->ExecMethod("Win32_Service","StartService","ClipSrv")
  or die "Error", Win32::OLE->LastError;
  
print "RV: $rv\n";

I messed around with "Invoke", but that didn't seem to work either.  I
also tried playing around with the constructor for $wmi, but no luck. 
Am I just doing it wrong?  Or is something like the syntax above just
not possible?

Regards,

Dan

Relevant link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/swbemservices.asp


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

Date: Tue, 15 Jun 2004 12:48:13 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: rearrange "columns" of a multi-level hash?
Message-Id: <heCzc.722755$Pk3.521592@pd7tw1no>

In article <cal2ct$q9q$1@wisteria.csv.warwick.ac.uk>,
 Ben Morrow <usenet@morrow.me.uk> writes:
>
>Quoth hymie@lactose.smart.net (hymie!):
>> In our last episode, the evil Dr. Lacto had captured our hero,
>>   Ben Morrow <usenet@morrow.me.uk>, who said:
>> >
>> >Why is the data stored like this at all? Surely it would be better to
>> >store the return code straight in the hash, rather than have another
>> >level with only one (significant) value?
>> 
>> Because a single set of customer-type-productcode-appno-vendor may have
>> more than one return code, and I need to track all of them that appear.
>> 
>> But I'll probaby switch it something like
>>   $list{$customer}...{$vendor} .= "$returnCode:"
>>      if grep $_ == $returnCode, qw/130 150 385/;
>> and then I can m// through the values later.
>
>Oooh, no, that's very shell :).
>Use an array:
>
>push @{ $list{...} }, $returnCode if ...;

The condition is somewhat shell too :-)

  ... if $returnCode =~ /^(130|150|385)\Z/;
  ... if {map {$=>1} (130,150,385)}->{$returnCode};

Although it would be more maintainable to put something like

  my %Ok_Return_Code = map { $_ => 1 } (130, 150, 385);

in a configuration section and then just do

  ... if $Ok_Return_Code{$returnCode};

-- 
Peter Scott
http://www.perldebugged.com/
*** NEW *** http://www.perlmedic.com/


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

Date: Tue, 15 Jun 2004 06:21:35 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Reasons to upgrade to latest version of Perl
Message-Id: <_6adndPbP-ksUFPdRVn-sA@adelphia.com>

Mothra wrote:

> Can anyone give me some good reasons to upgrade Perl to the lastest
> stable release?  Apart from it being the latest stable release?
> Unfortunately that one doesn't seem to impress managers enough to
> upgrade from 5.005_03.

Look through the perldelta doc pages. Those list what's changed with each
new version. Look for bugs fixed, security holes patched, and optimizations
that actually affect your production code. Look for new features that would
simplify your planned future development efforts.

After all is said and done, you might find that no bugs are biting you, no
known security holes are open, no optimizations have been done that will
let you squeeze another year or two out of your hardware, and no major
changes are planned that couldn't be done just as well with the version you
have.

What do you do if that's the case? Simple - nothing. If it ain't broke,
don't fix it. This might be why your managers are reluctant. If they've
been around the block a time or two, they've probably been burned by the
"ooh, shiny" impulse, and learned the hard way that newer isn't always
better.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org


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

Date: Tue, 15 Jun 2004 06:45:50 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Reasons to upgrade to latest version of Perl
Message-Id: <20040615064458.I20623@dishwasher.cs.rpi.edu>

On Tue, 15 Jun 2004, Mothra wrote:

> Can anyone give me some good reasons to upgrade Perl to the lastest
> stable release?  Apart from it being the latest stable release?
> Unfortunately that one doesn't seem to impress managers enough to
> upgrade from 5.005_03.


In addition to the other comments you've received in this thread, there's
a FAQ on this topic that you might want to read:

perldoc -q convince


Paul Lalli


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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