in reply to Re: What if Perl had an OO standard library?
in thread What if Perl had an OO standard library?

:bow: @YourMother. Thanks for the kind words. Here's some cool stuff I haven't blogged about yet that you can do with Venus:

# throw exceptions easily
Venus::Path->new('/path/to/nowhere')->throw->error({message => 'Missin +g file'}) "Missing file"
# catch exceptions easily
Venus::Path->new('/path/to/nowhere')->catch('open')->message "Can't open /path/to/nowhere: No such file or directory"
# determine and call methods on each item in an array
Venus::Array->new(['a'..'d'])->call('map', 'uppercase'); [ 'A', 'B', 'C', 'D' ]
# use indirect dispatching to nest calls (in this case, on each item in an array)
Venus::Array->new(['a'..'d'])->call('map', 'box', 'uppercase'); [ bless({'value' => bless({'value' => 'A'}, 'Venus::String')}, 'Venus: +:Box'), bless({'value' => bless({'value' => 'B'}, 'Venus::String')}, 'Venus: +:Box'), bless({'value' => bless({'value' => 'C'}, 'Venus::String')}, 'Venus: +:Box'), bless({'value' => bless({'value' => 'D'}, 'Venus::String')}, 'Venus: +:Box ) ]
# use MORE POWER and force return an "autoboxing" object so you can continue chaining things
Venus::Array->new(['a'..'d'])->box('call', 'map', 'box', 'uppercase'); bless({'value' => bless({'value' => [ bless({'value' => bless({'value' => 'A'}, 'Venus::String')}, 'Venus: +:Box'), bless({'value' => bless({'value' => 'B'}, 'Venus::String')}, 'Venus: +:Box'), bless({'value' => bless({'value' => 'C'}, 'Venus::String')}, 'Venus: +:Box'), bless({'value' => bless({'value' => 'D'}, 'Venus::String')}, 'Venus: +:Box ) ]}, 'Venus::Array')}, 'Venus::Box'});
"I am inevitable." - Thanos