The following module was proposed for inclusion in the Module List:
modid: Sub::Usage
DSLIP: bdpfp
description: Issue subroutine/module usage
userid: HASANT (Hasanuddin Tamir)
chapterid: 3 (Development_Support)
communities:
comp.lang.perl.modules
similar:
rationale:
Sub::Usage supercedes my previous submission on registering
Usage::Sub. They're still the same module, though. Matthew Sachs in
clpmodules pointed me to the Sub root namespace and suggested to
rename the module, so here is, Sub::Usage.
Sub::Usage is a subroutine utility. I've seen a lot of people
checking the subroutine arguments and terminate the subroutine if
it's called with inappropriate parameters. For example,
# takes two required and one optional args sub func { @_ >= 2 or
die "usage: func(ONE, TWO [, THREE])\n"; # process goes on }
This module provides functions to help printing the usage without
having to remember or typing the function name. The usage() function
will confess; warn_hard() and warn_soft() cluck then return undef.
Well, warn_soft() will check for the value fo $^W first. Examples,
usage Sub::Usage ':all';
# takes two required and one optional parameters sub turn_on { @_
>= 2 or usage 'NAME, COLOR [, INTENSITY]'; # process goes on }
The error message usage() will produce is something like,
usage: turn_on(NAME, COLOR [, INTENSITY]);
enteredby: HASANT (Hasanuddin Tamir)
enteredon: Mon Feb 25 17:01:58 2002 GMT
The resulting entry would be:
Sub::
::Usage bdpfp Issue subroutine/module usage HASANT
Thanks for registering,
The Pause Team
PS: The following links are only valid for module list maintainers:
Registration form with editing capabilities:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=2b000000_5c08e7007e63acb4&SUBMIT_pause99_add_mod_preview=1
Immediate (one click) registration:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=2b000000_5c08e7007e63acb4&SUBMIT_pause99_add_mod_insertit=1