in reply to (updated) Perl6::FH

Very nice, very nice...

One thing I noticed, and I don't know if this comes down to coding style, personal preference, or a significant syntax problem:

return bless [ undef, 1, @_ == 3 ? $sep : () ], "${class}::ARGV" if $real == \*ARGV; ... bless [ $fh, (@_ == 3 ? $sep : ()) ], $class;
The use of "@_ == 3" to determine the existence of the optional 3rd parameter seems to be a bit questionable. I would think that using "defined( $sep )" would be a better choice, as even if I called this function with more than 3 arguements, I know that the 4th and beyond would be ignored, but the function still takes in the 3rd. In your fashion, 4 arguements would prevent the third from being used. Am I missing something in this usage?


Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain

Replies are listed 'Best First'.
Re: Re: (updated) Perl6::FH
by japhy (Canon) on Jun 28, 2001 at 20:47 UTC
    No, I can't test for definedness, or else I'd never be able to say is_chomped FH undef for slurping mode. Granted, slurping mode doesn't require chomp()ing, but that doesn't mean I should neglect the user's wishes.

    japhy -- Perl and Regex Hacker
      Then why not use something like "@_ >= 3", as opposed to "@_ == 3"? Again, I guess what I'm asking is more style than function...


      Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain