More Than one Way to Load a Moose

So from my last post I had to figure out a way to enforce these four rules

  1. All LSD files will be in the DA::LSD name-space or folder if you like
  2. Each DSL has to express which type of driver it expects
  3. Only DSL 'pm' files will be loaded
  4. The loaded DSLs should be cached as loading or at least requiring them may take some time.
The first question is where to do this in the code. Fortunately Moose has a BUILD sub which is the prefect place for this. So we will start with this;

sub BUILD {
    my $self = shift;
    map { $self->_loadLSDClassesFromDir($_) }
      grep { -d $_ } map { File::Spec->catdir($_, 'DA_SC','LSD' ) } @INC;
}

Virtual Spring Cleaning (part 8 of X) wherein I release leftovers

I have already mentioned it, but I didn't release Template::Provider::ArchiveTar right when I released Archive::Merged even though the two modules are really intended to work in tandem.

My Perl QA Hackathon 2016

I attended the Perl QA Hackathon 2016 in Rugby. I didn't come with any specific projects, and planned to participate in some of the discussions, help others if possible, learn a bit of Perl 6 and if all else failed, work on some of my own CPAN projects. I did a little bit of all.

My Perl QA Hackathon 2016

While I have hung out on the fringes of the p5p and toolchain communities for a few years now, my largest “qualifying” contribution has been Alien::Base, which has largely been handed off to Graham Ollis (plicease). Therefore I was a little surprised but very honored to be invited to the 2016 Perl QA Hackathon held in Rugby, England.

Overall it was an incredible experience. Day after day the energy in the room was palpable. Everyone was creating and improving the code that we would all get to use one way or the other. People hacking on PAUSE and MetaCPAN and CPANTesters, on ExtUtils::MakeMaker, on Test2 and Test::More.

ᒨᓴ ᐊᔅᐗᔨᑕ

One thing I have neglected till this time was how to Load in my LSD classes. Up till now, for testing purposes, I have been always hard-codeing my Mongo and SQL LSDs in my code, and it did not matter if they where a Role like this

  apply_all_roles( $self, "DA::LSD::SQL");
or a class such as this

   use DA_S::LSD::Mongo;
   $lsd = DA_S::LSD::Mongo->new(elements=>$self->elements,view=>$self->view);   
in the long run I will have have to have some way to get them into my name-space without having to recode my DA each time a new LSD is created.

Need Perl6 modules on Windows then use Zef

Lately I have been working on writing some serious Perl 6 so I can discuss and review at the NYC Perl 6 Beginners group in NY.pm. After doing some research I then realize that I need to install additional Perl 6 modules on my Windows machine. In a Rakudo Star installation for Windows you have Panda as your default Perl6 module manager but it doesn't quite work for Windows just yet. In this post I list a few Gotchas while attempting to install HTTP::UserAgent on Windows

My Workflow for Building Distros

My Workflow for Building Distros

How about separating dynamic world and static world?

I write comment before topic. Please see it.


Current subroutine signatures implementation contains two features which purposes are different

My opinion is that argument count checking by subroutine signature is not fit to Perl because Perl is dynamic language.

Perl is dynamic language, so argument count checking is done in run-time, not in compile time. This damage to performance of subroutine call.

Perl one big problem is that subroutine call is slow. If this is improved, Perl have big benefit.

"sub foo($x, $y) { ... }" should be faster than "sub foo { my ($x, $y) = @_ }"

Many existing projects will use subroutine signatures not worrying about performance damage.

How about separating dynamic world and static world?

By the way, I am reading cperl specification by Reini Urban. This is very interesting.

He want to introduce many static features to Perl. This is mainly performance reason.

And one more for luck

For today's MooseX I was having a look at  MooseX::ShortCut::BuildInstance which was one of the last ones on my initial list.

So this MooseX required me to almost as much jigging about as in my last post and I had a few false starts on it implementation as the documentation is sparse as are examples, but none the less I did manage to get something up and running in my DA.

So to start I again has my DLS class in a separate file and I set that up as the shortcut maker. So all I needed to do was this

   package   DA_SC::LSD;
    use Moose;
    use MooseX::ShortCut::BuildInstance qw(  build_instance should_re_use_classes);
    should_re_use_classes( 1 );
and then in my retrieve sub of DA I did this

Outthentic expansion

Hi!

This is a quick post on latest Outthentic changes going to be released in the nearest future. Not going into technical details, I would gladly say that:

  • Outthentic is turning into "Multipurpose scenarios framework" meaning not only test or reports scripts, but ANY scripts or scenarios could be written on this tool.

  • Outthentic is getting language agnostic tool ( but it is still written on Perl ! ). Now one may use Perl, Bash or Ruby to extend basic DSL, see a lot of examples here and a heavily updated documentation here

All these features are kinda under active development, but one may play with developers version installing from the github source code.

Regards

--- Alexey Melezhik

Android App with the Perl5 to Java compiler

We've had another hackathon at work.

Yati, Bas, Luca and I hacked on the Perlito Perl5-to-Java compiler and also a bit of Perl5-to-JavaScript.

The changes are in GitHub and will be published in the next CPAN release.

The latest cool addition is an Android App example:

QA Hackathion in Rugby, Warwickshire, 2016

This year I discussed less and got more focussed on one thing, namely PAUSE, thanks to the kisses of the muse we got flooded with, that is Kenichi, Neil, Matt, Peter and me. Thanks to that, PAUSE is, I daresay, in a better shape than ever before and definitely on a good track towards the future.

Here's a short run down on my activities at the QAH in Rugby:

Fixed a bug discovered by Leo Lapworth in rrr synchronization: it turned out that a crontab item got mangled recently.

Joined the Test2 discussion.

Set up a smoker run for 5.18.4 with the Test-Simple releases 1.302014_001..7.

Finished the pre-Hackathon activities on getting the Perl Authors Upload Server (PAUSE) to work with two separate puppet instances, one for the system operation team, and one the application (together with Robert Spier).

Added sysv startup gears for the new plack-driven PAUSE server and fine-tuning configuration (together with Slaven Rezić and Kenichi Ishigaki).

And the Winner is? (well maybe anyway)

Today I started taking a closer look at MooseX::RelatedClasses to see if that could help me out. Well after reading though the documentation and looking at the test files to see how it really works I do not think I need this MooseX at all as it really is just for coordinating name-spaces, So I will move onto the next one for today and that is MooseX::Scaffold

This one does look promising as I can use one common sub to load in my LSDs when one of the DA CRUD commands are issued with all the correct attributes I need.

This one did call for a rather large redesign of how I put things together;

First I had to take the DA_S::LSD out the DA pm file and put it in its own file LSD.pm and in that I added the Scaffold code like this

Reflections on Test2

In a future post I will recount the details of my delightful experience at the 2016 Perl QA Hackathon (N.B. now published here). Since this is my first post since that time I do want to tip my hat to the great sponsors of the event and to my own employer ServerCentral without whom I would not have been able to attend. I will thank them in more detail in that post.

Before I get to that however, I want to post a reflection on one discussion that is and has been weighing on my mind since then. That topic is the upcoming release of Test2, which I consider to be a very important step forward for Perl’s testing architecture.

Available for Perl Work

Hi All,

I am available for Perl work. I can work remotely or locally in the
Boston area. Also I can be on-site a reasonable amount of time depending
on travel logistics.

You can see my design and coding skills on CPAN (id: URI).

Damian Conway said this about me in his acknowledgements in Perl Best
Practices: "To Uri Guttman, for seeing things no one else did, in ways
no one else could."

If your Perl team is large enough (say > 5 or so), one of the best ways
to use my services is supporting your team with code review, optimization,
and related skills. This can be a part time deal and your team
will get productivity gains greater than the time invested.

Here are my areas of interest and expertise:

Architecture, Design, Development
Code Review, Mentoring, Refactoring
Optimization, Scaling
ETL, Parsing, Data Munging, Templating
Networking, Communications, Dataflow
Documentation, Specifications

You can reach me at U r i AT P e r l h u n t e r .com or call me at
781-643-7504.

As a bonus, let me know if you want a preview or to be a tech reviewer
of my article on dataflow architecture.

thanx,

Uri

Perl 6: The S/// Operator

Coming from a Perl 5 background, my first experience with Perl 6's non-destructive substitution operator S/// looked something like this:

(artist's impression)

You'll fare better, I'm sure. Not only have the error messages improved, but I'll also explain everything right here and now.

The Smartmatch

The reason I had issues is because, seeing familiar-looking operators, I simply translated Perl 5's binding operator (=~) to Perl 6's smartmatch operator (~~) and expected things to work. The S/// was not documented and, combined with the confusing (at the time) warning message, this was the source of my pain:

my $orig = 'meowmix';
my $new = $orig ~~ S/me/c/;
say $new;

# OUTPUT warning:
# Smartmatch with S/// can never succeed

Moose Relations

So after yesterdays re-loadfest of getting all my win- registry in order, downloading the latest Strawberry perl, upgrading Moose and getting all the other perls in a row. I tried to work on my DA again and got

Class::MOP::load_class is deprecated at C:/Dwimperl/perl/site/lib/Class/MOP.pm line 69

yet agin.

Well this time I took the time to look at the rather shortened message, only about 15 lines compared to about 120+ for the first time I tired these new MooseXes so at least some things have been fixed up.

Anyway I spotted the problem seems 'MooseX::Role::Parameterized::Meta::Role::Parameterized' needed to be updated if MooseX::RelatedClassRoles is going to work. So a quick cpan install and the latest version was up and running. Now I only get
MooseX::RelatedClassRoles::__ANON__::SERIAL::1' requires the method 'LSD_class' to be implemented by 'DA_RC' at C:\Dwimperl\perl\site\lib\Moose\Meta\Role.pm line 472 …

Applying user-supplied regexes

My first post... not the snappiest title, but here goes...

Multiple Grep and Capture

I have a requirement for a module which performs the following:

Given a client-supplied list of regex patterns, which may or may not capture part of their output

And a search text
When I run my function.
Then return a list of tuples, where the regexp matches the search text. Each 'matching' tuple consists of the regexp, and an array of the captured elements of the text.

Important to note that: * we don't know up-front which regexes will be supplied - only that they should be valid * we don't assume there are any capture groups, but if there are, we would like to hold onto them

First attempt...

for my $re (@regexps) {
    my @captures = $search_text =~ /$re/;
    push @result, [ $re, \@captures ] if $&;
}

Perl 5 Porters Mailing List Summary: April 14th-27th

Hey everyone,

Following is the p5p (Perl 5 Porters) mailing list summary for two weeks I've missed. Sorry about that. Enjoy!

Extra-Typical Perl 6

Have you ever grabbed an Int and thought, "Boy! I sure would enjoy having an .even method on it!" Before you beg the core developers on IRC to add it to Perl 6, let's review some user-space recourse available to you.

My Grandpa Left Me a Fortune

One way to go is to define your own custom Int-like class that knows how to perform the .even method. You don't have to reinvent the wheel, just inherit from the Int type. You can mix and match core Perl 6 types and roles any way that pleases you.

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.