Browse files

[S06] make MAIN short switches a bit saner

The variable name of a parameter is purely an implementation detail
of the subroutine, and shouldn't be a concern while parsing command line
arguments. Instead rely on already existing alias syntax for named parameters.

git-svn-id: c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent 6583a32 commit f1690bd307abfbd39dca2cd14e7f89f36ba0bc36 moritz committed Aug 13, 2010
Showing with 5 additions and 4 deletions.
  1. +5 −4 S06-routines.pod
@@ -3279,11 +3279,12 @@ parameters, just as any C<Match> object would. Of course, in this example,
there's no particular reason the sub has to be named C<MAIN>.
To give both a long and a short switch name, you may use the pair
-notation. The key will be considered the short switch name, while
-the variable name will be considered the long switch name. So if
-the previous declaration had been:
+notation to install several names for the same parameter.
+If any of the names is a single character, it will be considered a
+short switch name, while all other parameters names are considered
+as long switch name. So if the previous declaration had been:
- sub MAIN (:f($frompart), :t($topart), *@rest)
+ sub MAIN (:f(:$frompart), :t(:$topart), *@rest)
then you could invoke the program with either C<-f> or C<--frompart>
to specify the first parameter. Likewise you could use either C<-t>

0 comments on commit f1690bd

Please sign in to comment.