Skip to content

Commit f5f915a

Browse files
committed
Added usage statements to Attribute.pod and Backtrace/Frame.pod
1 parent 462ad11 commit f5f915a

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

lib/Type/Attribute.pod

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,49 +34,91 @@ The usual way to obtain an object of type C<Attribute> is by introspection:
3434
3535
=head2 method name
3636
37+
Defined as:
38+
3739
method name(Attribute:D:) returns Str:D
3840
41+
Usage:
42+
43+
ATTRIBUTE.name
44+
3945
Returns the name of the attribute. Note that this is always the private name,
4046
so if an attribute is declared as C<has $.a>, the name returned is C<$!a>.
4147
4248
=head2 method package
4349
50+
Defined as:
51+
4452
method package(Attribute:D:) returns Mu:U
4553
54+
Usage:
55+
56+
ATTRIBUTE.package
57+
4658
Returns the package (class/grammar/role) to which this attribute belongs.
4759
4860
=head2 method has-accessor
4961
62+
Defined as:
63+
5064
method has-accessor(Attribute:D:) returns Bool:D
5165
66+
Usage:
67+
68+
ATTRIBUTE.has-accessor
69+
5270
Returns C<True> if the attribute has a public accessor method.
5371
5472
=head2 method readonly
5573
74+
Defined as:
75+
5676
method readonly(Attribute:D:) returns Bool:D
5777
78+
Usage:
79+
80+
ATTRIBUTE.readonly
81+
5882
Returns C<True> for readonly attributes, which is the default.
5983
Returns C<False> for attributes marked as C<is rw>.
6084
6185
=head2 method type
6286
87+
Defined as:
88+
6389
method type(Attribute:D:) returns Mu
6490
91+
Usage:
92+
93+
ATTRIBUTE.type
94+
6595
Returns the type constraint of the attribute.
6696
6797
=head2 method get_value
6898
99+
Defined as:
100+
69101
method get_value(Attribute:D: Mu $instance)
70102
103+
Usage:
104+
105+
ATTRIBUTE.get_value
106+
71107
Returns the value stored in this attribute of object C<$instance>.
72108
73109
Note that this method violates encapsulation of the object, and should be
74110
used with care. Here be dragons.
75111
76112
=head2 method set_value
77113
114+
Defined as:
115+
78116
method set_value(Attribute:D: Mu $instance, Mu \new_val)
79117
118+
Usage:
119+
120+
ATTRIBUTE.set_value
121+
80122
Binds the value C<new_val> to this attribute of object C<$instance>.
81123
82124
Note that this method violates encapsulation of the object, and should be

lib/Type/Backtrace/Frame.pod

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,46 +12,88 @@ A single backtrace frame. It identifies a location in the source code.
1212
1313
=head2 method file
1414
15+
Defined as:
16+
1517
method file(Backtrace::Frame:D) returns Str
1618
19+
Usage:
20+
21+
FRAME.file
22+
1723
Returns the file name.
1824
1925
=head2 method line
2026
27+
Defined as:
28+
2129
method line(Backtrace::Frame:D) returns Int
2230
31+
Usage:
32+
33+
FRAME.line
34+
2335
Returns the line number (line numbers start to count from 1).
2436
2537
=head2 method code
2638
39+
Defined as:
40+
2741
method code(Backtrace::Frame:D)
2842
43+
Usage:
44+
45+
FRAME.code
46+
2947
Returns the code object into which C<.file> and C<.line> point, if available.
3048
3149
=head2 method subname
3250
51+
Defined as:
52+
3353
method subname(Backtrace::Frame:D) returns Str
3454
55+
Usage:
56+
57+
FRAME.subname
58+
3559
Returns the name of the enclosing subroutine.
3660
3761
=head2 method is-hidden
3862
63+
Defined as:
64+
3965
method is-hidden(Backtrace::Frame:D) return Bool:D
4066
67+
Usage:
68+
69+
FRAME.is-hidden
70+
4171
Returns C<True> if the frame is marked as hidden with the
4272
C<is hidden-from-backtrace> trait.
4373
4474
=head2 method is-routine
4575
76+
Defined as:
77+
4678
method is-routine(Backtrace::Frame:D) return Bool:D
4779
80+
Usage:
81+
82+
FRAME.is-routine
83+
4884
Return C<True> if the frame point into a routine (and not
4985
into a mere L<Block>).
5086
5187
=head2 method is-setting
5288
89+
Defined as:
90+
5391
method is-setting(Backtrace::Frame:D) return Bool:D
5492
93+
Usage:
94+
95+
FRAME.is-setting
96+
5597
Returns C<True> if the frame is part of a setting.
5698
5799
=end pod

0 commit comments

Comments
 (0)