[31007] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2252 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 5 14:09:50 2009

Date: Thu, 5 Mar 2009 11:09:13 -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           Thu, 5 Mar 2009     Volume: 11 Number: 2252

Today's topics:
        A globbing question <yakovlev@hotmail.com>
    Re: A globbing question <yakovlev@hotmail.com>
    Re: A globbing question <syscjm@sumire.gwu.edu>
    Re: A globbing question <someone@example.com>
    Re: A globbing question <jimsgibson@gmail.com>
        Find Windows Compression attribute? <novastaylor@gmail.com>
    Re: Find Windows Compression attribute? QoS@invalid.net
    Re: Find Windows Compression attribute? <smallpond@juno.com>
        Net::Appliance::Session error? or something else? <scottdware@gmail.com>
    Re: Net::Appliance::Session error? or something else? <smallpond@juno.com>
    Re: Net::Appliance::Session error? or something else? <scottdware@gmail.com>
    Re: Net::Appliance::Session error? or something else? <scottdware@gmail.com>
        Strange system() slowdown when using Inline::C <ross.girshick@gmail.com>
    Re: Strange system() slowdown when using Inline::C <ross.girshick@gmail.com>
    Re: system not returning correct return code. <ben@morrow.me.uk>
        use constant and hash <michaelgang@gmail.com>
    Re: use constant and hash (Tim McDaniel)
    Re: use constant and hash <michaelgang@gmail.com>
    Re: What-if algorithm  <gamo@telecable.es>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 5 Mar 2009 09:57:36 -0800 (PST)
From: Alex <yakovlev@hotmail.com>
Subject: A globbing question
Message-Id: <4df9f800-2346-459d-8990-48ec66ceee13@b16g2000yqb.googlegroups.com>

Hello,

I'm trying to figure out how to "glob" lists instead of the current
directory. For example:

  my @var = File::Glob::bsd_glob('a*');
  foreach my $f (@var) {print $f, "\n";}

This fragment will print all the filenames started with 'a' in the
current directory.

I need some function which doesn't depend on the file system. For
example

  my @set = ('ab', 'ac', 'bc');
  my @var = new_bsd_glob('a*', @set);    # <---- non-existing function
with additional parameter
  foreach my $f (@var) {print $f, "\n";}

It must work exactly as shell globbing, so it should print 'ab' and
'ac'.

I suspect this "new_bsd_glob" function already exist - could you
please advice where it resides?

Thanks
Alex


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

Date: Thu, 5 Mar 2009 10:25:04 -0800 (PST)
From: Alex <yakovlev@hotmail.com>
Subject: Re: A globbing question
Message-Id: <1c5733e7-83b1-4d1e-9d51-bb5a87826dbf@s31g2000vbp.googlegroups.com>

On Mar 5, 12:57 pm, Alex <yakov...@hotmail.com> wrote:
> Hello,
>
> I'm trying to figure out how to "glob" lists instead of the current
> directory. For example:
>
>   my @var = File::Glob::bsd_glob('a*');
>   foreach my $f (@var) {print $f, "\n";}
>
> This fragment will print all the filenames started with 'a' in the
> current directory.
>
> I need some function which doesn't depend on the file system. For
> example
>
>   my @set = ('ab', 'ac', 'bc');
>   my @var = new_bsd_glob('a*', @set);    # <---- non-existing function
> with additional parameter
>   foreach my $f (@var) {print $f, "\n";}
>
> It must work exactly as shell globbing, so it should print 'ab' and
> 'ac'.
>
> I suspect this "new_bsd_glob" function already exist - could you
> please advice where it resides?
>
> Thanks
> Alex

I've already found the Text::Glob !!

Thanks
Alex


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

Date: Thu, 05 Mar 2009 12:25:59 -0600
From: Chris Mattern <syscjm@sumire.gwu.edu>
Subject: Re: A globbing question
Message-Id: <slrngr069n.i9s.syscjm@sumire.gwu.edu>

On 2009-03-05, Alex <yakovlev@hotmail.com> wrote:
> Hello,
>
> I'm trying to figure out how to "glob" lists instead of the current
> directory. For example:
>
>   my @var = File::Glob::bsd_glob('a*');
>   foreach my $f (@var) {print $f, "\n";}
>
> This fragment will print all the filenames started with 'a' in the
> current directory.
>
> I need some function which doesn't depend on the file system. For
> example
>
>   my @set = ('ab', 'ac', 'bc');
>   my @var = new_bsd_glob('a*', @set);    # <---- non-existing function
> with additional parameter
>   foreach my $f (@var) {print $f, "\n";}
>
> It must work exactly as shell globbing, so it should print 'ab' and
> 'ac'.
>
> I suspect this "new_bsd_glob" function already exist - could you
> please advice where it resides?
>
Is there some bizarre reason you can't use regular expressions?

-- 
             Christopher Mattern

NOTICE
Thank you for noticing this new notice
Your noticing it has been noted
And will be reported to the authorities


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

Date: Thu, 05 Mar 2009 10:31:41 -0800
From: "John W. Krahn" <someone@example.com>
Subject: Re: A globbing question
Message-Id: <iUUrl.24170$Tp5.12225@newsfe13.iad>

Alex wrote:
> 
> I'm trying to figure out how to "glob" lists instead of the current
> directory. For example:
> 
>   my @var = File::Glob::bsd_glob('a*');
>   foreach my $f (@var) {print $f, "\n";}
> 
> This fragment will print all the filenames started with 'a' in the
> current directory.
> 
> I need some function which doesn't depend on the file system. For
> example
> 
>   my @set = ('ab', 'ac', 'bc');
>   my @var = new_bsd_glob('a*', @set);    # <---- non-existing function
> with additional parameter
>   foreach my $f (@var) {print $f, "\n";}
> 
> It must work exactly as shell globbing, so it should print 'ab' and
> 'ac'.

It sounds like you want something like:

my @var = new_bsd_glob('{a*,ab,ac,bc}')



John
-- 
Those people who think they know everything are a great
annoyance to those of us who do.        -- Isaac Asimov


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

Date: Thu, 05 Mar 2009 10:37:00 -0800
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: A globbing question
Message-Id: <050320091037003286%jimsgibson@gmail.com>

In article
<4df9f800-2346-459d-8990-48ec66ceee13@b16g2000yqb.googlegroups.com>,
Alex <yakovlev@hotmail.com> wrote:

> Hello,
> 
> I'm trying to figure out how to "glob" lists instead of the current
> directory. For example:
> 
>   my @var = File::Glob::bsd_glob('a*');
>   foreach my $f (@var) {print $f, "\n";}
> 
> This fragment will print all the filenames started with 'a' in the
> current directory.
> 
> I need some function which doesn't depend on the file system. For
> example
> 
>   my @set = ('ab', 'ac', 'bc');
>   my @var = new_bsd_glob('a*', @set);    # <---- non-existing function
> with additional parameter
>   foreach my $f (@var) {print $f, "\n";}
> 
> It must work exactly as shell globbing, so it should print 'ab' and
> 'ac'.
> 
> I suspect this "new_bsd_glob" function already exist - could you
> please advice where it resides?

Perhaps you are looking for grep:

my @var = grep( /a*/, @set );

See 'perldoc -f grep'

-- 
Jim Gibson


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

Date: Thu, 5 Mar 2009 05:43:17 -0800 (PST)
From: NovasTaylor <novastaylor@gmail.com>
Subject: Find Windows Compression attribute?
Message-Id: <0baf362e-7b17-4538-8af4-981b109e8c91@x13g2000yqf.googlegroups.com>

Hi folks,

Is there a way I can identify the windows compression property
"Compress contents to save disk space" on files and folders? I have a
large directory structure where I need to find files that have the
compression property active and ideally turn that attribute off.
Simply identifying the files with that attribute would be a good first
step.

Thanks!

Tim


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

Date: Thu, 05 Mar 2009 15:22:34 GMT
From: QoS@invalid.net
Subject: Re: Find Windows Compression attribute?
Message-Id: <_6Srl.1462$%u5.804@nwrddc01.gnilink.net>


NovasTaylor <novastaylor@gmail.com> wrote in message-id:  <0baf362e-7b17-4538-8af4-981b109e8c91@x13g2000yqf.googlegroups.com>

> 
> Hi folks,
> 
> Is there a way I can identify the windows compression property
> "Compress contents to save disk space" on files and folders? I have a
> large directory structure where I need to find files that have the
> compression property active and ideally turn that attribute off.
> Simply identifying the files with that attribute would be a good first
> step.
> 
> Thanks!
> 
> Tim

parse the output of compact /s
the third column of the output displays the compression ratio.
 
example output:  63344 :     63344 = 1.0 to 1   CDILLA05.DLL




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

Date: Thu, 5 Mar 2009 08:12:48 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: Find Windows Compression attribute?
Message-Id: <996ef43c-10fe-41c8-8f79-fd69fe7264e0@t7g2000yqa.googlegroups.com>

On Mar 5, 8:43=A0am, NovasTaylor <novastay...@gmail.com> wrote:
> Hi folks,
>
> Is there a way I can identify the windows compression property
> "Compress contents to save disk space" on files and folders? I have a
> large directory structure where I need to find files that have the
> compression property active and ideally turn that attribute off.
> Simply identifying the files with that attribute would be a good first
> step.
>
> Thanks!
>
> Tim

I believe that you can get this from Win32::File


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

Date: Thu, 5 Mar 2009 07:36:28 -0800 (PST)
From: scottdware <scottdware@gmail.com>
Subject: Net::Appliance::Session error? or something else?
Message-Id: <fdadc296-c385-4add-8b98-822653ee15f3@d2g2000pra.googlegroups.com>

Hello,

I am having trouble on some of my SSH scripts that are using the
Net::Appliance::Session module on a Unix (Solaris 9) box.

Basically, I keep getting the error:

"Login failed to remote host at line..."
"Pattern match time-out"

Can you see any reason as to why I am getting that? If I use this on
Cygwin, it works fine, but I don't know why it wouldn't work on Unix?

Here's a test script:

#!/usr/local/bin/perl

use strict;
use warnings;
use Net::Appliance::Session;

my $user = "username";
my $pass = "password";
my $host = "somehost.domain.com";
my $command = "show ip int brie";

my $ssh = Net::Appliance::Session->new(Host => $host, Transport =>
'SSH');

eval {
        $ssh->connect(Name => $user, Password => $pass, SHKC => 0);
        $ssh->cmd(String => $command, Timeout => 30);
        sleep 2;
};

if (UNIVERSAL::isa($@, 'Net::Appliance::Session::Exception')) {
        print $@->message ."\n";
        print $@->lastline ."\n";
        print $@->errmsg ."\n";
}


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

Date: Thu, 5 Mar 2009 08:35:37 -0800 (PST)
From: smallpond <smallpond@juno.com>
Subject: Re: Net::Appliance::Session error? or something else?
Message-Id: <910e9460-72b8-48d8-8071-dab72a555605@s20g2000yqh.googlegroups.com>

On Mar 5, 10:36=A0am, scottdware <scottdw...@gmail.com> wrote:
> Hello,
>
> I am having trouble on some of my SSH scripts that are using the
> Net::Appliance::Session module on a Unix (Solaris 9) box.
>
> Basically, I keep getting the error:
>
> "Login failed to remote host at line..."
> "Pattern match time-out"
>
> Can you see any reason as to why I am getting that? If I use this on
> Cygwin, it works fine, but I don't know why it wouldn't work on Unix?
>
> Here's a test script:
>
> #!/usr/local/bin/perl
>
> use strict;
> use warnings;
> use Net::Appliance::Session;
>
> my $user =3D "username";
> my $pass =3D "password";
> my $host =3D "somehost.domain.com";
> my $command =3D "show ip int brie";
>
> my $ssh =3D Net::Appliance::Session->new(Host =3D> $host, Transport =3D>
> 'SSH');
>
> eval {
> =A0 =A0 =A0 =A0 $ssh->connect(Name =3D> $user, Password =3D> $pass, SHKC =
=3D> 0);
> =A0 =A0 =A0 =A0 $ssh->cmd(String =3D> $command, Timeout =3D> 30);
> =A0 =A0 =A0 =A0 sleep 2;
>
> };
>
> if (UNIVERSAL::isa($@, 'Net::Appliance::Session::Exception')) {
> =A0 =A0 =A0 =A0 print $@->message ."\n";
> =A0 =A0 =A0 =A0 print $@->lastline ."\n";
> =A0 =A0 =A0 =A0 print $@->errmsg ."\n";
>
>
>
> }


The login prompt is not matching what the module expects.
Read the "Important Notes ..." section of Net::SSH::Expect
documentation.



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

Date: Thu, 5 Mar 2009 09:43:16 -0800 (PST)
From: scottdware <scottdware@gmail.com>
Subject: Re: Net::Appliance::Session error? or something else?
Message-Id: <06586840-922f-4856-b7b6-658c32703188@v18g2000pro.googlegroups.com>

On Mar 5, 11:35=A0am, smallpond <smallp...@juno.com> wrote:
> On Mar 5, 10:36=A0am, scottdware <scottdw...@gmail.com> wrote:
>
>
>
> > Hello,
>
> > I am having trouble on some of my SSH scripts that are using the
> > Net::Appliance::Session module on a Unix (Solaris 9) box.
>
> > Basically, I keep getting the error:
>
> > "Login failed to remote host at line..."
> > "Pattern match time-out"
>
> > Can you see any reason as to why I am getting that? If I use this on
> > Cygwin, it works fine, but I don't know why it wouldn't work on Unix?
>
> > Here's a test script:
>
> > #!/usr/local/bin/perl
>
> > use strict;
> > use warnings;
> > use Net::Appliance::Session;
>
> > my $user =3D "username";
> > my $pass =3D "password";
> > my $host =3D "somehost.domain.com";
> > my $command =3D "show ip int brie";
>
> > my $ssh =3D Net::Appliance::Session->new(Host =3D> $host, Transport =3D=
>
> > 'SSH');
>
> > eval {
> > =A0 =A0 =A0 =A0 $ssh->connect(Name =3D> $user, Password =3D> $pass, SHK=
C =3D> 0);
> > =A0 =A0 =A0 =A0 $ssh->cmd(String =3D> $command, Timeout =3D> 30);
> > =A0 =A0 =A0 =A0 sleep 2;
>
> > };
>
> > if (UNIVERSAL::isa($@, 'Net::Appliance::Session::Exception')) {
> > =A0 =A0 =A0 =A0 print $@->message ."\n";
> > =A0 =A0 =A0 =A0 print $@->lastline ."\n";
> > =A0 =A0 =A0 =A0 print $@->errmsg ."\n";
>
> > }
>
> The login prompt is not matching what the module expects.
> Read the "Important Notes ..." section of Net::SSH::Expect
> documentation.

Thanks. But why would the Net::SSH::Expect module come in handy here,
since I'm not using it? Does it pull from that as well?


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

Date: Thu, 5 Mar 2009 10:04:37 -0800 (PST)
From: scottdware <scottdware@gmail.com>
Subject: Re: Net::Appliance::Session error? or something else?
Message-Id: <a91d56c3-9ce4-460f-b455-be4eb90fb7b8@v35g2000pro.googlegroups.com>

On Mar 5, 12:43=A0pm, scottdware <scottdw...@gmail.com> wrote:
> On Mar 5, 11:35=A0am, smallpond <smallp...@juno.com> wrote:
>
>
>
> > On Mar 5, 10:36=A0am, scottdware <scottdw...@gmail.com> wrote:
>
> > > Hello,
>
> > > I am having trouble on some of my SSH scripts that are using the
> > > Net::Appliance::Session module on a Unix (Solaris 9) box.
>
> > > Basically, I keep getting the error:
>
> > > "Login failed to remote host at line..."
> > > "Pattern match time-out"
>
> > > Can you see any reason as to why I am getting that? If I use this on
> > > Cygwin, it works fine, but I don't know why it wouldn't work on Unix?
>
> > > Here's a test script:
>
> > > #!/usr/local/bin/perl
>
> > > use strict;
> > > use warnings;
> > > use Net::Appliance::Session;
>
> > > my $user =3D "username";
> > > my $pass =3D "password";
> > > my $host =3D "somehost.domain.com";
> > > my $command =3D "show ip int brie";
>
> > > my $ssh =3D Net::Appliance::Session->new(Host =3D> $host, Transport =
=3D>
> > > 'SSH');
>
> > > eval {
> > > =A0 =A0 =A0 =A0 $ssh->connect(Name =3D> $user, Password =3D> $pass, S=
HKC =3D> 0);
> > > =A0 =A0 =A0 =A0 $ssh->cmd(String =3D> $command, Timeout =3D> 30);
> > > =A0 =A0 =A0 =A0 sleep 2;
>
> > > };
>
> > > if (UNIVERSAL::isa($@, 'Net::Appliance::Session::Exception')) {
> > > =A0 =A0 =A0 =A0 print $@->message ."\n";
> > > =A0 =A0 =A0 =A0 print $@->lastline ."\n";
> > > =A0 =A0 =A0 =A0 print $@->errmsg ."\n";
>
> > > }
>
> > The login prompt is not matching what the module expects.
> > Read the "Important Notes ..." section of Net::SSH::Expect
> > documentation.
>
> Thanks. But why would the Net::SSH::Expect module come in handy here,
> since I'm not using it? Does it pull from that as well?

Ok, I figured it out. I had to specify the "App" parameter inside of
the connect constructor, and then it worked as intended:

$ssh->connect(Name =3D> $user, Password =3D> $pass, SHKC =3D> 0, App =3D> '=
/
usr/local/bin/ssh');


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

Date: Thu, 5 Mar 2009 09:15:01 -0800 (PST)
From: rbg <ross.girshick@gmail.com>
Subject: Strange system() slowdown when using Inline::C
Message-Id: <2abccbd9-a06e-4258-a02b-dd70be7c59e0@e5g2000vbe.googlegroups.com>

Before reading the code below, I want to make it clear that this code
is just a *simple reproduction* of a bug I'm seeing in some
computational biology code.  So please don't point out things like,
"why are you using system() to run date?!?". :-)

The problem I'm having is that when I make the array foo[] large, the
calls to system() slow down enormously.  I'm measuring this problem
using `perl -d:DProf ...`

Test case 1 below is slow, test case 2 is faster.  The only difference
is LEN = (1<<26) in test case 1 and LEN = (1<<10) in test case 2.  I
welcome any ideas on how to debug this bizarre problem.

Thanks!
Ross

Test case 1:
-------------------------
use Inline C;
use strict;
hello();

sub foo {
  for my $i (1..1000) {
    system('date > /dev/null');
  }
}
foo();
__END__
__C__
#define LEN (1<<26)
static char foo[LEN];

void hello() {
  int i;
  printf("hello world\n");
  for (i = 0; i < LEN; i++) {
    foo[i] = 0;
  }
}
-------------------------

Test case 2
-------------------------
use Inline C;
use strict;
hello();

sub foo {
  for my $i (1..1000) {
    system('date > /dev/null');
  }
}
foo();
__END__
__C__
#define LEN (1<<10)
static char foo[LEN];

void hello() {
  int i;
  printf("hello world\n");
  for (i = 0; i < LEN; i++) {
    foo[i] = 0;
  }
}
-------------------------


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

Date: Thu, 5 Mar 2009 09:24:49 -0800 (PST)
From: rbg <ross.girshick@gmail.com>
Subject: Re: Strange system() slowdown when using Inline::C
Message-Id: <03b91f73-2166-4f6c-af9c-27fa157bbf47@v15g2000yqn.googlegroups.com>

I should include the DProf output for these cases.

Test 1:

Total Elapsed Time = 12.65265 Seconds
  User+System Time = 3.202649 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
 90.5   2.900  2.900      1   2.9000 2.9000  main::foo


Test 2:

Total Elapsed Time = 4.697635 Seconds
  User+System Time = 0.337635 Seconds
Exclusive Times
%Time ExclSec CumulS #Calls sec/call Csec/c  Name
 77.0   0.260  0.260      1   0.2600 0.2600  main::foo


You can see that in test 2, foo() is roughly 10x faster.


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

Date: Thu, 5 Mar 2009 13:16:50 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: system not returning correct return code.
Message-Id: <2vv486-h22.ln1@osiris.mauzo.dyndns.org>


Quoth Eric Pozharski <whynot@pozharski.name>:
> On 2009-03-04, Xho Jingleheimerschmidt <xhoster@gmail.com> wrote:
> > Eric Pozharski wrote:
> >> On 2009-03-03, Ben Morrow <ben@morrow.me.uk> wrote:
> >>>
> >>> Yes. From the $? entry in perldoc perlvar:
> >>>
> >>>    If you have installed a signal handler for "SIGCHLD", the value
> >>>    of $? will usually be wrong outside that handler.
> >>>
> >>> On systems that honour "IGNORE" for SIGCHLD, it counts as a signal
> >>> handler. So don't do that.
> >> 
> >> I would like that quote to be verified. 
> >
> > Which aspect?
> 
> "If you have ... that handler."
<snip>
> 
> (that seems my english is a way bad still) Did I got that right?  The
> perldoc wants to say that even if I'm in B<waitpid> and I get SIGCHLD
> then the I<$?> still would be unset?

No. What the perldoc is saying is

    If you have a SIGCHLD handler, then any code *outside* that handler
    will not see the correct value for $?.

That is:

    #!/usr/bin/perl

    # $? is useless here.

    $SIG{CHLD} = sub {

        # $? is still useless here, because nothing inside this handler
        # has set it yet.

        waitpid ...;    # or something else that sets $?

        # $? has the correct value here.
    };

    # $? is useless again here.

One consequence of this is that if you have $SIG{CHLD} = "IGNORE", $? is
*never* useful, since there is none of your code running inside the
handler.

Ben



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

Date: Thu, 5 Mar 2009 07:43:55 -0800 (PST)
From: david <michaelgang@gmail.com>
Subject: use constant and hash
Message-Id: <7c8c3ca1-0e61-446f-8149-947d16ff7fb5@o11g2000yql.googlegroups.com>

Hi all,

Is there an option to create a constant hash ?

I tried two snippets
This does not compile:
use strict;
use warnings;
my %hash =(1=>2);
use constant A=>%hash;
print A{1},"\n";

>perl -w a.pl
syntax error at a.pl line 5, near "A{"
syntax error at a.pl line 6, near "A{"
Execution of a.pl aborted due to compilation errors.

and the following does not do the work:
use strict;
use warnings;
my %hash =(1=>2);
use constant A=>\%hash;
print A->{1},"\n";
print A->{2},"\n";
print "why do i print this ?\n"

>perl -w a.pl
Use of uninitialized value in print at a.pl line 6.
2

why do i print this ?


I thought afterwards, that the second snippet has no chance to work.
The hash address remains constant even the values changes :-(.

Has anyone another idea ?
Thanks,
David


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

Date: Thu, 5 Mar 2009 16:24:07 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: use constant and hash
Message-Id: <gooub6$f6$1@reader1.panix.com>

In article <7c8c3ca1-0e61-446f-8149-947d16ff7fb5@o11g2000yql.googlegroups.com>,
david  <michaelgang@gmail.com> wrote:
>Is there an option to create a constant hash ?

What exactly do you mean?
(1) a fixed set of keys -- that is, you can neither create nor delete
    entries?
(2) fixed data -- that is, you can give a value to a given key only
    once, but you can create and delete keys?
(3) both fixed keys and fixed data?
(4) Do you mean recursive constant -- if there's a hash in a value, si
    it locked too?
(5) Do you want the ability to lock and unlock at will?

A CPAN search for
    hash readonly
showed module Readonly.  Damian Conway suggests its use in _Perl Best
Practices_, ch 4, in preference to "use constant".

I did a CPAN search for
    hash locked
and one hit was Hash::Util, which allows various mixtures of those
possibilities.  (Note that lock_keys isn't quite (1): it allows
deleting a key.)  It's somewhat more flexible, but I prefer to know
that something is read-only forever.

-- 
Tim McDaniel, tmcd@panix.com


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

Date: Thu, 5 Mar 2009 08:58:01 -0800 (PST)
From: david <michaelgang@gmail.com>
Subject: Re: use constant and hash
Message-Id: <f0c72752-1036-488f-be37-555303a2fd34@s28g2000vbp.googlegroups.com>

On Mar 5, 6:24=A0pm, t...@panix.com (Tim McDaniel) wrote:
> In article <7c8c3ca1-0e61-446f-8149-947d16ff7...@o11g2000yql.googlegroups=
 .com>,
>
> david =A0<michaelg...@gmail.com> wrote:
> >Is there an option to create a constant hash ?
>
> What exactly do you mean?
> (1) a fixed set of keys -- that is, you can neither create nor delete
> =A0 =A0 entries?
> (2) fixed data -- that is, you can give a value to a given key only
> =A0 =A0 once, but you can create and delete keys?
> (3) both fixed keys and fixed data?
> (4) Do you mean recursive constant -- if there's a hash in a value, si
> =A0 =A0 it locked too?
> (5) Do you want the ability to lock and unlock at will?
>
> A CPAN search for
> =A0 =A0 hash readonly
> showed module Readonly. =A0Damian Conway suggests its use in _Perl Best
> Practices_, ch 4, in preference to "use constant".
>
> I did a CPAN search for
> =A0 =A0 hash locked
> and one hit was Hash::Util, which allows various mixtures of those
> possibilities. =A0(Note that lock_keys isn't quite (1): it allows
> deleting a key.) =A0It's somewhat more flexible, but I prefer to know
> that something is read-only forever.
>
> --
> Tim McDaniel, t...@panix.com

I would prefer option 4 but option 3 is also good. Readonly looks nice
but the last version is from 2004 (does not have to mean anything).
Hash::Util looks very interesting.

Thanks


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

Date: Thu, 5 Mar 2009 15:23:10 +0100
From: gamo <gamo@telecable.es>
Subject: Re: What-if algorithm 
Message-Id: <alpine.LNX.2.00.0903051516010.5542@jvz.es>

On Wed, 4 Mar 2009, gamo wrote:

The question remains open since I suspect that a mathematical
bisection doesn't fit for a goal seek problem. I.e. if max=a
& min=b the bisection method croaks if f(a)*f(b)>0 (It doesn't
garantees the Bolzano's theorem).

f() could be a function with if's max, min, abs, etc. that does
not fit well in a mathematical root-finding schema.

TIA

-- 
http://www.telecable.es/personales/gamo/
"Was it a car or a cat I saw?"
perl -E 'say 111_111_111**2;'


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

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 V11 Issue 2252
***************************************


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