Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Standard method for documenting AUTOLOAD methods in pod

by nysus (Parson)
on Sep 03, 2019 at 00:39 UTC ( [id://11105491]=note: print w/replies, xml ) Need Help??


in reply to Re: Standard method for documenting AUTOLOAD methods in pod
in thread Standard method for documenting AUTOLOAD methods in pod

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

  • Comment on Re^2: Standard method for documenting AUTOLOAD methods in pod

Replies are listed 'Best First'.
Re^3: Standard method for documenting AUTOLOAD methods in pod
by Corion (Patriarch) on Sep 03, 2019 at 07:06 UTC

    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; }

      OK, good to know. But how I properly document in my POD? Is there a standard practice for this? The methods are dictated by the user who is using his own custom classes so there is no way for me to know what these methods are going to be actually named.

      $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

        I would try document the behaviour. Maybe something like:

        =head1 Handling of file classification For every file category as found via C<< ->find_categories >>, the module provides a function C<< find_FILE_CATEGORY_files >>. In the below example, the C<< get_cats_files(...) >> function returns all files in the C<< cats >> category: my $cat = find_category_for_file( 'myfile_cats.txt' ); # cats print for get_cats_files('/*'); # myfile_cats.txt myfile2_cats.txt ...

        Personally, while AUTOLOAD is enticing, why not make the category a real parameter instead? Otherwise, the programmers will have no good way of passing an arbitrary category to your code.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11105491]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-25 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found