Well in my last post I created a very small API of a two keys
requires and
one_of
Now I have to get down and dirty and write up some code to handle this API. Now the logic will be in the same place namely 'MooseX::Meta::Method::Role::Authorized' and in a rewritten 'authorized_do' sub.
On my recent project, fsql, I want to detect (preferably cheaply) whether a (short) piece of text is JSON, YAML, Perl, CSV, TSV, or LTSV. The JSON/YAML/Perl would contain an AOA (array of arrays) or AOH (array of hashes).
File::LibMagic gives me "text/plain" all the time, so that's useless.
Here's currently the algorithm which I'm using. It's far from perfect, but perfection is not a goal here. Good enough (or even half as good as that) is okay, since most of the time, the file type will be inferred from the filename extension. And it's okay to be wrong as long as we can be right often enough.
1. If first line contains tab character, it's either a TSV or LTSV. Type is LTSV if first line contains colon (:).
2. If text contains => it's probably Perl (but this is useless for AOA).
3. If text contains a bare word element in a comma-separated list, e.g. foo, bar, it's probably YAML, since YAML allows that kind of thing.
Well in my last post I decided to use a hash-ref rather than an array-ref as a way to expand my little MooseX and let the user set have a set of required roles and or a set where only one role is required from a set.
I figured this made the API a little eirer to understand and even read inline.
Now how to implement this?
Well I start first with 'MooseX::Meta::Method::Role::Authorized' do this
I have been working on the project now called Dezi, in one form or another,
since 2005. The actual kick-in-the-pants to make a Product, rather than a Loose Affiliation of Modules, came in an exchange in the comments of a blog post about metacpan.org.
Dezi has gone through several releases in the last few years. Now I'm preparing for a big, new release (0.3.0) that represents (for me) a seismic shift in the way I'm thinking about the product. It has to do with social coding.
Way back when, I started using the Rose family of Perl modules for work. I developed many CPAN modules against the Rose suite. I continue to find the Rose modules well-built, well-documented and very fast. I rarely find a use case that has not already been anticipated.
You missed as a point "People don't know that the grants exist" and "People don't think their ideas/plans are appropriate for a grant". TPF should probably advertise them more.
Let's talk about the marketing aspect.
"People don't know that the grants exist"
To improve the situation that "People don't know that the grants exist", we did the followings in the past few months:
Changed the rule to make it more attractive for prospective grantees (grant limit, grant cycle).
Reminded each Grants Committee member to advertise the program more, which became: 1) talk given at a local Perl mongers meeting 2) more appearance on social network sites 3) more appearance in personal blog and mailing list
Started this blog to make the grant program known by blogs.perl.org readers and search engine crawlers
Well just a sort one tonight as other got in the way,
I did talk in my last post yesterday about adding a little enhancement to my first little MooseX and after talking with some of my co-conspirators they though it would be useful that the requirements are as follows
Have at least one the indicated roles
Have all the indicated roles
Have a mix of 'Required' and at least one indicated role
So how to add that in??
Well the it does not look very hard rather than pass just a simple array to the sub why not pass a hash that has the data classified for me. On can do this in a number of ways by adding here are a few'
A hash with the keys as the roles and the values indicating it is required or not
It is my pleasure to report that all five proposals that we selected for the Google Summer of Code on behalf of the Perl Foundation have been accepted for inclusion in the program this year.
Well in my last post I manged to get rid of numerous bits of the original MooseX::Authorized Methods and get it down to what I find is just what I need the bare-basic check if a class has a role.
Now digging ever deeper into the 'clone' of Authorized Methods I have the 'MooseX::Meta::Method::Role::Authorized::HasRoles' class and I can just delete that one as I moved its functionality into the 'MooseX::Meta::Method::Role::Authorized' class so that leaves me with 'MooseX::Meta::Method::Role::Authorized::Meta::Role' and here that is
It's not quite enough for you as the PAUSE author to delete your files. We want to get the word out, so I'd like you to get one other PAUSE author to do the same. Use your social media networks, peer pressure, begging, or whatever your favorite method is, not because there's any danger of running out of space, but because it's fun to delete things and see them disappear.
The MetaCPAN project would like officially to welcome our summer of 2014 Google Summer of Code (GSoC) and Outreach Program for Women (OPfW) participants. We had a lot of interest this time around and some great applications. Our OPfW participant is Pattawan Kaewduangdee and our GSoC student is Talina Shrotriya. Both Talina and Pattawan have plans to make some much needed improvements to MetaCPAN and we're really looking forward to working with them. I've linked to both of their Github profiles above in case you want to track their progress commit by commit.
I'd also like to thank the Perl Foundation for its support in both of these programs. Lately I've had a chance to glimpse how much work goes on behind the scenes to make these sorts of programs happen and I can tell you it's impressive to see how much volunteer work is involved in something like this.
Now for my next installment I think I will carry on the same pattern as in my last post namely just taking the next file in line and bending it to my will. So lets see what is next.
Now the namespace is 'MooseX::Meta::Method' and the file is 'Authorized.pm'.
Now my code base I have nothing in this name-space because I wanted to avoid a name-space collision as we all know you cannot have two files with the same name (well except in windows if the case is different). So under 'Method' I added another namespace called 'Role' and add my version of 'Authorized.pm'. there,
It is my pleasure to report that all five proposals that we selected for the Google Summer of Code on behalf of the Perl Foundation have been accepted for inclusion in the program this year.
While doing some Registry-related things with Perl a couple of weeks ago, I ran into something that took me nearly a day to figure out: Win32::TieRegistry asks for write access to the Registry by default, and under Win7 that requires Administrator privileges. (I kid you not, it took me over a day to figure that out.)
Well, getting what turns out to be called "elevated privileges" from Perl turns out to have been pretty hard - a lot harder than it should have been, for reasons I went into in some detail in a little article about it, but, to cut straight to the chase, I came up with a way to get Perl to restart a script after invoking UAC to gain elevated privileges. It's got some weaknesses that are inherent to the way Windows manages the console, but, well, I present to you Win32::RunAsAdmin. You can use it like this: