James
Recent Actions
-
Commented on The Hidden Power of Prototypes
another interesting/useful prototype is `*`, A "*" allows the subroutine to accept a bareword, constant, scalar expression, typeglob, or a reference to a typeglob in that slot. The value will be available to the subroutine either as a simple scalar,...
-
Commented on Creating a Simple DSL in Perl
I prefer fewer braces if i were designing this DSL, something like this playlist { title "80's Music"; track location "https://example.com/music/01.mp3", title "Take On Me", creator "A-ha"; track location "https://example.com/music/02.mp3", title "Tainted Love", creator "Soft Cell"; track location "https://example.com/music/03.mp3", title...
-
Commented on TPF launches merch store for Perl 5
So raptors then? Not onions or camels?...
-
Commented on Do-It-Yourself <code>warnings</code> categories
worth noting is that warnings::register taking a list of subcategories is 5.14+ only, and that warnings::register_categories(@categories) can be used to register categories without needing them to be attached to a module (also 5.14+)...
-
Commented on Subject Verb Object notation; declarative Perl without the framework
When you call a fully qualified method name like File::save, the method resolution search for the save method starts in the File class, skipping any save method the File::MP3 class may have defined. It still searches the File class's parents...
-
Commented on Desire for Perl wrapper of Mozilla's IoT platform
it always is, as they won't do it for us...
-
Commented on Paws for Fun and Profit. Part the First.
How feasible would it be to switch Paws to using Moo instead of Moose, to make it cost less when used in AWS Lambdas?...
-
Commented on TIL - Object Method: Named Arguments Unpacking
I always preferred my $self = shift; my %args = @_; to keep the parameters in @_ or the more paranoid (coping with named parameters in a hashref) my $self = shift; my %args = @_ == 1 ? %{$_[0]}...
-
Commented on Perl Module Tools (pmtools) v2.2.0 Released - Many RT Fixes
And the issue with the pfcat.t test on older perls...
-
Commented on An informal comparison of sparrow and ansible eco systems
What was the reason for the creation of sparrowdo in perl6 rather than perl5?...
-
Commented on Updated SQL BNFs from Jonathan Leffler
And the sql-bnf.tgz...
-
Commented on Updated SQL BNFs from Jonathan Leffler
Get 500 errors for bnf2html.pl script and WEBCODE tarball on that page...
Comment Threads
-
Aristotle commented on
TPF launches merch store for Perl 5
The raptor is a Mojo creation.
Incorrect. All three logos in fact go back to remarks by Larry, including the velociraptor.
The earliest reference to the velociraptor by Larry that I can find is in Apocalpyse 12, where he only mentions it as a joke. Matt Trout later attributed to him a quote that “perl5 is a velociraptor. What we need now is an acceloraptor” (i.e. Perl 6 (at the time)) – though I am unable to substantiate this…
-
Aristotle commented on
The Hidden Power of Prototypes
That seems interesting in the sense of “may you live in interesting times” 😛
Another possibly useful prototype is the underscore (“
_
”), which allows functions to default to$_
when given no argument, like e.g.chr
andhex
do. -
RonW commented on
The Hidden Power of Prototypes
I agree that prototypes are a very useful tool. Try::ALRM is genuinely useful and interesting.
I see the main limitation on prototypes being that & only coerces on the first parameter. I don't see a downside to & coercion on subsequent parameters. If the prototype says it should be a code ref, then if it looks like a block, treat it like a block, same as if the "sub" were there.
I don't see much advantage to Dispatch::Fu. While it adds a little syntactic sugar, it's really just an indirect way to do:
if ($cgi->param("action") eq q{foo} and $cgi->param("userid") !=…
-
Brett Estrade commented on
The Hidden Power of Prototypes
> I don't see much advantage to Dispatch::Fu. While it adds a little syntactic sugar, it's really just an indirect way to do...
That's the point, but it's more than sugar! The computational complexity of determining the dispatch "key" is entirely contained in the "dispatch" block and is under the control of the developer. Once the "key" is determined, the proper method is called as O(1)!
Thanks for all to good info above, didn't know bout the "_" allowing one to default to "$_" - I was actually wondering about that recently!
-
Brett Estrade commented on
The Hidden Power of Prototypes
I am not good at coming up with contrived examples as evidenced in this Perl Advent article,
https://perladvent.org/2023/2023-12-13.html
But a set of cascading "if" blocks is not the most exciting example. However, any code could go in there to compute the key to then "call".
About blogs.perl.org
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.