The Mighty Meta Moose

Find and fix a bug day here in the Moose-Pen

The great thing is the new tests I added to fix up my subroutine covers as reported by Delve::Cover revealed that I may have two new bugs in Database::Accessor.

The two fails were;

…
not ok 92 - no_create flag error on create
ok 93 - no_retrieve flag error on retrieve
not ok 94 - no_update flag error on update
…
The test is fine as it is failing with the expected error message 'Attempt to use create with no_create flag on' with the error message 'No Create, Update or Delete with retrieve_only flag'. I looked though the code and that error comes from here

London Perl Workshop 2018 - Report

namespace::local: hiding utility functions in moo[se] roles

Ever since I came up with namespace::local, clearly inspired by namespace::clean, I was wondering who would need it in real life.

Now I seem to have found an actual application: roles. Roles must be very careful about what's in the namespace to avoid conflicts. So any private subs that are there to reduce repeating code should ideally be hidden from external observer.

And it is possible with namespace::local -below. The below switch is introduced in 0.03, and it allows the names defined below the use lines to propagate above the use line, but not past the end of scope. This can be seen as namespace::clean working in opposite direction.

Example: if you comment both use namespace::local lines, this code blows up.

LPW2018 Silver Sponsors

Without the investment from our sponsors it would not be possible to run LPW as a free event. We’re grateful for the support at a Silver level from the following four awesome companies!

Adestra
Here at Adestra we empower our clients to maximize marketing ROI through email-driven technology. Our flexible account structure, obsession with customer success, and award-winning service have gained the trust of global and growing brands alike.

We’re proud to say we treat our people well: from excellent opportunities for career development to a positive, collaborative culture and great company perks, our global offices are a fantastic place to work at any stage of your career. As our client base continues to grow, we’re looking for talented individuals who share our values to come and grow their careers with us. With opportunities in the UK, Australia, and North America, now is an exciting time to join Adestra and become part of our global success.

Back in the Moose Track

It figured it out day here in the Moose-Pen

Well I really should bow my head in shame again as I got the whole Devel::Cover concept backwards. I thought that changing the code in my application would change the results of cover. Well I was dead wrong on that some further reading on my part and a few more test runs of cover I finally figured out that;

line %  coverage branch
94  50  T  F        if $self->gather
for this sub

DBD::Oracle 1.76 released

Including a wide range of bug fixes and some helpful enhancements as detailed in the Changes file.

If you are using DBD::Oracle, there is no reason not to upgrade (YMMV)

Check it out https://metacpan.org/release/ZARQUON/DBD-Oracle-1.76 or using your preferred CPAN tools

Tackling Legacy Projects: an Experience in Perl - Free Ebook

There are several definitions for legacy code that have similar points, but overall people interpret the notion in different ways. For some it’s code without unit tests, for others it’s old code, for most it’s both. It’s not necessarily something vigorously debated, but opinions differ on what makes code legacy.

In this short ebook you’ll find more than just definitions, but a different perspective on legacy code in general and what it represents for Perl. To make things a bit clearer, the ebook also contains one of our experiences with a Perl legacy code project and the challenges that went with rewriting it.

Have a look!

Be generous, but not very

This is another blog post based on my experiences of validating user inputs. Here is the previous one, where I argue against the use of "eval".

"Be generous in what you accept" says the adage. I want to argue that generosity works sometimes, but it's all too easy to be generous to a fault, and cheerfully responding to nonsense input is a losing battle. The problem with being too generous is that you end up correcting or even rejecting the slightly poor inputs in a flawed quest to make sense of complete drivel.

Moose Can't get a break

Its start the long releases cycle here at the Moose-Pen

Today I am going to examine some of the results I got from my 'Devel::Cover' run.

ffile                     stmt bran cond sub  pod time total
lib/Database/Accessor.pm 94.4 80.0 88.8 93.7 0.0 23.5 91.7
To start I can basically ignore the 'stmt' section as it is very rare to get 100% in there as I am running at '94.4' I will move onto something else. The next col branch has 80% and following that link I get

DuckDuckGo and MetaCPAN

Not sure where the fault lies, but all DuckDuckGo search results pointing at MetaCPAN pages have as summary the bottom text about StickerYou.com, Google searches are not similarly afflicted, as they show a more appropriate summary.

meta::hack 3 wrap report

We had a blast at the latest meta::hack and we got a lot of work done. Our "greatest hits" have been documented here.

The Exception That Rather Proves the Rule

I had really wanted to stay out of the recent commentary on CGI. I really did. I was going to be able to until a recent article was published in which the authors try to step in on the side of CGI. I believe the authors to be talented perl developers posting in good faith, but the result really pushed me to reply. The application developed as a case for CGI and preventing “overkill” is a perfect example of why a framework is needed.

Moose Take a Bow

Another test day here in the Moose-Pen

Today I am going to go though all the tests in my Driver::DBI and see what explodes

Not really expecting a good run I was plesenlty surprised when I got;

\t\20_fields.t         (Wstat: 512 Tests: 88 Failed: 2)
  Failed tests:  86, 88
  Non-zero exit status: 2
\t\90_extened.t        (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 11 tests but ran 0.
only the above two. The first one was simple enough I just had the wrong value in a regex on the test and a quick change;

Don't use something or another

Seems like a lot of people are keen on telling us not to use CGI.pm, but rather use something else. These discussions seem to verge on religious fervour, with each side finding small problems with CGI.pm or its alternatives, and then telling us that these small problems are actually the end of the world.

I don't use CGI.pm, I haven't used it for at least ten years, and I'm not about to defend it, but since we're all telling people not to use something, I thought I would chip in with something which I don't think you should use.

Since about 2006 I've been running a web site which offers to convert Japanese numbers into other kinds of numbers, and vice-versa. For most of those years until relatively recently I was using Lingua::JA::Numbers by Dan Kogai. Dan Kogai's module uses a methodology of converting the numbers by changing Japanese numbers into digits then sending the digits into an "eval" statement to compute the numeral value of the numbers:

London Perl Workshop 2018 - happening this weekend

There is less than a week left until the 2018 edition of the London Perl Workshop on Saturday the 24th of November.

If you have not signed up but want to come, there is still time to register for your free conference ticket. If you have already signed up, please make sure you have confirmed your attendance and selected a t-shirt size. We can only get a conference t-shirt for you if you've done this by tomorrow (Tuesday) at 12:30 GMT.

Are you already in town on Friday evening? Come to the social event and meet your fellow Perl Mongers. We will meet at The Hope in 15 Tottenham St, W1T 2AJ from 6:30pm in the upstairs room. Drinks at the event are sponsored by Oleeo.

Modern Perl CGI

The contemporarily unique strengths of CGI as a deployment strategy are that CGI scripts ⓐ can just be dumped in the filesystem to deploy them and ⓑ do not have any of the issues of long-running processes: they tie up no resources when not in use and are extremely reliable because of the execution model, in which global state always starts from a blank slate when serving a request and there is no process that outlives the request and could wedge itself. Anyone who consciously chooses CGI over alternative deployment strategies nowadays probably has a fire-and-forget use case where the script will be seeing too little traffic to be worth any effort to tend to it regularly.

Full Monty Moose

Its big change check-in day here in the Moose-pen

I think there will be very little new code today but I did incorporate a large volume of changes. First I dropped 'Database::Accessor::Roles::AllErrors' as I no longer see any DAD writer ever having any user for it not that it does not throw an error;

The code from that I added into the 'Database::Accessor::Types' and I did not even have to make a single change to the code. I also took out all the commenting out junk code and waring from that class for good measure.

I then went into Accessor.pm and made the following change;

– sub _loadDADClassesFromDir {

++ private_method _loadDADClassesFromDir => sub {

Modern Perl CGI

This is a CGI script, let's call it uppercase.cgi:

LPW2018 Gold Sponsor - Eligo

I'm fully covered

There seems to be a new feature of showing the coverage in metacpan. Fortunately I have already achieved 100% coverage here:

https://metacpan.org/release/Acme-Include-Data

Some other places are not so fortunate.

http://cpancover.com/latest/JSON-Repair-0.07/blib-lib-JSON-Repair-pm--subroutine.html

I only have 33% coverage in my POD.

The thing is though that I deliberately didn't document these private routines.

I looked in vain through what documentation I could find for this coverage system

https://metacpan.org/pod/Pod::Coverage

to find out how to tell it that these routines were never meant to be documented, but couldn't find anything except for a regular expression which ignores routines with a leading underscore.

Can anyone tell me how to tell the coverage meter to not measure these routines?

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.