On 31/01/2011 10:20, Aristotle Pagaltzis wrote: > Hi Dagfinn, > > * 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; >>> + croak "Unimplemented: POSIX::$func() $$_" if ref $how; >>> + croak "Use method $_() instead of POSIX::$func()" if $how =~ /->/; >>> + croak "Unimplemented: POSIX::$func() is C-specific, use $_ instead"; >>> + } >> s/\$_/\$how/g ? > woops, good catch. Thanks for the feedback. It’ll be fixed when > I send the patches to perlbug. > > Regards, Isn't this a good candidate for a given/when construct? given ($replacement{$func}) { when (! defined) { croak "Unimplemented: POSIX::$func() is C-specific, stopped"; } when (ref) { croak "Unimplemented: POSIX::$func() $$_"; } when (/->/) { croak "Use method $_() instead of POSIX::$func()"; } default { croak "Unimplemented: POSIX::$func() is C-specific, use $_ instead"; } }Thread Previous | Thread Next