Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added usage statements to Attribute.pod and Backtrace/Frame.pod
  • Loading branch information
dha committed Oct 4, 2015
1 parent 462ad11 commit f5f915a
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 0 deletions.
42 changes: 42 additions & 0 deletions lib/Type/Attribute.pod
Expand Up @@ -34,49 +34,91 @@ The usual way to obtain an object of type C<Attribute> is by introspection:
=head2 method name
Defined as:
method name(Attribute:D:) returns Str:D
Usage:
ATTRIBUTE.name
Returns the name of the attribute. Note that this is always the private name,
so if an attribute is declared as C<has $.a>, the name returned is C<$!a>.
=head2 method package
Defined as:
method package(Attribute:D:) returns Mu:U
Usage:
ATTRIBUTE.package
Returns the package (class/grammar/role) to which this attribute belongs.
=head2 method has-accessor
Defined as:
method has-accessor(Attribute:D:) returns Bool:D
Usage:
ATTRIBUTE.has-accessor
Returns C<True> if the attribute has a public accessor method.
=head2 method readonly
Defined as:
method readonly(Attribute:D:) returns Bool:D
Usage:
ATTRIBUTE.readonly
Returns C<True> for readonly attributes, which is the default.
Returns C<False> for attributes marked as C<is rw>.
=head2 method type
Defined as:
method type(Attribute:D:) returns Mu
Usage:
ATTRIBUTE.type
Returns the type constraint of the attribute.
=head2 method get_value
Defined as:
method get_value(Attribute:D: Mu $instance)
Usage:
ATTRIBUTE.get_value
Returns the value stored in this attribute of object C<$instance>.
Note that this method violates encapsulation of the object, and should be
used with care. Here be dragons.
=head2 method set_value
Defined as:
method set_value(Attribute:D: Mu $instance, Mu \new_val)
Usage:
ATTRIBUTE.set_value
Binds the value C<new_val> to this attribute of object C<$instance>.
Note that this method violates encapsulation of the object, and should be
Expand Down
42 changes: 42 additions & 0 deletions lib/Type/Backtrace/Frame.pod
Expand Up @@ -12,46 +12,88 @@ A single backtrace frame. It identifies a location in the source code.
=head2 method file
Defined as:
method file(Backtrace::Frame:D) returns Str
Usage:
FRAME.file
Returns the file name.
=head2 method line
Defined as:
method line(Backtrace::Frame:D) returns Int
Usage:
FRAME.line
Returns the line number (line numbers start to count from 1).
=head2 method code
Defined as:
method code(Backtrace::Frame:D)
Usage:
FRAME.code
Returns the code object into which C<.file> and C<.line> point, if available.
=head2 method subname
Defined as:
method subname(Backtrace::Frame:D) returns Str
Usage:
FRAME.subname
Returns the name of the enclosing subroutine.
=head2 method is-hidden
Defined as:
method is-hidden(Backtrace::Frame:D) return Bool:D
Usage:
FRAME.is-hidden
Returns C<True> if the frame is marked as hidden with the
C<is hidden-from-backtrace> trait.
=head2 method is-routine
Defined as:
method is-routine(Backtrace::Frame:D) return Bool:D
Usage:
FRAME.is-routine
Return C<True> if the frame point into a routine (and not
into a mere L<Block>).
=head2 method is-setting
Defined as:
method is-setting(Backtrace::Frame:D) return Bool:D
Usage:
FRAME.is-setting
Returns C<True> if the frame is part of a setting.
=end pod

0 comments on commit f5f915a

Please sign in to comment.