# New Ticket Created by Ricardo SIGNES
# Please include the string: [perl #115658]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=115658 >
I like that I can easily get a list of methods on a value:
> my $x = []; say $x.^methods
new bind_pos delete flattens REIFY STORE_AT_POS STORE PARAMETERIZE_TYPE
at_pos perl new Bool Int end fmt flat list lol flattens tree Capture Parcel
eager elems exists gimme infinite iterator munch pick pop roll reverse
rotate shift splice sort classify categorize uniq REIFY STORE_AT_POS
FLATTENABLE_LIST FLATTENABLE_HASH keys values pairs kv reduce of Numeric
Str at_pos push unshift ACCEPTS gist perl DUMP elems infinite item fmt Int
Num chrs Numeric Str
It doesn't work on a Sub.
> my $x = sub {}; say $x.^methods
Method 'gist' not found for invocant of class 'Sub'
my $x = sub {}; say $x.^methods.flat
Method 'Stringy' not found for invocant of class 'Sub'
> my $x = sub {}; say $x.^methods.^methods
Parcel Capture elems item flat list lol at_pos postcircumfix:<[ ]> STORE
FLATTENABLE_LIST FLATTENABLE_HASH fmt of Bool Numeric Str ACCEPTS gist perl
DUMP
> my $x = sub {}; say $x.^methods.perl
Method 'perl' not found for invocant of class 'Sub'
> my $x = sub {}; say $x.^methods.DUMP
maximum recursion depth exceeded
There are 40 of them, though:
> my $x = sub {}; $x.^methods.elems
40
--
rjbs