nysus has asked for the wisdom of the Perl Monks concerning the following question:

Wondering if there is a standard way for documenting AUTOLOAD methods in pod. Something like:

=head3 get_FILE_CLASSIFICATION_files()

Where "FILE_CLASSIFICATION" in the method call should be replaced by the file's category. Thanks!

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks

Replies are listed 'Best First'.
Re: Standard method for documenting AUTOLOAD methods in pod
by LanX (Saint) on Sep 02, 2019 at 23:52 UTC
    > Wondering if there is a standard way for documenting AUTOLOAD methods in pod.

    Why and how?

    Autoloads are non-standard by definition.

    The documentation depends on use-case and number.

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

Re: Standard method for documenting AUTOLOAD methods in pod
by Anonymous Monk on Sep 02, 2019 at 23:55 UTC

    Hi,

    Simply give an example the clever way knowing what you know ;)

    =head3 get_FILE_CLASSIFICATION_files() =head3 get_PHOTOS_files() =head3 get_ANIMALS_files() =head3 get_BEARDS_files() =head3 get_BEARDS_files( \%Options )

    But, why AUTOLOAD ? I thought AUTOLOAD was obsolete in favor of code generation ..

      Dunno. No one told me it was obsolete. It's still in the Perl code base. I don't know anything about automatic code generation.

      So user all uppercase as a placeholder is the standard method?

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
      $nysus = $PM . ' ' . $MCF;
      Click here if you love Perl Monks

        AUTOLOAD is not obsolete, especially if you're using it for generally "unknown" methods. The "usual" implementation of an AUTOLOAD subroutine then generates and installs the code (well, subroutine) to handle the specific case:

        sub AUTOLOAD { my $method = $AUTOLOAD; my $handler = sub { ... }; # Install the handler: no strict 'refs'; *{ $method } = $handler; goto &$handler; }