Re: Hash::HasKeys

2005-08-14 Thread Ken Williams


On Aug 13, 2005, at 12:25 PM, Ovid wrote:


--- Mark Stosberg [EMAIL PROTECTED] wrote:


On Sat, Aug 13, 2005 at 07:27:56AM -0500, Ken Williams wrote:

Before discounting it, have you measured the actual resource impact?


I would hope it would be fairly minimal, in it's mode of disabling
validation:


http://search.cpan.org/~drolsky/Params-Validate-0.78/lib/Params/ 
Validate.pm#DISABLING_VALIDATION


Looking at the first sentence of that section:

  If the environment variable PERL_NO_VALIDATION is set
  to something true, then validation is turned off. This
  may be useful if you only want to use this module during
  development but don't want the speed hit during production.

So if I want to avoid the performance impact of Params::Validate, I
have to not do what I want to do.


I wasn't asking about P::V's disabled mode (I never use that either), I  
was asking if you actually know its performance hit is too much in its  
enabled mode.  Have you benchmarked?


 -Ken



Re: Hash::HasKeys

2005-08-14 Thread Ovid
--- A. Pagaltzis [EMAIL PROTECTED] wrote:

 Even if I’ve not convinced you, I know this will be what I’ll be
 doing henceforth. :-)

OK, I'm convinced.  I played around with it for a bit it's close to
what I want.  The reason it didn't seem like an option at first is the
documentation does not make it clear I can lock a non-existing key and
later assign a value.  I suppose the docs *could* be read that way, but
if the docs explicitly said that the restricted keys may contain keys
not already present in the hash, I'd have understood.

Thanks!

Cheers,
Ovid

-- 
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/


Re: Hash::HasKeys

2005-08-14 Thread Ovid
--- Ken Williams [EMAIL PROTECTED] wrote:
 
 I wasn't asking about P::V's disabled mode (I never use that either),
 I  
 was asking if you actually know its performance hit is too much in
 its  
 enabled mode.  Have you benchmarked?

No.  I was trusting my boss's reasoning for not wanting to use P::V and
when I saw all of that documentation when I just wanted to check the
darned keys, I thought I don't need all of that.

Of course, I also whine quite a bit about Perl's awful argument
handling, so I suppose I should buck up and take a look at the module. 
I'm just being silly not doing so.

Cheers,
Ovid

-- 
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/


Re: Hash::HasKeys

2005-08-14 Thread Dave Rolsky

On Sun, 14 Aug 2005, Ovid wrote:


No.  I was trusting my boss's reasoning for not wanting to use P::V and
when I saw all of that documentation when I just wanted to check the
darned keys, I thought I don't need all of that.


Well, it's definitely overhead.  The question is if it's much more 
overhead than some other function you write to handle checking for key 
existence and assigning defaults.



Of course, I also whine quite a bit about Perl's awful argument
handling, so I suppose I should buck up and take a look at the module.
I'm just being silly not doing so.


I'd say so, but I'm biased ;)

I'm very much wishing that P::V can disappear entirely in Perl6, and I'm 
probably going to confirm that on the p6l list, because in the end it's 
just a nasty hack.



-dave

/*===
VegGuide.Orgwww.BookIRead.com
Your guide to all that's veg.   My book blog
===*/


Re: Hash::HasKeys

2005-08-14 Thread Mark Stosberg
On Sun, Aug 14, 2005 at 06:18:38PM -0500, Dave Rolsky wrote:
 
 I'm very much wishing that P::V can disappear entirely in Perl6, and I'm 
 probably going to confirm that on the p6l list, because in the end it's 
 just a nasty hack.

I find P::V quite useful, and more elegant that the longer-winder
parameter processing I've done as an alternative. I, too, I am looking
forward to enhancements in this area in Perl 6.

Mark

-- 
http://mark.stosberg.com/