Toby Inkster
- Website: tobyinkster.co.uk/
- About: I'm tobyink on CPAN, IRC and PerlMonks.
Recent Actions
-
Commented on Augment and Inner: Haters Gotta Hate
I've written a MooX::Augment module. It has issues, but then again so does the Moose implementation....
-
Commented on Indented comments
PS: one good reason to avoid unnecessary comments is that if you have too many comments you tend to forget about them. When you update some code, you might forget to update the comment, and they fall out of sync....
-
Commented on Indented comments
Given this example: # Bless ourselves into the desired class and perform any # initialization. bless $self, $class; $self->initialize(); return $self; I would format the comments like this: bless $self, $class; $self->initialize; return $self; If you use relatively short functions...
-
Commented on Ludic Perl
There's also: The CPAN “Once a Week, Every Week” Contest "Longest Streak" and "Current Streak" on GitHub profiles (not Perl-specific) PerlMonks: Saints in our Book and PerlMonks: Best Nodes Play Perl/Questhub.io also makes it easy to gamify other sites that...
-
Commented on On Codifying Conduct
"Yes, in theory.No, in practice." In theory, everything that works in theory should work in practice. In practice......
-
Commented on Reverse debugging with gdb
Surely "reverse debugging" is the process of inserting bugs into your code?!...
-
Commented on The clearest way(s) to check if a List contains...
Smart match in 5.10.0 was pretty broken. From 5.10.1 to 5.18, the behaviour has been fairly consistent, with the exception of a couple of bugs around tainting and array slices being fixed. From 5.18, if warnings are enabled, using smart...
-
Commented on Type::Tiny - not just for attributes
Attribute::Contract looks interesting. I've shied away from adding sub attribute declaration (or something like Method::Signatures-style declaration) from Type::Params so far, because I've been unable to find a pleasant way to map string type names (e.g. "Str") to the underlying type...
-
Commented on Improved autobox-ing. I'm loving it :o)
I'm a big fan of PerlX::MethodCallWithBlock. I'd love to see it become part of standard Perl syntax. Another module it works very nicely with is XML::LibXML::NodeList....
-
Posted Type::Tiny - not just for attributes to Toby Inkster
OK, so I've gotten back from the May Day parade, had some lunch, and now it's time for me to write about Type::Tiny some more...
-
Commented on [FAILED] 10x faster than LibXML
I wonder how many of these speed benefits could be retained if PugiXML were used as an alternative parser for XML::LibXML. That is, turn PugiXML parsing events into XML::LibXML::Node objects....
-
Commented on Reviewing web frameworks
Once you've got the details of the app worked out, I might have a go at implementing it minus any frameworks, running on plain old Plack....
-
Commented on Dangling Definitions
While I agree in general, there are exceptions to this. Sometimes you need to declare a variable before its definition for scoping purposes. For example... sub get_all_results_from_iterator { my $iter = shift; my @results; # hanging definition if (blessed($iter) and...
-
Commented on Travis CI ♥ Perl
Thanks for writing this. Inspired by this article, I decided to set up Travis-CI for one of my current projects. Although I don't use Dist::Zilla, the author-side dependencies for my build system are complex enough that I wouldn't want Travis-CI...
-
Posted Thought for the day: Perl 5 is English; Perl 6 is Esperanto. to Toby Inkster
Esperanto may be a saner language than English in every way.
But English is the language of Shakespeare, of Milton, of Byron, of Dylan Thomas; the language of Arthur Conan-Doyle and Agatha Christie; the language of Tolkien and C S Lewis; of Lewis Carroll and Beatrix Potter. It's the langua…
-
Commented on Perl 5.18: getline and $/ = \N
Seems good to me. Using $/ = \$int and character strings seems like a weird thing to do to begin with, but for those people who do need to do this, I can't imagine the current behaviour is useful for...
-
Commented on Introducing Type::Tiny
Type::Tiny constraints are immutable, but coercions are not. There is an implementation of immutable coercions in the repo, but it didn't land until after the 0.001 "feature freeze". First stable release with immutable coercions is likely to be 0.004, but...
-
Commented on Introducing Type::Tiny
I've had a quick try, and yes, it seems to. The only major Moose-has-this feature missing from Type::Tiny is that Type::Tiny doesn't have a type registry, which means there's no global mechanism for looking up a type constraint from its...
-
Posted Introducing Type::Tiny to Toby Inkster
Type::Tiny is a tiny (no non-core dependencies) framework for building type constraints. OK, probably not that exciting. How can I grab your attention?
="highlight…
-
Commented on OI::M::Finally({IO::All})
This seems to suggest that it's theoretically doable: perl -e'use overload ">" => sub { use Data::Dumper; print Dumper \@_ }; my @a; my $o = bless []; $o > \@a' The overload sub clearly gets passed an arrayref; the...
-
Commented on What does this PHP print?
#!perl if (0 == "zero") { print "welp\n"; } In both the PHP and Perl versions, it's down to a poor choice of operator. In Perl you probably meant 0 eq "zero"; in PHP you probably wanted 0 ===...
-
Commented on What does this PHP print?
Also PHP has had a "switch" statement since forever. Whatsmore, the optional braces make an if/elseif/.../else chain in PHP much more appealing than it is in Perl....
-
Commented on How do we know when a CORE module is deprecated?
I've just started a CGI.pm-based project; not because I think CGI is great, but because I need to use a module that expects to be passed a blessed CGI object. Anybody know of a good way to mock one of...
-
Commented on Introducing Platform
You could take a look at GETTY's Alien::ffmpeg and Alien::mpg123. These distributions will actually build the relevant binary and stash it somewhere in @INC. You can then query the module to get the path to the binary. Of course you...
-
Commented on The CPAN Unknown Usage problem
I have a rudimentary web service now using Bitcard for login. I'll report back shortly....
-
Commented on Introducing Platform
It's about the same as saying "I can run with LWP::UserAgent or HTTP::Tiny". (i.e. not pretty.) With Module::Install that would be something like: dynamic_config; requires "LWP::UserAgent" => 0 unless eval { require HTTP::Tiny }; If you thought it was a...
-
Posted Introducing Platform to Toby Inkster
So, what's the big idea?
… -
Commented on The CPAN Unknown Usage problem
Here's a Perl equivalent of Debian's "popcon": https://gist.github.com/tobyink/5161085 Now we just need a web service to pump the data to and analyse it. :-) (I suppose we should also reduce that script's non-core deps to avoid skewing results towards the...
-
Commented on The sad state of syntax highlighting libraries on CPAN
PPI::HTML is very, very good, but only highlights Perl code of course....
-
Commented on What would Psychic::Ninja do?
Not dress in black....
Comment Threads
-
mascip commented on
Indented comments
Since i read Perl Best Practices (pages 23 and 142),
I find it really useful.I keep most paragraphs under 5 lines, and most methods under 5 paragraphs. The comments tell a story.
Sticking to this format, the code is bound to be readable. It helps me :
- remember the logic of an algorithm, by reading only few lines of a well-expressed story,
- find faster, which part of the code i need to modify for a specific purpose,
- identify clogged part of the code e… -
mascip commented on
Indented comments
PS: like educated_foo, i use comments only to express the purpose of the paragraph. Not implementation details. Reading only the comments, you should understand what my code does.
-
Aristotle commented on
Indented comments
The way I see comments is: they are not there to say what the code is for or is supposed to – that’s what documentation is for; they are also not there to say how the code does it – the code itself should make that clear; but if after understanding what the code is for and how it goes about, your first thought would be “why on Earth does it do it this way, when it would be so much more understandable/less work/more robust/etc to do in this more obvious way”, and if the original author of the code had a good reason not to do it that way…
-
Aristotle commented on
Indented comments
Or to put it another way, the point of a comment is to stop the next maintenance programmer from trying to “improve” the code without awareness of whatever specific reason was behind the strangeness.
(There is also a converse at work here: it tells the maintenance programmer to check if that reason still holds, and if not, to clean up the code accordingly. The trivial case of this is the well-known FIXME.)
-
Buddy Burden commented on
Augment and Inner: Haters Gotta Hate
@mascip: Yes, you're right that in the second example a role would work as well. I believe the only advantage of augment in that case would be to save you an extra entity. If you needed to do that sort of thing more than once, the role would clearly be superior. If you only needed to do it the one time, one could make the argument that just keeping it in the existing class is simpler than spreading out the code across multiple entites, and possibly multiple files, causing readers to have jump back and forth between things to get the whole picture.
But the role is certainly a great…
About blogs.perl.org
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is run by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.