Leaving Moose Entering MooseX

Well things are progressing for me. You might remember a resent post of mine where I badly injured my Perl and another post where I started down the road of healing. Well today I finally wrote my first MooseX a variation on MooseX::Authorized Methods which rather that using some sort of 'User' who has some sort of 'role' method I just set it up so the class instance must have at least one 'Role' to use the method.

Now I make no apologies here all I really did was copy out Daniel's make a few changes in the name spaces and have my own default verifier.

So now instead of

MooseX::AuthorizedMethods
MooseX::Meta::Method::Authorized
MooseX::Meta::Method::Authorized::CheckRoles
MooseX::Meta::Method::Authorized::Application::ToClass
MooseX::Meta::Method::Authorized::Application::ToComposite
MooseX::Meta::Method::Authorized::Application::ToInstance
MooseX::Meta::Method::Authorized::Meta::Role

I have

More than a life sign

Cheers Perl community - I'm not dead :), no currently I partially study music and delve into instruments, - more precisely I'm building synthesizers with NI Reaktor.

parsing email to get required information using perl script

Hi,


I am new to perl and i need some help in parsing email's using some perl script and get required information

Below is the sample email format in the logfile

From Mon Apr 14 20:24:14 2014
Return-Path:
-----------------
--
----
-----
--------
Date: Mon, 14 Apr 2014 13:23:06 -0700
Message-Id: <201404142023.s3EKN6LQ016845@xxx.com>
From:
To:
Subject: WARNING :
X-Priority: 1
Content-type: text/html
X-Milter-Version: master.31+4-gbc07cd5+
X-CLX-ID: 507038003
Reply-To: -----
X-Loop: ----
X-Sequence: 197227
Errors-to: -----
Precedence: bulk
X-no-archive: yes
List-Id: <---->

< Body of the email >


in log file we have lot of emails and we need to skip email's which has reply

I need below information

Date:
Message-Id:
From:
Subject:

Email start with From at the start of the line


can any one help me with the sample code

Views in DBIx::Class

Did you know you can write a view in DBIx::Class? The DBIx::Class::ResultSource::View module makes this very easy and it's helped me solve a very thorny problem in Veure: how do I efficiently make sure that email sent from Alpha Centauri to Epsilon Eridani doesn't show up instantly in your inbox?

Acme Comes Through Again

Well was programming away today (after doing 8 hours of unpaid household chores) and I had to do the old place a file in a dir but make sure you do not overwrite the last one trick.

There are of course all sorts of ways to do this but the most common is to use the current time in some way and add it into the file name. The good old Perl 'time' function is the quick and dirty way as it gets a slew of numbers any you can just tack it on the end like this

 
my $time = time;
my $file ="somefile.".$time;

Of course that will work but does give you rather ugly file extension and it is always a
nasty pain to convert it over to something that is nice to look at and easily readable.

Improving the grant program (2) Bi-monthly Grant Cycle

Continued from the previous post.

From the comments to Alberto's post:

The 3-monthly call for grants, and the 1 month taken to assess grants, means that there is a 1-4 month lead time between "now" and when a proposal can be accepted.

Now we have a bi-monthly cycle, +50% added frequency, the lead time between "now" and when a proposal can be accepted can be as short as 3 weeks. Or 3 weeks + 2 months at the longest (announcement).

Should we make it monthly? Certainly yes if we have more applications. If we get a lot more proposals every two month, it will be appropriate to make it more frequent.

Bi-weekly cycle? Well, the Committee Secretary needs a break :)


Frequently anticipated questions

So the lead time is between (x weeks) and (x weeks + y months). Any views to make x smaller?

Right. It is easy to decrease y by increasing the voting frequency. However x is a different story.

OT: PLOS ONE Has an RSS Feed

If you like to follow academic progress in CS, PLOS ONE has an RSS feed. (I don't know my feed types upon inspection -- it might be Atom rather than RSS. Still nice to have the feed, though.)

Maintainer's Notes on rt.cpan.org

If you are a CPAN author, this is for you. Otherwise it's still time to become one!

RT.cpan.org has a little known feature called Maintainer's Notes. Maintainers of a CPAN distribution can put a piece of HTML above the tickets list.

On the Correct Path Again

Well back to Perl posting today. You might remember a very bad thing I did in my last post namely altering an installed module and thus breaking any chance of portability or at least maintainability of my current project.

Well the old story of short term expedience for long term failure is fine for the next few days but I really do need a better solution so in the end I will have to write some of my own code.

Well I was thinking of just writing a different version of 'MooseX-AuthorizedMethods' unfortunately this was not as easy as I first thought. Seems the above Mod the way it was designed sort of hogs the 'Method::Authorized' namespace as I do not see anyway I could add my own 'Method::Authorized' package without either clobbering the original or rewriting it to be more namespace friendly.

So what to do??

Introducing fsql and chart

These are two command-line utilities to help you slice/dice and visualize data on the console. fsql utilizes DBD::CSV and a few other modules to let you perform SQL queries against CSV/TSV/LTSV/JSON/YAML files. chart generates simple ASCII charts. I'll give an example for using these tools.

Viewing monthly CPAN releases activity

I maintain a file called releases.txt in the LTSV format. Whenever I do a release, this file gets updated with a new entry.

Finding out how many releases I've done, or even how many releases for a specific year/month/day, is easy. The good ol' Unix commands like grep and wc suffice:

% wc -l < releases.txt
2746

% grep date:2014-03 releases.txt | wc -l
91

Strawberry Perl 5.18.2.2 released

Strawberry Perl 5.18.2.2 is available at http://strawberryperl.com
(all editions: MSI, ZIP, PortableZIP for both: 32/64bit MS Windows)

More details in Release Notes:
http://strawberryperl.com/release-notes/5.18.2.2-32bit.html
http://strawberryperl.com/release-notes/5.18.2.2-64bit.html

I would like to thank our sponsor AuditSquare.com for resources provided to our project.

CPANdeps pass/fail display now working again

Some months ago the way that third parties got access to the CPAN-testers results database changed. Instead of just downloading a SQLite database, there is now an API. This is good. It means that to get all the new reports since your last query, for example, you only need to transfer a few reports across the network instead of downloading all 40 million-odd records every time.

The change was well-publicised in advance, with a fairly long deprecation cycle. But I just never had the tuits to make the changes I needed, and so eventually that part of CPANdeps just stopped updating. It was still reporting dependencies OK, but didn't have any pass/fail data after a particular date.

Well, I'm pleased to say that it's back. Most of the work was actually done by Andreas König, whose script I am using as a shim to import data into the database that the rest of my code expects. I've also made a few other tiny changes which most of you won't notice, and also made the scripts that build the site rather more efficient so that they won't hammer search.cpan.org so hard when populating the site's metadata cache.

Next on my to-do list is to make the same fix to cpXXXan.

Some days Don't Pay

Well No perl stuff today as I have spend the last 24 hours almost fully diconeccted for the real word.

My phone line died 100% just a buzz coming down the line. I checked my DSL which is supposed to separate and it was down as well so a call out to Ma-Bell and the standard

A technicia will call sometime today between 08:00 and 17:00. So up early off to my local coffee shop to work for the day till they guy calls to come and fix whatever.

Well after 1 hour and 3 coffees I was asked to leave and off to the local McDs where after 30min and two coffees I was kicked off thier wi-fi. So back home a wait at least I got a few emails out and a little work done.

Github cheat sheet

https://github.com/tiimgreen/github-cheat-sheet

Perl-Operated Boy

And now for something completely different.

Adopting DateTime::Format::Mail

Finally pushing my first release of this distribution is a special moment to me.

Its original author, Iain Truskett (SPOON), died on December 29th, 2003. He was 24. Back then, I didn't know him, had never interacted with him, or even used any of his modules. That was ten years ago.

Well Why Not!

A question I relly have to ask myself more often. Well today I really got tired of my little solution to yesterdays Moose woes. I just couldn't take the sight of all of these

 
authorized bin_swap =>  [qw(Product::BRULE::Bin ], sub {
...
},(verifier=>Product::BRULE::Authorize->new())

instance calls in my nice clean code base. I did try a few little changes such as a global variable uck, and a singleton not bad but in the end I bit the bullet and decided that I need to add in some code of my own under MooseX.

The main reason is I liked how this worked and in a very elegant solution to to my code-base that can essilly extended with only a minor code change to a few roles if need be.

Improving the grant program (1) Grant Limit

Last year, Alberto, who ran the Grants Committee at that time, published this blog article to ask what we can do better. I read the comments repeatedly to think about our improvement options. In the next few entries, I will discuss what we did and what we will do to make the grants program more useful.

The first one is the removal of $3,000 limit (see #2 of the announcement).

From the comments made at Alberto's article:

I think the grant limit is an issue. I have projects I could submit, but I think they'd take too much of my time, and $3,000 just wouldn't cover it. Basically, I think I'd need to be able to take weeks or a months off of my job to get done what I'd like to do.

A smaller issue is the grant size - I did not have in mind grand plans like autarch, but I can easily see this being a month of work. $3k/month is rather limited.

Questioning the Role of API Design in Perl

or Querying the Designated API of Perl Roles

Perl Encryption Primer

Timm Murray gave his Perl Encryption Primer talk last night at MadMongers. He’s been blogging about it for the past month. The posts are quite informative so you should check them out. There’s also a video up on YouTube about it now.

[From my blog.]

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.