Perl 5 Porters Mailing List Summary: June 9th-15th
Hey everyone,
Following is the p5p (Perl 5 Porters) mailing list summary for the past week. Enjoy!
Refactor of Perl Critic policy ProhibitUnusedVarsStricter
Perl::Critic::Policy::Variables::ProhibitUnusedVarsStricter (whew!) is a Perl Critic policy that attempts to be more stringent about finding unused variables than the core policy of similar name. One of the things that has to be done to make this happen is to figure out which variables are interpolated into double-quotish strings.
The original version of this module had its own string-analysis logic, as do other Perl-Critic policies that have to figure out which variables are really being used. With the mainstreaming of postfix dereferencing, it seemed to me that the recognition of interpolated variables had become complex enough that a separate module to figure this stuff out was justified. Thus was born PPIx::QuoteLike.
The Many Roles a Moose Can Play
So today in the Moose-pen I was going to move out of the testing mode and actually do a little more coding, well some re-factoring anyway.
One of the best things about re-factoring Moose code is how easy it is to use a Role to stomp out all sort of duplicated code.
So of you may of already spotted s little anti-patter I had going on on most of my Database::Accessor classes and that was the;
has 'name' => (
required => 1,
is => 'rw',
isa => 'Str'
);
and
Newbie Poison
After encountering CodeNewbie at OSCON 2016 I've been thinking a lot about why there are so few new developers interested in Perl. I haven't been a Perl beginner for a very long time so I went looking for resources and found FAQ for the beginners mailing list. I wanted to know how active the mailing list was so I immediately went to the web achive. Reading through the list I saw things like:
"Is there a reason why you think one CPU is better than another?"
"your code exhibits many bad elements, and you don't seem to apply all the advice I've been giving you. Please go over http://perl-begin.org/tutorials/bad-elements/ , read it and internalise it."
Condescending, abusive advice is worse than no advice at all. There's no way I'd send a beginner into that. Nobody should have to learn like that. Seeing it ruined my afternoon. Maybe I should have read more of the FAQ:
"Who owns this list? Who do I complain to?"
This is a FREQUENTLY ASKED QUESTION?
Introducing SVG::Estimate
If you do anything with 2 dimensional CNC machines such as plotters, mills, or lasers, you’ve probably used some form of vector graphics. The most popular open source vector graphics type is called SVG or Scalable Vector Graphics. If you’re doing this professionally, you need to know how to charge for that work, and if you know the length of the shapes included in that vector file, you can do a pretty good job of preparing an estimate for a customer. That’s where SVG::Estimate comes in. It does the mind melting math to tell you the length of arbitrary lines and shapes inside a vector file.
[From my blog.]
perl6: count chinese characters in string
Hi,
This is my first post here and it will be a short one.
I was asked to count chinese characters in a string. Most of us know the annoying task of writing an essay with $n words. For chinese it will be $n characters.
Would be a shame if we take this too serious and write too much.
so:
my Str $text = "你好! 我喜欢吃菜!";
$text ~~ s:g/ \W | \d //;
say $text.chars;
And that's it.
So why even blog about it? What I think is amazing is that all worked with the first attempt.
I often just try stuff in perl6 without knowing if it will work the way I think it will work.
However most of the time, it just does... and this is why I love this language!
Keep up the great work!!
Ben
Just a little More 2.
So To carry on from my last short post another short post. I am going to expand and modify my 20_dad_load.t again this time digging a little deeper in Moose's MOP or to give its full name 'Meta-Object Protocol'
One of the things I like most about moose is how easy it is to do “Introspection” or I like to say 'Lets have a look under the hood'. So I have expanded my role test from the other day to thisYAPC::NA::2016 - Wednesday Night Pull Request Challenge
craigslist is sponsoring the Wednesday Night Pull Request Challenge at YAPC::NA::2016 on 6/22 at 6pm-10pm (or 'til). This event is modeled, inspired, and loosely affiliated with Neil Bower's fun and successful "CPAN Pull Request Challenge" .
Food and drinks will be provided, so PLEASE RSVP.
A primary goal of this event is to introduce participants to the wonderful world of contributing to the Perl ecosystem.
This is a beginner friendly event, and assistance will be given to anyone needing help getting started.
To make things even easier, there will be a list of eligible modules to choose from. Participants may also come with their own projects and modules to work on.
For more information and to RSVP, please visit http://www.yapcna.org/yn2016/wiki?node=PRC.
POD speculation
[...] expects to find either a
=head(n>1)or an=itemblock documenting a subroutine.
In pure TIMTOWTDI spirit, it's up to you to decide which style you want to adopt. There are PROs and CONs, though.
Writing a simple splunk API client.
I needed to do some work with splunk the log and monitoring analytics toolkit. Specifically I needed to combine disparate logs from different systems to solve a problem that had been intefering with our systems for a long time. I had a look around for stuff on the CPAN, but it was either embedded into other bigger things that I didn't want to have to deal with, or did not work for me for maintenance reasons. So I decided to write my own. The library I wrote is available here in draft form.
Now because this was written by me for debugging purposes, I think it shouldn't be a CPAN module - not without a lot of hardening it up - but I wanted to share it anyway, as a handy way of doing API integration.
Just a Little 1.
So just a quick one for the Moos-pen today.
I my last post I did create a Test DAD, but then I discovered the problem with doing this is you may spend considerable time just debugging that class to make sure it at least works with any roles it may have to consume and even if you get it to work you may have problems with the roles it is trying to consume.
So I really should test my Database::Accessor::Roles::DAD before I start any load tests,. My basic test I did in a previous post it a good start bur I want to be able to test it before I have says a 100% good DAD. So Moose come to the resque again with MooseX::Test::Role
With this MooseX I can test my role without a 100% perfect consuming class as it just stubs in any subs the role may require. So in 20_dad_load.t I add inPerl 5 Porters Mailing List Summary: May 30th - June 8th
Hey everyone,
Following is the p5p (Perl 5 Porters) mailing list summary for the past week. Enjoy!
How to write a simple nginx installer with sparrow in 4 minutes - nice asciinema video!
A simple nginx installer with #sparrow - nice asciinema video!
https://asciinema.org/a/06h3ezswbyidu0pdl993rl30v
#nginx #perl #devops #automation
And ... yeah I forgot to say cpanm Sparrow at the very beginning .... ))
Octothorpes Matter!
Interesting Twitter Searches:
- #womenwhocode #javascript - Uncountable Entries
- #womenwhocode #python - Uncountable Entries
- #womenwhocode #perl - NO ENTRIES
Ok, how about these:
- #codenewbie #javascript - Uncountable Entries
- #codenewbie #python - Uncountable Entries
- #codenewbie #perl - 2 Entries
Are we a support group for disenfranchised Perl developers or advocacy group for all developers? If we want people to join our community then we need to reach out and do some good in theirs.
Moose Retest 2.5
So in today's Moose pen I am going to stick to the testing tree and have a look at my brand new 20_load_dad.t file in my brand new database-accessor repository
Now in past test cases like this, I did a little creative coding and made up a fake test class for SQL and Mongo drivers that where used when I called this
my $fake_dbh = DBI::db->new();
ok(
$address->retrieve( $fake_dbh, $result ) eq
'SELECT street, city, country FROM person AS me',
'SQL correct'
);
Missing Smart Match
I know that smart match is considered experimental at best and is likely going away at worst, but I hate that! In what world is:
if( grep $_ eq $scalar, @array ) { }
Better than this?
if( $scalar ~~ @array ) { }
The former doesn’t even shortcut. Some will say that I should use any like this:
use List::MoreUtils qw/any/;
if( {$scalar eq $_} @array ) { }
But any damn fool can see that it’s 2 lines of code instead of 2 characters. It’s not more readable. It’s just foolish. Some parts of smart match suck and I get that. So throw out those cases, not smart match itself.
[From my blog.]
https://sparrowhub.org updated
HI ! https://sparrowhub.org/ site updated! A various changes of index page:
- welcome text distilled to make it sparrow usage more clear and understandable
- a look-and-feel screenshots added
- a links to tutorials, documentation pages and papers added
- a new motto proposed ))) - "Sparrow - Reusable automation scripts" !
Alexey
The way to get latest Perl information
Do you want to get latest Perl information? If you get newer Perl information, you can know the information faster than others.
I'm Yuki Kimoto. I'm Japanese Perl programmer. I have twitter account. Until now I only tweet newer perl information using Japanese. but from know I tweet using Both Japanese and English.
I tell you what I find, what I think it is good about Perl(perl core feature, web application, cpan module), and my perl product release such as GitPrep.
I'm sharing many topics from now. I add simple description from my experience of professional Perl programmer. If you follow my twitter account, I can tell you good Perl information.
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.