Tad said:
There is no Perl content in your question you know...
Have a coffee first next time :-D
Found this:
http://support.packeteer.com/documentation/packetguide/current/info /
cli-conventions.htm
on the 1st page of results from googling for "usage conventions".
If I grep on 'usage: in C:\Perl I get 169 occurences.
e.g
:
lib\Net\NNTP.pm(228): @_ == 1 or croak 'usage: $nntp->help()';
lib\Net\NNTP.pm(238): @_ >= 2 or croak 'usage: $nntp->ihave( MESSAGE-ID
[, MESSAGE ])';
:
Does it now ring a bell or two?
I clearly stated in the subject: *croak* in *METHODS*
Where on Earth did you get that CLI idea from?
I mean, the part in the croak (the code I gave) was also a giveaway, or
did you think $bla-> is my CLI prompt?
Reread before you post.
Back to my original question, is there a convention of specifying
parameters, especial optional parameters in a croak 'usage: ' in a
method.
In for example:
sub send {
@_ >= 2 && @_ <= 4
or croak 'usage: $sock->send(BUF, [FLAGS, [TO]])';
my $sock = $_[0];
my $flags = $_[2] || 0;
my $peer = $_[3] || $sock->peername;
:
sub recv {
@_ == 3 || @_ == 4
or croak 'usage: $sock->recv(BUF, LEN [, FLAGS])';
my $sock = $_[0];
my $len = $_[2];
my $flags = $_[3] || 0;
(from IO::Socket)
the notation is inconsistent and confusing.