in reply to Google Translator -> wxPerl frontend
my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_ +; $parent = undef unless defined $parent; $id = -1 unless defined $id; $title = "" unless defined $title; $pos = wxDefaultPosition unless defined $pos; $size = wxDefaultSize unless defined $size; $name = "" unless defined $name;
Perl now has the // operator which would simplify that to:
my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_ +; $parent //= undef; $id //= -1; $title //= ""; $pos //= wxDefaultPosition; $size //= wxDefaultSize; $name //= "";
Although I don't see much point in assigning undef to a variable that already contains undef?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Google Translator -> wxPerl frontend
by Swalif (Scribe) on Oct 03, 2010 at 18:13 UTC | |
by Swalif (Scribe) on Oct 03, 2010 at 21:29 UTC | |
by Swalif (Scribe) on Oct 04, 2010 at 10:26 UTC | |
by Anonymous Monk on Oct 04, 2010 at 12:12 UTC | |
by Swalif (Scribe) on Oct 04, 2010 at 17:17 UTC | |
| |
by Anonymous Monk on Oct 04, 2010 at 13:59 UTC | |
Re^2: Google Translator -> wxPerl frontend
by Anonymous Monk on Oct 04, 2010 at 12:06 UTC | |
by Swalif (Scribe) on Oct 08, 2010 at 15:43 UTC |
In Section
Cool Uses for Perl