X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlfaq7.pod;h=bc2f4f66e7418276ad96c6dbe9fd7974799a24e5;hb=b41aadf259cf55858c5ab0386356cdbe2dc49a6b;hp=4c0c2f13878b0df9799f38e541087d23950bb428;hpb=109f04419ad154407413aa733c313fd77c1e12ca;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlfaq7.pod b/pod/perlfaq7.pod index 4c0c2f1..bc2f4f6 100644 --- a/pod/perlfaq7.pod +++ b/pod/perlfaq7.pod @@ -202,9 +202,6 @@ distributions. (contributed by brian d foy) -The full answer to this can be found at -http://cpan.org/modules/04pause.html#takeover - The easiest way to take over a module is to have the current module maintainer either make you a co-maintainer or transfer the module to you. @@ -437,37 +434,6 @@ using C: } $match = compare("old McDonald", qr/d.*D/i); -Notice how C allows flags at the end. That pattern was compiled -at compile time, although it was executed later. The nifty C -notation wasn't introduced until the 5.005 release. Before that, you -had to approach this problem much less intuitively. For example, here -it is again if you don't have C: - - sub compare($$) { - my ($val1, $regex) = @_; - my $retval = eval { $val1 =~ /$regex/ }; - die if $@; - return $retval; - } - - $match = compare("old McDonald", q/($?i)d.*D/); - -Make sure you never say something like this: - - return eval "\$val =~ /$regex/"; # WRONG - -or someone can sneak shell escapes into the regex due to the double -interpolation of the eval and the double-quoted string. For example: - - $pattern_of_evil = 'danger ${ system("rm -rf * &") } danger'; - - eval "\$string =~ /$pattern_of_evil/"; - -Those preferring to be very, very clever might see the O'Reilly book, -I, by Jeffrey Friedl. Page 273's -Build_MatchMany_Function() is particularly interesting. A complete -citation of this book is given in L. - =item Passing Methods To pass an object method into a subroutine, you can do this: @@ -688,7 +654,7 @@ see L. (contributed by brian d foy) Calling a subroutine as C<&foo> with no trailing parentheses ignores -the prototype of C and passes it the current value of the argumet +the prototype of C and passes it the current value of the argument list, C<@_>. Here's an example; the C subroutine calls C<&foo>, which prints what its arguments list: @@ -886,7 +852,7 @@ diagnostics as C does, use the C built-in: By default, your program starts in package C
, so you should always be in some package unless someone uses the C built-in with no namespace. See the C entry in L for the -details of empty packges. +details of empty packages. =head2 How can I comment out a large block of Perl code?