File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,33 @@ C<CORE>). The current package is searched last.
132
132
Use the C < MY > pseudopackage to limit the lookup to the current lexical scope,
133
133
and C < OUR > to limit the scopes to the current package scope.
134
134
135
+ In the same vein, class and method names can be interpolated too.
136
+
137
+ role with-method {
138
+ method a-method { return "in-a-method of " ~ $?CLASS.^name };
139
+ }
140
+
141
+ class a-class does with-method {
142
+ method another-method { return 'in-another-method' };
143
+ }
144
+
145
+ class b-class does with-method {};
146
+
147
+ my $what-class='a-class';
148
+
149
+ say ::($what-class).a-method;
150
+ $what-class = 'b-class';
151
+ say ::($what-class).a-method;
152
+
153
+ my $what-method='a-method';
154
+ say a-class."$what-method"();
155
+ $what-method='another-method';
156
+ say a-class."$what-method"();
157
+
158
+ X < |::($c).m >
159
+ X < |A."$m"() >
160
+
161
+
135
162
= head2 Direct lookup
136
163
137
164
To do direct lookup in a package's symbol table without scanning, treat the
You can’t perform that action at this time.
0 commit comments