The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Devel::PerlySense::Document::Api - The methods (and their locations) of a package

DESCRIPTION

An API is the methods/subs a module/package supports (or in some cases _may_ support).

PROPERTIES

rhSub

Hash ref with (keys: method/sub name; values: Document::Location objects).

Default: {}

The Location objects have a sub property which is the name of the sub.

API METHODS

new()

Create new Api object.

aNameSubVisible(oPerlySense => $oPs, fileCurrent => $file)

Return array with the method/sub names in the interface that are visible.

A method is invisible if it's a private method in a base class of $fileCurrent, outside the current Project, according to $oPerlySense.

isSubVisible($oPerlySense, $fileCurrent, $nameSub)

Return true if the Sub name is visibl, else false.

A sub/method is invisible if it's a private method in a base class of $fileCurrent, outside the current Project, according to $oPerlySense.

rsSortSub($fileCurrent)

Return sub ref for sorting sub names of this Api, using the rhSub property and given the $fileCurrent.

parsePackageSetSub(raNodeSub => $raNodeSub, source => $source, oDocument => $oDocument)

Parse the entire package data, both $source and found method nodes. Add both found subs and $raNodeSub to the rhSub property.

Return 1 or die on errors.

parseSourceSetSub(source => $source, oDocument => $oDocument)

Parse the $source, looking for $self->method calls, and $self->{hash_key}, and add them to the rhSub property.

Return 1 or die on errors.

oLocationSetSub(nameSub => $nameSub, oDocument => $oDocument, [oNode => $oNode])

Set the $self->rhSub->{$nameSub} to a new Document::Location with $oDocument and possibly a row/col for $oNode. Set the rhProperty for:

  sub

If no $oNode is passed, the location is supposed to be unknown, with row/col: 0/0.

Return the new oLocation. Die on errors.

mergeWithBase($oApiBase)

Adjust this object by adding appropriate parts of $oApiBase, i.e. the methods in $oApiBase->rhSub that aren't overridden in this class.

If a method has no row/col in neither base or self, it's supposed to be defined in the base class. Any method definition with row/col in self overrides one in base.

Return 1 on success. Die on errors.

isSubSupported($nameSub)

Return true if $nameSub is supported by this API, else false.

percentSupportedOf($raNameSub)

Return percent (0..100) of how many of the sub names in raNameSub that are present in the api.

percentConsistsOf($raNameSub)

Return percent (0..100) of how much of the api consists of the sub names in raNameSub.

I.e. a large API will have a low percentage. Extra sub names in $raNameSub will not affect the percentage.

AUTHOR

Johan Lindstrom, <johanl@cpan.org>

BUGS

Please report any bugs or feature requests to bug-devel-perlysense@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Devel-PerlySense. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2005 Johan Lindstrom, All Rights Reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.