develooper Front page | perl.perl5.porters | Postings from February 2011

Re: [PATCH 1/3] get rid of huge swathes of repetitive code in POSIX.pm

Thread Previous | Thread Next
From:
Eirik Berg Hanssen
Date:
February 1, 2011 09:17
Subject:
Re: [PATCH 1/3] get rid of huge swathes of repetitive code in POSIX.pm
Message ID:
AANLkTinooto2psDfhOTrjTB-H4foOmS4Fza4PaZ--yk4@mail.gmail.com
On Tue, Feb 1, 2011 at 4:56 PM, Aristotle Pagaltzis <pagaltzis@gmx.de>wrote:

> * John Imrie <j.imrie@virginmedia.com> [2011-01-31 20:35]:
> > On 31/01/2011 10:20, Aristotle Pagaltzis wrote:
> > >* Dagfinn Ilmari Mannsåker<ilmari@ilmari.org>  [2011-01-31 10:45]:
> > >>Aristotle Pagaltzis<pagaltzis@gmx.de>  writes:
> > >>
> > >>>+    if (my $how = $replacement{$func}) {
> > >>>+  croak "Unimplemented: POSIX::$func() is C-specific, stopped" if not
> defined $how
>

  And how would that come to pass?  Tied variables?  Cosmic radiation? :)

  Assignment of undef is usually false.  Sounds like you want to distinguish
between undef from an existing key, and undef from a missing key.  So ....

if (exists $replacement{$func}) {
  my $how = $replacement{$func};


> I do like that it makes naming the value unnecessary, though.
>

  Ah.

if (exists $replacement{$func}) {
  my $_ = $replacement{$func};


  ;)


Eirik

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About