Toby Inkster

  • Commented on Private Moose Attributes
    Personally, I wouldn't make user, company, etc into attributes at all. Instead I'd write wrappers for the constructor: sub new_from_user { my ($class, $user) = @_; return $class->new( country => logic_to_determine_country(), language => logic_to_determine_language(), ); }...
  • Commented on Can you provide an x/y Point class in other languages?
    PHP 5... <?php class Point { public $x, $y; public function __construct ($x, $y) { $this->x = self::validate_number($x); $this->y = self::validate_number($y); } public function __toString() { return sprintf('[%d,%d]', $this->x, $this->y); } public static function validate_number ($n) { if (!is_numeric($n)) throw...
  • Commented on Fancy Matching of Delimited Text
    Have you considered bundling a Text::Balanced::Marpa::Compat module which re-implements the Text::Balanced API on top of it? The Text::Balanced API is frankly not great, but you might get more users if people have a simple drop-in replacement....
  • Commented on CPAN Cleaning Day 2457027: Changes and README
    Years ahead of you! ;-) Go to a SPARQL endpoint, and type in the following as the default graph URI (this is a link to a bunch of RDF data that I typically bundle with my distributions): And the...
  • Posted Book Report - December 2014 to Toby Inkster

    As you may be aware, I'm writing a book which will eventually become a free e-book. This is my third report on how I'm getting along.

  • Commented on The dream of "use 7;"
    This is even what perl -v says: This is perl 5, version 20, subversion 1 (v5.20.1) built for x86_64-linux-thread-multi...
  • Commented on The dream of "use 7;"
    Many people who want to be able to increment major versions for Perl have now compromised and decided that the second part of the version number is the major version. So the current stable Perl is "Version 20.1 of the...
  • Commented on Of course you can `requires` attributes!
    It works in Moo, but there are some bugs with requires and attributes in Moose. Demonstration... use v5.14; package AAA { use Moose::Role; requires 'b'; has 'a' => (is => 'ro'); } package BBB { use Moose::Role; requires 'a'; has...
  • Commented on mop minus proposal
    There are a lot of class/role frameworks, but the decision making process for which to use is actually very simple: Start with Moo, and if you outgrow it, use Moose. You can mostly forget about the others. Also there's Moops...
  • Commented on mop minus proposal
    Parse::Keyword has issues, but it is possible to work around them. (And I don't think Yuki Kimoto's code triggers the problems in Parse::Keyword anyway.)...
  • Posted Quick post-LPW roundup to Toby Inkster

    I've just arrived back from the London Perl Workshop. Lots of very interesting stuff. A big thank you to the organizers! I especially liked:

  • Extending Syntax - Functional Programming m…
  • Commented on Tonight’s folly
    Well, this is quite pretty: my @new = map { s/foo/bar/r } @old; Compared with the old way: my @new = map { (my $tmp = $_) =~ s/foo/bar/; $tmp } @old;...
  • Commented on Book Report - October 2014
    Just a couple of minutes after writing this blog entry, I got an e-mail saying my talk has been accepted. Yay!...
  • Posted Book Report - October 2014 to Toby Inkster

    This month has been quite a busy one for me, so I haven't had much chance to work on my (in-progress) book. However, I have had some time to start work on a short talk for London Perl Workshop 2014

  • Commented on Where is Brent?
    Have you tried contacting him via Columbia University, who are his present employers according to LinkedIn?...
  • Commented on A fast pragmatic test runner
    I wonder if this could be achieved with a lockfile of some kind? Test files that work in parallel try to open a shared lock on a particular file (say t/lock), and wait until they obtain the lock. Test files...
  • Commented on A most amusing annoyance
    In most (all?) Unix shells, a parameter can be partly quoted. For example: echo 'foo'bar'baz' will print out "foobarbaz". It is this feature that allows parameters like --foo="bar baz" to work, so it's a valuable feature. Anyway, with your command,...
  • Commented on Which modules are currently loaded by process?
    I like Devel::TraceUse. I've used it a lot developing Type::Tiny to help me figure out where I'm unnecessarily loading modules. However, unless I've missed a feature it does not tell you the full path of each module that has been...
  • Commented on Synchronizing Opera bookmarks with Perl, Org, and git
    I use Opera 12 on Linux. You know it has the ability to export bookmarks as HTML, using the same format Netscape used to use many moons ago. I believe it is mostly round-trippable....
  • Posted Exporter::Tiny nearing 1.000000 to Toby Inkster

    Yes, in my warped mathematics, 0.042 is nearly 1.000000.

  • Posted Planet Moose - September 2014 to Toby Inkster
  • Posted Book Report - September 2014 to Toby Inkster

    As you may be aware, I'm writing a book which will eventually become a free e-book. (Oh how I'm beginning to hate the e- prefix on everything vaguely related to computers. Or should I call them…

  • Commented on CPAN Testers & pre-requisite reporting
    The problem with these proposed solutions is that they assume that the release at fault is always going to be a trial one. I could release a seriously broken version of Exporter::Tiny as a stable release, and break a couple...
  • Commented on Event::Lib
    I'd suggest releasing 1.04 to CPAN straight away. As you're not the maintainer, it won't be officially indexed, so people won't be able to install it using: cpan Event::Lib Instead they'll need to install it like: cpan CRUX/Event-Lib-1.04.tar.gz Then, if...
  • Commented on Test::More has lots of crazy new development that's breaking my modules
    Exodist is making a lot of changes to the Test::More guts, which will hopefully lead to a much better Test::More. The aim is that the result should eventually be API-compatible with older Test::More. Because of the major changes, he's rightly...
  • Commented on Logically And Yourself (&&=)
    This is because the eval block isn't getting executed after the 4th iteration in your &&= case. You're effectively almost short-circuiting the loop. You could achieve a similar effect by inserting next unless $is_proofed; before the eval block in your...
  • Posted Object::Util to Toby Inkster

    I've recently released a new module called Object::Util to CPAN. This is a set of handy methods for working with classes and objects in Perl. It is inspired by

  • Commented on Install XML::LibXML without root
    The gist of how to patch XML::LibXML's Makefile.PL can be found in this ticket....
  • Commented on Install XML::LibXML without root
    A while back I created Alien::LibXML that installs a copy of libxml2 into one of your @INC paths. If you can install Perl modules, you can install it. Submitting a patch to XML::LibXML's Makefile.PL to check for Alien::LibXML has been...
  • Commented on Some new MetaCPAN features
    I really like the new version of the dashboard. Some suggestions: The bug counts could be a link to the issue tracker. Rather than using an "X" is those three centre columns, maybe use "R", "L", and "A". This is...
  • Subscribe to feed Recent Actions from Toby Inkster

    • commented on An example using Mojo::DOM for rewriting HTML

      Hi, I’m curious about Mojo:Dom. Let’s say you want a generic method of traversing a page, and returning a hash of headers and related sub headings and text from a page using Mojo::Dom. The sub text may not necessarily be a descendant of the heading and from what I can tell, mojo::dom can only descend not ascend. How does one construct this? I’ve read the docs and tried a number of things but I’m not getting far :(

    • Joel Berger commented on An example using Mojo::DOM for rewriting HTML

      Hi, I’m not at all sure what you are attempting to do and the comment system of this site does not make it very conducive to technical discussion. I would recommend asking a question on StackOverflow and include the Perl and Mojolicious tags (at least).

    • BooK commented on Of course you can `requires` attributes!

      Sorry for replying a few month later, but your code example gives an error:

      perl -e '
          package MyRole {
              use Moo::Role;
              requires "my_attr";

      package MyClass {
      use Moo;
      with "MyRole";

      sub my_attr;
      has my_attr => ( is => "ro" );
      You cannot overwrite a locally defined method (my_attr) with a reader at /usr/share/perl5/Method/Generate/ line 30.

      The only way I've found to avoid this without putting the with at end is th…

    • Henryk Paluch commented on A Simple Mojolicious/DBI Example


      For Unicode support there are few fixes needed:


      use Encode;
      plugin Charset => {charset => 'utf-8'};

      modify / method to:

      any '/' => sub {
        my $self = shift;
        my $rows = $self->select;
        # convert utf-8 octets -> unicode
        for my $Item ( @{ $rows } ){
            map { $_ = decode('utf-8',$_) } @{ $Item };
        $self->stash( rows => $rows );

      Best regards

       —Henryk Paluch

    • chella commented on Using Mojo::DOM

      can u tell me how to display meta tag content

    Subscribe to feed Responses to Comments from Toby Inkster

    About 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 hosted by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.