Modern Perl Books, a Modern Perl Blog
3 September, 20:55, by chromatic, written in English
Perl is in better shape now than ever, but there's much left to improve. (I wrote Five Features Perl 5 Needs Now almost two years ago, and four of five are available in whole or in sufficient substitute, so that's great progress.)
Rather than criticize Perl for what's going wrong (as if I were any position to do so), I prefer to suggest new areas of improvement.
One of the biggest possible improvements to the world of Perl 5 is a replacement for many cases of XS. Ryan Jdoubi's Ctypes for Perl was on my original list, and it's still on my list.
Why is this important?
XS can be inscrutable. Try reading the documentation, spread out between perlxstut and perlapi, with liberal use of the Cozens and Jenness book Extending and Embedding Perl and, ultimately, trawling through—even copying and pasting—chunks of the Perl 5 core which seems to do what you want.
Now debug typemap problems, problems with contexts in threaded versus unthreaded builds, and the vagaries of Makefile syntax across various platforms, not to mention the joy of detecting whether you have the right version of a shared library and its development headers on a version of an operating system you've never seen, let alone used, and (oh yes) Windows.
It's no wonder people want pure-Perl modules when possible.
It's also no wonder that, with all of the copying and pasting and reading of the Perl 5 source code in lieu of a working, understandable example of real-life XS code we can modify to our own purposes, far too many CPAN modules and an unkonwn and scary amount of DarkPAN modules abuse the Perl 5 internals in such a way that upgrading to a newer version of Perl seems like soul-swallowing black magic.
You try refactoring the internals sometime, then watch the black smoke come in from the next monthly bleadperl release and sob softly as you put back all of the mess and hope for the best.
If Perl 5's internals have much hope of refactoring and cleanup and sanity, the less XS code the better. Ctypes for Perl can help by reducing the need for XS. If most of the XS modules which are XS only because there was previously no other obviously better way to pass data between Perl and shared libraries, migrating them to Ctypes can remove the need for XS. Improving the interface between Perl and C is much easier because only Ctypes needs to change.
We won't entirely get rid of XS, but we can minimize its use to those projects which really, really need it The fewer of those, the easier they are to audit and review and port, if necessary.
The cleaner the internals of Perl 5 (and the better its extension interfaces in sanity, cleanliness, safety, composability, and documentation), the more possibilities for further development and improvements.
(I also expect that modules which use Ctypes instead of XS will be smaller, faster, easier to write, less memory hungry, and easier to install and to redistribute.)
/var/log/rant
3 September, 18:25, by Dave Jacoby, written in English
I have a friend. He plays drums. He's a good drummer. We were talking recently about playing, and he said that he plays guitar some, but can't get into it as much as the drums, because he's already hit a certain level with the drums and he can't get to that level with guitar, and he gets frustrated. I'm the same way with non-guitar instruments: when you get past the point where the novelty is amusing, you're stuck at the point where you're struggling to do things you fly through on other instruments, knowing you could be working toward the next level on your primary instrument instead.
I consider myself a Perl programmer. There's interesting things I do with Javascript, but if there's any decision to make on my part on how to implement something, I will choose Perl. I have spent over ten years in computing and there have been few problems where the solution wasn't a
sudo cpan away.
There's a program. It handles big data and makes graphs and such out of it. It's a big graphical Java application. There's a lot of things that it does, and if you mean to use it once or twice, there's a lot of powerful parts, but if you need to use it many, many, many times, it gets to be ponderous. There's been requests for a programmer API to be made for this, but that is, at best, still in the works. So, I've been trying to use
Sikuli. Sikuli uses screen captures to find where to click. It's a neat thing, but there are a few issues. It's also written in Java, and it uses Jython, an implementation of Python in Java, for scripting.
Which leaves me having to learn Python. There's significant enough syntax differences that I feel like I'm learning to program from scratch. I've just searched Google for
for loop python and
python arrays, to show exactly how back-to-the-start I am.
I don't know. There's probably something good about this. I'm being stretched to figure this out. Plus, of course, I get one more name to tag onto the end of my resume. But it doesn't
feel like it's a good thing. It feels like a pain, like frustration.
TokuLog 改メ Perlを極めて起業する日記
3 September, 17:51, by tokuhirom, machine translated from Japanese
http://use.perl.org/ ~ cosimo/journal/37554
- withoutworldwritables a mysterious suffix put the CPAN There are people doing up modules such Mostly though it was Audio en I lower in quality, this suffix is PAUSE they put automatically, world writable natural language files that they automatically take what you tell me that Mr. Itadakimashita miyagawa.
On Perl
3 September, 16:50, by ash, machine translated from Russian
- Wheels rustle, keeping the converted video from YAPC:: Europe. (I'm not sure that all records can watch :-)
- Questions about booking - well, they were either too philosophical, or is the subject, sorry (Come, you'll know).
- Yves Orton - the wonder kid, though and wants to break \ w.
- Abigail - remember in what version of Perl was every tiny change.
- Mankind - no secret here on Friday to booking :-)
Perl Developer
3 September, 15:37, machine translated from Russian
And who can say that now, with vacancies in the default city for Perl programmer, and what can RP expect?
The level of average, 5-6 years experience.
Specifically right now I'm not looking for work, but may end up in Msc.
Vampire Software Development
3 September, 13:35, by Andy Brown - SetitesUK, written in English
So I have now been doing the Pomodoro Technique for 3 weeks, and I have to say, that it is working very well.
I am even writing this blog within a Pomodoro - watch for live end/starts and interrupts/failures
I am averaging 8 completed Pomodoro a day. You can see my end of day report sheet
here.
If you took a look, you'll see that the most I get is 11, and the least is 5. There is no direct correllation between failures and successes, but some things to note:
The Boss is away: Less completed and more interruptions/failures as I am being (Pomodoro ends) requested in his place. (finished sentence and save)
Quick 5 minute break and I'm back (start)
Here is a one day todo when my boss was off
Discussion with others: This is difficult, especially when I'm the one being asked, to keep to within 25 minute slots, so an hour can get lost outside of my daily tasks.
So, how is my day worked.
First hour - no Pomodori
8 -> 9am
get in, check emails and relevant blogs/websites.
write out plan for today. If there is nothing already on my radar, then set aside a Pomodoro to go through emails/RT to get new things onto my radar, and replan the day
9->9.05 - 5 minute break, ready for first Pomodoro to start.
From now on, I work in Pomodori, 25 minutes and then a 5 minute break.
(Just had a failure - interruption where I needed to discuss something with someone for > 30s - start new Pomodoro)
If I get an interruption of approx 30s (very quick question from my team members) then this only counts (to me) as a brief interruption, and I don't fail the Pomodoro. If it is longer than this, then the Pomodoro fails.
Now, I am expected to act on emails if they are urgent, so at the end of any Pomodoro or interruption, I check my inbox, and if necessary, replan my day for the next Pomodoro (or x) to act on an urgent request, else they get deleted or put to act later.
In my break, I typically get a drink, look out of the window, go for a quick stretch of my legs.
This tends to go until the end of the Pomodoro that occurs after 4pm. At this point, I don't start another one, but do the daily tidy up (although not of my desk :) ) and fill in my report chart, final check of emails, and twitter out my successful Pomodoro for the day, plus the last song I was listening to.
Interesting things I have noted over the last 3 weeks:
1) Time goes quickly
2) Breaking jobs up into smaller tasks really helps
3) I can't always predict the number of Pomodori a task will take, but I'm getting slightly better
4) Failing at 20 minutes can make it seem like a task has taken less Pomodori than it actually did
5) I can get more done this way (one set of tasks took about 1/2 day less)
6) A five minute break away increases the likelihood of the Eureka solution to the problem you spent the last 15 minutes looking at
7) Time really does go very fast
So now what?
I am going to continue with this, and I am planning a talk on it now. I think the technique really works for me, and I can track what I have done so much easier than just closing RT tickets/completing features in Pivotal Tracker.
I strongly recommend this to anyone, and if you need any more suggestion to give it a go, here is a paraphrased Tweet I read a couple of weeks ago:
The PomodoroTechnique quite literally saved my arse - Software developers at increased risk of Hemorrhoids.
So get up and move every 25 minutes - you'll be better for it.
(9 minutes left of Pomodoro, time for review of the post)
The two Pomodori this was written in
Perl-News
3 September, 11:31, by Renée Bäcker, machine translated from German
Leon Timmermans has spoken on the YAPC:: EU with various people about his Grant - also about the problems on Windows. Timmermans has to get help. But with school commitments, he has yet to reach his goal set itself.
TokuLog 改メ Perlを極めて起業する日記
3 September, 07:33, by tokuhirom, machine translated from Japanese
http://blog.livedoor.jp/dankogai/archives/51512419.html
From the lodge you Perl5.10 state, might have written as follows.
#! / Usr / bin / perl
use 5.010;
use strict;
use warnings;
use Test:: More;
sub flipflop (
state $ p =! shift;
$ P =! $ P
)
ok! flipflop ();
ok flipflop ();
ok! flipflop ();
ok flipflop ();
done_testing;
On Perl
2 September, 19:34, by ash, machine translated from Russian
Prior to joining the Perl operator state, which allows you to create "static" variables directly inside the sub, people used like this method:
(
my $ count = 0;
sub next_value (
return + + $ count;
)
)
print next_value, "\ n";
print next_value, "\ n";
Now all the guys write like this:
use v5.10;
sub next_value (
state $ count = 0;
return + + $ count;
)
say next_value;
say next_value;
Low Level Manager
2 September, 17:44, by Andrew Grangaard, written in English
SvOK(get_sv("main::blog", 0));
2 September, 16:24, by Chas. Owens, written in English
I am writing a talk for beginning Perl 5 programmers covering how to read a line of code and I need a few nasty lines that are fairly self contained. These should be normal lines of code (no obfuscation), they just need to have a lot going on in them. Things involving multiple
maps with complex bodies would be good. If you have one or more such beasts, would you leave a comment with them?
The talk will be given at
The Pittsburgh Perl Workshop.
Анатолий Шарифулин
2 September, 08:40, machine translated from Afrikaans
#! / Usr / bin / env perl
use common: sense;
use ojo;
the "Usage: $ 0 <podcast url>" unless @ ARGV;
b (g (shift) -> dom-> find ('enclosure [url]) -> each (sub (
local $ _ = shift -> attrs-> (url);
say if / \. mp3 $ /;
)));
http://gist.github.com/562053
Привет, хейтерам Perl:)
or the use Mojolicious;
use Perl or die;
JFDI
ЗЫ: пизжи только на похапе или или CAS AJAX:)
Perl Indonesia
2 September, 04:03, by Steven Haryanto, written in English
Book information
Title: Catalyst 5.8 The Perl MVC Framework.
Subtitle: Build Scalable and extendable web applications using the Agile MVC framework.
Author: Antano Solar John.
Publisher: Packt Publishing.
Country: UK/India.
Year: 2010.
This book is a follow up to the 2007 Catalyst book by Jonathan Rockway (member of Catalyst core developer team). I have no idea how much of the content is changed between the two.
About the review(er)
This is a review on the electronic (PDF) edition of the book. I am a Perl developer and a CPAN author, but have not used Catalyst (or most other recent web frameworks, for that matter) before.
About Catalyst
So far I've managed to avoid learning about web frameworks and continue to create web applications the old way (CGI/CGI::Fast, direct DBI/SQL, a homemade simple templating language, and recently lots of jQuery and CSS play). Part of this is due to laziness, and part due to lack of need. I've never needed to create complex web applications in Perl. And the apparently heavy learning curve and complexities of Catalyst, Mojo, Dancer, etc just make me say don't bother.
But, thanks to this book, I find out that Catalyst project is not unlike a Perl CPAN module, with files/subdirectories like Makefile.PL, Changes, README, lib/, t/, etc. You can now even manage your project with Dist::Zilla (not mentioned in the book though as the plugin for this is new).
The good
This book is only about 200 (instead of 500+) pages long, which I appreciate. The preface is concise, and the explanation in the chapters are straightforward enough. The author uses clear and simple English sentences instead of long complex ones. The organization of topics into chapters is quite appropriate.
Missing topics
I didn't find any mention of Strawberry Perl, only ActivePerl. The examples are all using SQLite and no other databases. I wish AJAX and integration with one/more JavaScript frameworks like jQuery (and thus, CSS) is discussed more, as this is now very popular and common. But that will add significantly to the length of the book.
The first chapter on MVC also deserves some more extension.
There is no comparison whatsoever with any other Perl web frameworks or other non-Perl frameworks like Django and Rails.
I would've liked a chapter/subchapter on performance tuning and benchmarking (there is a 'Performance considerations' section in the Deployment chapter but that only covers the choice of webserver).
Plack/PSGI is not yet covered on this edition, which is a pity.
The rather bad
The author gives CPAN links to pages of specific release versions, e.g. http://search.cpan.org/~ash/DBIx-Class-0.08013/lib/DBIx/Class/Schema/
Versioned.pm which tends to break as new releases added and old releases removed from CPAN. But this is understandable because currently CPAN only provides http://search.cpan.org/dist/DBIx-Class/ and not something like http://search.cpan.org/dist/DBIx-Class/current/pod/Foo/Bar.pm.
The author also uses 2-space indent instead of 4, which I suspect is because he also uses Ruby/Rails.
The really ugly
The general editing of the book, and especially the code/output formatting, is the deal breaker here. I have not found another book that fares equally poorly in this regard.
The first paragraph of the preface already contains two very off-putting typos: "Frednick Books" and "MOOSE". The long lines of code/output are wrapped, but it is not clear which lines are wrapped and which are just a new line (some visual indicator should've added like a + or \ sign, line number, or striped background/lines).
There is a plain error in YAML syntax in p67, plain wrong MySQL configuration in p69.
Code formatting/editing is atrocious, with __PACKAGE__ sometimes becomes PACKAGE, or __Package__. Blank lines (which are significant for POD) are removed. And there is some garbage/random characters added in a few places. Totally unacceptable.
Verdict
Unfortunately I cannot recommend this book due to the utterly poor code formatting. I have no major problem with the content though.
Perl Indonesia
2 September, 02:18, by Steven Haryanto, written in English
Read
this older blog post the other day. Hilarious at best, creepy at worst.
Arbitrary limitations should not be added to a general-purpose programming language unless for a really good reason. Do you really want to code in a language that forces you to indent with 2 spaces, never cross 80-column line, or require/forbid whitespace here and there? And besides, is there any language (no matter how strict the syntax of which is) which do not have some sort of coding style?
masak's Journal
1 September, 22:31, by masak, written in English
It is with a peevish exultation of spirit that I announce on behalf of the Yapsi development team the September 2010 release of Yapsi -- soon to be a major motion picture -- a Perl 6 compiler written in Perl 6.
You can download it here (or, if you happen to be on an avian-carrier-based network, you can "pidgeon" it here).
Yapsi is implemented in Perl 6. It thus requires a Perl 6 implementation to build and run. This release of Yapsi has been confirmed to work on both Rakudo Star 2010.08 and Rakudo Star 2010.07.
Yapsi is an "official and complete" implementation of Perl 6. Yapsi's official status has been publicly confirmed by Patrick Michaud, the Rakudo pumking. The claim about Yapsi being complete... well, it might just be what PR people sometimes refer to as "a slight exaggeration". On the bright side, it's becoming less so with each new release.
This month's release brings you unless and until, as well as our-scoped variables:
$ yapsi -e 'my $a = 0; unless $a { say 42 }'
42
$ yapsi -e 'my $a = 0; until $a { say ++$a }' 1
$ yapsi -e 'our $a = 42; { my $a = 5; { say our $a } }' 42
For a complete list of changes, see doc/ChangeLog.
Quite a lot of features are within reach of people who are interested in hacking on Yapsi. See the doc/LOLHALP file for a list of 'em. In fact, that's how isBEKaml++ implemented 'unless' this month. (After which he exclaimed "that was easy!" and tackled 'until'.) If you're wondering whether you're qualified to help with the Yapsi project, that probably means you are.
Yapsi consists of a compiler and a runtime. The compiler generates instruction code which the runtime then interprets. In Yapsi, that instruction code (unfortunately) is called SIC[!]. Until further notice, SIC as a format changes with each monthly release for various, mostly good reasons. However, if you write a downstream tool that makes assumptions about the SIC format, someone might change it just out of spite. SIC is explicitly not compatible with later, earlier, or present versions of itself.
An overarching goal for making a Perl 6 compiler-and-runtime is to use it as a server for various other projects, which will hook in at different steps:
- A time-traveling debugger (tardis), which hooks into the runtime.
- A coverage tool (lid), which will also hook into the runtime.
- A syntax checker (sigmund), which will use output from the parser.
Another overarching goal is to optimize for fun while learning about parsers, compilers, and runtimes.
Have the appropriate amount of fun!
/var/log/rant
1 September, 18:43, by Dave Jacoby, written in English
The 2010 Twitpocalypse has come. Buffy didn't save us this time, I guess. And what that means is that Twitter is no longer doing basic authentication for anything but their home page. So, if you have code like this:
my $twit = Net::Twitter->new(
username => 'varlo',
password => 'ISoLoveEdward' , #No Jacob
clientname => $client ,
) ;
You're kinda screwed.
It's using OAuth now. I don't fully grok OAuth, so if you want the full deal, you should Google it and all, but in a nutshell, there is a key and secret combination that uniquely identifies my application. You use this application and it says "I don't see a user key" and sends you to Twitter. You get a user key and value, and you can use that user key and secret in conjunction with the app key and secret until you decide to go to Twitter and disassociate your user key with the app key.
This means that at no point does the application have your password, the same password that you might use for your pizza delivery, bank, email, etc. Until I began to understand OAuth, I thought it was a PITA, but I now think it's at least 70% win.
I have discussed
Net::Twitter before, so most of the following code has been up before. My preferred way of handling a status is to
join STDIN or ARGV with a space, but there should be enough here for you to adapt it to your workflow.
#!/usr/bin/perl
# largely taken verbatim from
# http://search.cpan.org/dist/Net-Twitter/lib/Net/Twitter/Role/OAuth.pm
# Next step is to get the keys and secrets to a config.
use 5.010 ;
use strict ;
use IO::Interactive qw{ interactive } ;
use Net::Twitter ;
use Carp ;
my $status = join ' ', @ARGV ;
if ( length $status < 1 ) {
while ( ) {
$status .= $_ ;
}
chomp $status ;
}
if ( length $status > 140 ) {
say { interactive } 'Too long' ;
say { interactive } length $status ;
exit ;
}
if ( length $status < 1 ) {
say { interactive } 'No content' ;
say { interactive } length $status ;
exit ;
}
say $status ;
# GET key and secret from http://twitter.com/apps
my $twit = Net::Twitter->new( traits => [ 'API::REST', 'OAuth' ],
consumer_key => 'GetYorConsumerKeyFromTwitterDotComSlashApps',
consumer_secret => 'GetYorConsumerSecretFromTwitterDotComSlashApps',
) ;
# You'll save the token and secret in cookie, config file or session database
my ( $access_token, $access_token_secret ) ;
( $access_token, $access_token_secret ) = restore_tokens() ;
if ( $access_token && $access_token_secret ) {
$twit->access_token( $access_token ) ;
$twit->access_token_secret( $access_token_secret ) ;
}
unless ( $twit->authorized ) {
# You have no auth token
# go to the auth website.
# they'll ask you if you wanna do this, then give you a PIN
# input it here and it'll register you.
# then save your token vals.
say "Authorize this app at ", $twit->get_authorization_url, ' and enter the PIN#' ;
my $pin = ; # wait for input
chomp $pin ;
my ( $access_token, $access_token_secret, $user_id, $screen_name ) =
$twit->request_access_token( verifier => $pin ) ;
save_tokens( $access_token, $access_token_secret ) ; # if necessary
}
if ( $twit->update( $status ) ) {
say { interactive } 'OK' ;
}
else {
say { interactive } 'FAIL' ;
}
#========= ========= ========= ========= ========= ========= =========
# Docs-suggested
sub restore_tokens {
my $access_token = 'GetYrOwnAccessToken' ;
my $access_token_secret = 'GetYrOwnAccessTokenSecret' ;
return $access_token, $access_token_secret ;
}
sub save_tokens {
my ( $access_token, $access_token_secret ) = @_ ;
say 'access_token: ' . $access_token ;
say 'access_token_
Perl-News
1 September, 18:31, by Renée Bäcker, machine translated from German
The Perl Foundation granted an additional Grant Jonathan Worthington to work on Perl 6: Worthington is meta-model of Perl 6 improve. Rakudo Not only but also be NQP-rx benefit from the work. Through the results will also improve the performance. The complete description of the work can be found at http://news.perlfoundation.org/2010/07/hague-grant-application-meta-m.html.
Modern Perl Books, a Modern Perl Blog
1 September, 18:27, by chromatic, written in English
Eighteen months after I started this site, the Modern Perl book is almost out, as is Using Perl 6. Perl 5.10.1, Perl 5.12.0, Perl 5.12.1, and (very nearly) Perl 5.12.2 are out, with Perl 5.14 coming next month.
Rakudo Star has had two impressive releases, which brings Perl 6 to ever more people. The Parrot VM had its 1.0 and 2.0 and 2.3 and 2.6 releases, and if you want an order of magnitude performance improvement in Rakudo Perl 6, the Parrot 3.0 series will deliver some impressive gains through the Lorito reorganization.
I've spent a lot of time critiquing the Perl language and community and even more time critiquing perceptions of Perl from within and without. I'm glad to review what's going right. It's easy to make a list of great new features of Perl and the community, but I can limit it to my favorites, in terms of immediate and longer-term significance.
By no means are these the only important developments in Perl in the past 18 months; please by all means let us all know what you find most important in your own journals and talks and presentations.
- The revitalization of Perl 5 core development has amazed me. Regular monthly releases have become boring, as they should be. A rotating series of release managers helps avoid the burnout that's claimed every Perl 5 pumpking up to this point, and it helps to make the process of releasing a new stable version of Perl 5 easier. That's why you can have confidence upgrading to Perl 5.12.2 when it comes out, and why in a year Perl 5.10.1 will look old.
- I've wanted Plack for Perl for ages; I've long thought Python's WSGI is a good example of the "There should be one obvious way to do it philosophy" (it works much better for interfaces to well-defined problem domains than language features). The rapid adoption of Plack for so many web frameworks and libraries within Perl—as well as the number of backends supported by Plack—has solved many of the deployment problems of Perl web applications. It also allows greater collaboration on middleware, such as debugging and profiling tools.
- Ancillary tools such as perlbrew and cpanminus have demonstrated that very simple interfaces devoted to solving the most common problems can improve the user experience immensely. I've known how to maintain my own user- and app-specific Perl 5 installations for years, but I've never wanted to maintain the morass of symlinks necessary to do so. Now I don't have to. Similarly, cpanminus lets me install CPAN modules often in the time it takes the official CPAN client to download the indexes.
- Regular releases of the first Perl 6 distribution (Rakudo Star) demonstrate the power and consistency and disruptive potential of Perl 6 to even more people. Every month brings new features and improvements. Every bug report and new module written and benchmark help the development community make it an even better platform for new projects.
- Schwern made the CPAN forkable through gitPAN, and the world is better for it. Public distributed version control for Perl 5 improves the experience of submitting changes, and public distributed version control for CPAN distributions has helped me submit and publish more changes too. Noticing a typo in documentation on search.cpan.org has become almost an enjoyable experience, if I can find the appropriate repository on Github, fork it, make my changes, and submit a pull request within five minutes. Often I can.
I look forward to several other projects in the world of Perl, such as Ryan Jendoubi's Ctypes for Perl 5 and the ongoing attempts in the Perl 5 core to rein in a sane set of functions for extensions to use. I've heard that various help forums have become more helpful and less abusive (especially #perl on irc.perl.org). I've even noticed a shift in how community member
/var/log/rant
1 September, 13:19, by Dave Jacoby, written in English
I read some of Douglas Crockford's
JavaScript: The Good Parts on
Safari, using the school's site license. I saw some of the talk videos on YouTube and Yahoo Video. I now have a copy on my desk.
I've even been putting some of my code into
JSLint. It has a warning —
JSLint will hurt your feelings — which is exactly right. I mean,
ow!
I'll say more on this book the more I integrate it into my headspace. I've been getting serious about Javascript over the last few years, after over a decade of being vocally dismissive of it, because changes have made the languages run faster, as has Moore's Law. The first machines I did web development on would be seriously outclassed by first-generation iPhones. I take that back — even the second machines I did web development on are seriously outclassed by first-generation iPhones. And as a programmer getting serious about Javascript, I want my code to be serious, too, not just lame hack stuff. Which is where having JSLint comes in handy.
And where my issues start to come in.
You can see this as having a similar purpose as Damian Conway's
Perl Best Practices and the connected
Perl::Tidy, where you use the tool to outline the changes the book suggests you make. Except, Perl::Tidy gives you chapter and verse as to where to look up the dink and allow you to learn. As I put more code into JSLint, the more I wonder "Why is that?" and so far, I'm not finding the answers in
The Good Parts.
Still, if you're a Javascript programmer, you can probably help yourself out a lot by getting this book.
pmichaud's Journal
1 September, 12:36, by pmichaud, written in English
[This announcement was made last week on rakudo.org -- I'm reposting to use.perl.org so it will show up in the various Perl aggregators. --Pm]
On behalf of the Rakudo and Perl 6 development teams, I'm happy to announce the August 2010 release of "Rakudo Star", a useful and usable distribution of Perl 6. The tarball for the August 2010 release is available from http://github.com/rakudo/star/downloads.
Rakudo Star is aimed at "early adopters" of Perl 6. We know that it still has some bugs, it is far slower than it ought to be, and there are some advanced pieces of the Perl 6 language specification that aren't implemented yet. But Rakudo Perl 6 in its current form is also proving to be viable (and fun) for developing applications and exploring a great new language. These "Star" releases are intended to make Perl 6 more widely available to programmers, grow the Perl 6 codebase, and gain additional end-user feedback about the Perl 6 language and Rakudo's implementation of it.
In the Perl 6 world, we make a distinction between the language ("Perl 6") and specific implementations of the language such as "Rakudo Perl". The August 2010 Star release includes release #32 of the Rakudo Perl 6 compiler [1], version 2.7.0 of the Parrot Virtual Machine [2], and various modules, documentation, and other resources collected from the Perl 6 community.
This release of Rakudo Star adds the following features over the previous Star release:
* Nil is now undefined
* Many regex modifiers are now recognized on the outside of regexes
* Mathematic and range operations are now faster (they're still slow, but they're significantly faster than they were in the previous release)
* Initial implementations of .pack and .unpack
* MAIN can parse short arguments
* Removed a significant memory leak for loops and other repeated blocks
This release (temporarily?) omits the Config::INI module that was included in the 2010.07 release, as it no longer builds with the shipped version of Rakudo. We hope to see Config::INI return soon.
There are some key features of Perl 6 that Rakudo Star does not yet handle appropriately, although they will appear in upcoming releases. Thus, we do not consider Rakudo Star to be a "Perl 6.0.0" or "1.0" release. Some of the not-quite-there features include:
* nested package definitions
* binary objects, native types, pack and unpack
* typed arrays
* macros
* state variables
* threads and concurrency
* Unicode strings at levels other than codepoints
* pre and post constraints, and some other phasers
* interactive readline that understands Unicode
* backslash escapes in regex character classes
* non-blocking I/O
* most of Synopsis 9
* perl6doc or pod manipulation tools
In many places we've tried to make Rakudo smart enough to inform the programmer that a given feature isn't implemented, but there are many that we've missed. Bug reports about missing and broken features are welcomed.
See http://perl6.org/ for links to much more information about Perl 6, including documentation, example code, tutorials, reference materials, specification documents, and other supporting resources. An updated draft of a Perl 6 book is available as in the release tarball.
The development team thanks all of the contributors and sponsors for making Rakudo Star possible. If you would like to contribute, see http://rakudo.org/how-to-help, ask on the perl6-compiler@perl.org mailing list, or join us on IRC channel #perl6 on freenode.
Rakudo Star releases are created on a monthly cycle or as needed in response to important bug fixes or improvements. The next planned release of Rakudo Star will be on September 28, 2010.
[1] http://github.com/rakudo/rakudo
[2] http://parrot.org/
TokuLog 改メ Perlを極めて起業する日記
1 September, 10:18, by tokuhirom, machine translated from Japanese
c9s of http://github.com/c9s/cpansearch PP apart It's good like that? And thought I, PP I big.
#! / Usr / bin / perl
use strict;
use warnings;
use File:: HomeDir;
use File:: Spec;
use Getopt:: Long;
our $ VERSION = 0.01;
my $ mirror = 'http://cpan.nctu.edu.tw/';
my $ localfile = File:: Spec-> catfile (File:: HomeDir-> my_home (), '. cpanspp.gz');
exit;
sub main (
my $ pattern = shift @ ARGV | | die "Usage: $ 0 pattern";
GetOptions (
'Mirror' => \ $ mirror,
'Help' => \ my $ help,
);
make_mirror ();
search ($ localfile, $ pattern);
)
sub search (
my ($ src, $ pattern) = @ _;
open my $ fh, '<', $ src;
while (<$ fh>) (
if (/ $ pattern /) (
print $ _;
)
)
)
sub should_get_index (
my @ stat = stat ($ localfile) or return 1;
return 1 if $ stat <time () -24 * 60 * 60; 9
return 0;
)
sub make_mirror (
if (should_get_index ()) (
require LWP:: UserAgent;
require File:: Temp;
my $ ua = LWP:: UserAgent-> new (
timeout => 20,
agent => "$ 0 / $ VERSION",
);
my $ url = "$ mirror / modules/02packages.details.txt.gz
Cornelius
1 September, 08:44, by c9s, machine translated from Chinese
cpansearch is a CPAN module search tools to write C formed. Provide a simple and fast way to search the module to function, and the ncurses to build a choice to install the interface module (class aptitude), can one choose to install a module to install. No other settings using cpansearch CPAN or CPANPLUS can be used directly.
cpans Usage Description:
$ Cpans-f
Initialization source list
$ Cpans-u
Updated source list
$ Cpans Any
Search Any words
$ Cpans-i any
Ignore case.
$ Cpans-v Any
Verbose output (output version, and module path)
$ Cpans-vv Any
Very verbose. (Output version and the full module path)
$ Cpans - nc Moose
Start NCurses UI.
Develop
Development are now carried out in Github, welcomed the patches and the idea.
Cornelius
31 August, 20:19, by c9s, written in English
On Perl
31 August, 19:58, by ash, machine translated from Russian
Today on "Web planet" an article about anything under the same name: " RIT 2010: Musketeers 0010 years later .
Read it all no need (and there are not passages related to each other). To quote only a couple of places.
It might be true and correct to tell about DevConf, where emphasis was placed on web programming languages (PHP, Perl, Python, Ruby, and for some reason,. NET) - with an element of competition between them. But the right word, to attract converts and turning them into followers of Yap, the price of entry must still reduce to an acceptable level for the students. In this sense, an example sold, merged YAPC:: Russia, he also MayPerl, especially sad. While there may be similar besserebrenichestvo now can only afford to monsters such as Google and Microsoft, for which the problem is to plant on their technology with the already young is especially important and relevant. So do not be sad about.
Leaving behind the stylistic wretchedness of this fragment (and the entire text), officially I can say that the author (in ssyklovski signer Fuente Ovehunoy) is wrong and does not understand the topic.
Conference YAPC:: Russia «May Perl» grew out of the first Russian Perl-Workshop, held in Moscow in 2007. In the next two years under this name it was held only in Moscow, in parallel with other activities in the seven (seven, damn, countries!). In 2010, it is not sold, merged, but rather expanded and created a much as three events: a joint conference in Kiev and two threads on other IT-conference in Moscow.
Name «May Perl» (it is, the issue of literacy, written with a space) in 2010, it was used only once, and not on DevConf in May, and at RIT + + in April.
YAPC:: Russia / MayPerl
Conference RIT - so as matryoshka contained within another conference - ClientSide, RootConf, MayPerl. The last of these as clear, all the "purely about Perl».
The author is mistaken - conference not only about the programming language. It is about community, which is a pearl that "Web planet" and never dreamed of.
The following year the fourth conference of YAPC:: Russia «May Perl» - 2011 will be held in Moscow on 14 and 15 May. A day before the scheduled hakmit about Perl 6, with the participation of world stars.
And in August 2011-On the same team of organizers conducts European conference YAPC:: Europe 2011 in Riga. Suck, drochery, instead of writing nonsense and roll on my colleagues and my projects.
PS A few days ago, an overdue report on the conference RIT + + for authorship Vitaly Filippov. It is interesting to compare fragments of the web of planetary article with this text.
Blog.Perl5doc.ru
31 August, 17:28, by Dinar, machine translated from Russian
The site Perl5doc.ru section CPAN a document,
Mojolicious:: Guides:: Rendering , describing the rendering engine Mojolicious .
Briefly, the "rendering" - a transformation of data from one format to another. In Mojolicious this term means shablonizatsiya, generation status codes http, routing, work with data in a format JSON. As these technologies are implemented in Mojolicious, you will learn from the document Mojolicious:: Guides:: Rendering .
Perl HowTo
31 August, 16:45, by Thomas Fahle, machine translated from German
Parallel:: Iterator by Andy Armstrong allowed the simultaneous (parallel) execution of multiple task on a computer with (preferably) multiple CPUs.
It takes care of Parallel:: iterator to correct inter-process communication, forking and distribution to multiple CPUs, so that one quite fully on the actual task and be able to concentrate.
A very simple example
In this example, a list of square roots of a list of numbers is determined in parallel.
The subroutine square_root, the actual computation is running received as first parameter the index of @ numbers and as a further parameter to edit number
To the results in the correct order @ output, must be returned both index and earnings from square_root.
Case, the order does not matter, can account for the index in the return list.
iterate_as_array care of the parallelization of the subroutine square_root itself.
# / Usr / bin / perl
use warnings;
use strict;
use Parallel:: Iterator qw (iterate_as_array);
# Indices: 0 1 2 3 4 5 6
my @ numbers = qw / 1 4 9 16 25 36 49 /;
my @ output = iterate_as_array (\ & square_root, \ @ numbers);
print join ("\ t", @ output), "\ n";
square_root sub (
my ($ index, $ number) = @ _;
my $ sr = sqrt ($ number);
return ($ index, $ sr);
)
The program will output:
1 2 3 4 5 6 7
Example: Multiple URLs get parallel
This sample had
Perl Developer
31 August, 11:20, machine translated from Russian
Subj. I do not understand what could be the case, when you start with the parameter daemon_prefork see that the server started terribly slow, the application was loading the processor. Begin to figure out strace-th reason:
...
flock (6, LOCK_EX | LOCK_NB) = -1 EAGAIN (Resource temporarily unavailable)
flock (6, LOCK_EX | LOCK_NB) = -1 EAGAIN (Resource temporarily unavailable)
flock (6, LOCK_EX | LOCK_NB) = -1 EAGAIN (Resource temporarily unavailable)
flock (6, LOCK_EX | LOCK_NB) = -1 EAGAIN (Resource temporarily unavailable)
Made: lsof-d 6-p 12980, the conclusion here:
http://gist.github.com/558876
Responsible people, tell me what to do? Because what could be the problem?
OS: CentOS 5.5.
dagolden
31 August, 03:17, by dagolden, written in English
If you work with git, eventually you will want to script something that git doesn't do already and can't be accomplished with an alias. If you use Perl, the Git::Wrapper module makes scripting git easy.
The big advantage of Git::Wrapper is that it wraps the binary version of git, which keeps your perl and git independent. Upgrade perl and not git? Add Git::Wrapper and you're done. Upgrade git while keeping your existing perl? No problem. If you get your git from an OS distribution package, but roll your own perl, then Git::Wrapper is for you!
Git::Wrapper just makes it really easy to pass git commands and get back useful data. It really shines on "git log" commands, as it parses each commit message into Git::Wrapper::Log objects with accessors for id, author, date, and message. For everything else, it's not much more than a wrapper around qx(), but it returns arrays of lines and throws exceptions when things go wrong, which just saves a little time and code.
Here is a short example that I whipped up recently to automate the process of adding a github repository remote for someone when they send me a pull request. (It also uses my Getopt::Lucid module, but as the name suggests, it should be clear what that does.)
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use autodie;
use Git::Wrapper;
use Getopt::Lucid qw/:all/;
# USAGE: github-remote [-r REPO] [NAME]
# NAME -- a github user name (or defaults to 'dagolden')
# REPO -- a github repository path (or is parsed out of my private origin repo)
my $opts = Getopt::Lucid->getopt([
Param('repo|r'),
]);
my $who = shift @ARGV;
# Get a wrapper for the current directory
my $git = Git::Wrapper->new(".");
# Locate the origin repository URL
my ($origin) = grep { /origin/ } $git->remote("-v");
die "Couldn't determine origin\n" unless $origin;
$origin =~ s/^origin\s+//;
$origin =~ s/\s+\(.*$//;
# Parse out the repository path
my $repo = $opts->get_repo;
unless ( $repo ) {
# me@git.example.com:my-repo-name.git
($repo) = $origin =~ m/^[^:]+:(.+)$/;
}
# Set up someone else's github repo
if ( $who ) {
$git->remote("add", $who, "git://github.com/${who}/${repo}");
}
# Or set up my own github mirror
else {
$git->remote("add", "github", "git\@github.com:dagolden/${repo}");
}
That's it. I admit the program is a little crufty because of how I manage my repositories with a private origin that I mirror to a github repository, but there's almost no cruft around interactions with git. Consider this:
$git->remote("add", $who, "git://github.com/${who}/${repo}");
If the command fails (if there's already $who as a remote name), an exception will be thrown. That means I don't have to write any error handling myself, which is perfect for a simple automation program like this one.
Contour Line
30 August, 21:16, by jmarca, written in English
My hair is long since “beginning to grey”, which is becoming a cause for concern. My wife has always said that if my research funding dried up I could always jump to some other job programming. But the article linked above suggests otherwise. Even though I got carded yet again at Trader Joe’s last week, Brooke’s worst case scenario probably is going to be worse than she expects. As I march towards mid-forties and beyond, I’m also in a march towards being unemployable.
While I am not expecting to lose funding for my job in the immediate future, I’ve decided to start making plans for a career path that doesn’t include being a transportation researcher forever. This will hopefully mean that my fallback plan in case of immediate layoffs will get better than some nebulous “something in web tech or programming”.
This blog post is one in hopefully a string that will start looking at options in the intersection of web technologies, programming, and transportation research. To start things off, I’ve listed some random data points in no particular order.
- Activimetrics: About a year ago Craig and I thought it would be a good idea to start a side business. He came up with the name Activimetrics, but that is about all we did with that.
- Market research for sale: Today I got yet another spam for “details of our global intelligent transportation systems market report.” from Research and Markets for the low low price of EUR 2651. I can’t imagine who spends that kind of money for such a report who wouldn’t already have that information available to them. I’ve also always been impressed by RedMonk and their idea of open source analysis.
- My research doesn’t generate much interest: None of the grad students here are jumping to work on my research, but by the same token, none of them are able to contribute significantly to my projects.
- Hot Topics
- Freight modeling is hot
- Activity modeling is hot
- Emissions modeling is hot
- Traffic management revolutions: our California Traffic Management Labs project really is going to redefine how traffic management happens in California
- Blogging: I really suck at blogging
One thing I do have going in my favor is that I like learning, and I’m reasonably good at it. I’ve been playing with CouchDB on the side, and gradually folding it into my day job. I was shocked by the difference between my code and Moose-ified code, esp. MooseX::Declare, so I’ve been working on using Moose. I’m good at JavaScript, but the idioms of the most proficient JS programmers are not mine, so I’ve been studying their code.
But despite the fact that I can stay at the forefront in any technical area, I think I’d prefer to make a difference with a team of people, rather than forever trying to do everything myself. In the end, I think that is the best reason to push to get a side project going.
I also like teaching, just not so much that I want to move away from sunny southern California (or more importantly, make my wife move). I’ve been the one-man shop handling our Sakai install for pushing current topics of research out to Caltrans employees, and I like that work.
Revisiting my random list of things possibly relevant above,
- Activimetrics: Starting a company is more than making up a name and registering it. We need to do something.
- Market research for sale: Apparently people pay for information that is relatively easy to collect, and if I understand RedMonk’s business model, they pay more for custom tailoring of information to their needs. This is something to keep in mind as a steady source of revenue. As a former grad student and current researcher, I know how to collecting information, and I also know that doing it is laborious. At the same time, it is an excellent way to get new hires up to speed with the state of the industry. Further, it has never been easier to disseminate info
transfixed but not dead!
30 August, 20:13, by draegtun, written in English
Its been a while since my last post; summer holidays have inflicted upon me some big distractions! So to ease myself back in gently I’ll I’ve pulled out a (nearly finished but unposted) article from last year (in true Blue Peter tradition!)
This post was inspired by this nice & straightforward blog article: How A Ruby Case Statement Works And What You Can Do With It. I’ve simply converted the Ruby code to Perl and added some so called insightful notes 
Now what Ruby calls case/when statements is more commonly known in computer parlance has the switch statement.
Perl itself has had such a switch statement for quite a while now:
use Switch;
switch ($grade) {
case "A" { say "Well done!" }
case "B" { say "Try harder!" }
case "C" { say "You need help!!!" }
else { print "You just making it up" }
}
However DON’T USE IT!!! Its a source filter and is being deprecated.
Instead use given/when which is the Perl 6 switch statement that was introduced at perl 5.10.
use strict;
use warnings;
use feature qw(switch say);
print 'Enter your grade: ';
chomp( my $grade = <> );
given ($grade) {
when ('A') { say 'Well done!' }
when ('B') { say 'Try harder!' }
when ('C') { say 'You need help!!!' }
default { say 'You are just making it up!' }
}
And at perl 5.12 you could also use when has a statement modifiers:
use 5.012;
use warnings;
print 'Enter your grade: ';
chomp( my $grade = <> );
given ($grade) {
say 'Well done!' when 'A';
say 'Try harder!' when 'B';
say 'You need help!!!' when 'C';
default { say 'You are just making it up!' }
}
And even more enhancements are coming with perl 5.14 because given now returns the last evaluated expression:
use 5.013; # 5.014
use warnings;
print 'Enter your grade: ';
chomp( my $grade = <> );
say do {
given ($grade) {
'Well done!' when 'A';
'Try harder!' when 'B';
'You need help!!!' when 'C';
default { 'You are just making it up!' }
}
};
Which can lead to some very pleasant looking dry code.
But there is more to given/when than just single value conditionals. You can also check multi-values and ranges:
use 5.012;
use warnings;
print 'Enter your grade: ';
chomp( my $grade = <> );
given ($grade) {
say 'You pretty smart' when ['A', 'B'];
say 'You pretty dumb!!' when ['C', 'D'];
default { say "You can't even use a computer" }
}
And also pattern match using a regex:
use 5.012;
use warnings;
print 'Enter some text: ';
chomp( my $some_string = <> );
given ($some_string) {
say 'String has numbers' when /\d/;
say 'String has letters' when /[a-zA-Z]/;
default { say "String has no numbers or letters" }
}
In fact you can use anything that Smart Matching can resolve.
And because smart matching is used under the hood by given/when then you can customise it by overloading the ~~ smart match operator:
use 5.012;
use warnings;
{
package Vehicle;
use Moose;
use overload '~~' => '_same_wheels', fallback => 1;
has number_of_wheels => (is => 'rw', isa => 'Int');
sub _same_wheels {
good coders code, great reuse
30 August, 18:50, by Peteris Krumins, written in English


So I participated in the 48 hour Node.js Knockout competition together with James Halliday and Joshua Holbrook. Our team was called Dark Knights and we created an online chess application called Node Chess.
We didn't quite manage to completely finish the game and it has several bugs, like the turns don't alternate and the king can be captured, but it's crazy awesome anyway. If both players follow the rules, it all works correctly. Castling works, pawn promotion works, capture en-passant also. Try it and if you find it awesome, please vote! Oh, and it works only Chrome. Ancient-browsers-please-be-gone!
Here is how the game looks,

A chess game between pkrumins and someone. King's Indian Defence.
Joshua did all the awesome vector graphics work. I did the chess engine work, and James used his amazing dnode node.js module to blend client and server code together. James has actually redefined how web development happens. Instead of writing server code and client code, as we are so used to, with his dnode framework it's now possible to use the same code both server and client side! Much less hustle and purely ingenious!
Here is the same game in perspective view, the highlighted squares are the available moves,

The same game in perspective view.
And the moves are animated, too! The pawns shoot the opponent pieces and the queen stabs them. Try it!
Right, so my reflections on the competition.
It was well organized, and we were sent access to a Joyent deployment server and a Heroku server early on together with instructions. It turned out that Heroku's didn't support Socket.IO or websockets. Win for Joyent. Pretty much everyone went with Joyent as far as I know. We had some technical difficulties at the start with deploying our code, but guys at #node.js helped us and we got our app running pretty quickly.
We used 3 Git repositories to push the code to, our own GitHub repositories (pkrumins, substack, jesusabdullah), then the node knockout's private repository for judges, and deployment repository on Joyent. Joyent was configured so that as you push your code to its Git repo, the hooks in it would restart the node.js service and the you'd be instantly running the latest version of your code.
So I'd make changes push to my GitHub repo, James would pull from me. He'd make changes, I'd pull from him, and same for Joshua. It went pretty flawless. We had like 12 merge errors total, but those were all resolved within a minute or two.
Now some numbers. We're actually amazed by our performance. Check out these numbers:
$ git log | grep Author | wc -l
429
429 commits! Can you believe that? 429 commits in 2 days! That's 9 commits per hour on average! That is what I call hacking!
My commits:
$ git log | grep Author | grep Peteris | wc -l
169
I did 3.5 commits per hour on average. And funnily, James and Joshua each had 130 commits:
$ git log | grep Author | grep James | wc -l
130
$ git log | grep Author | grep Joshua | wc -l
130
That's 2.7 commits per hour on average! Amazing! But we also slept b
good coders code, great reuse
30 August, 18:50, by Peteris Krumins, written in English
So I participated in the 48 hour Node.js Knockout competition together with James Halliday and Joshua Holbrook. Our team was called Dark Knights and we created an online chess application called Node Chess.
We didn't quite manage to completely finish the game and it has several bugs, like the turns don't alternate and the king can be captured, but it's crazy awesome anyway. If both players follow the rules, it all works correctly. Castling works, pawn promotion works, capture en-passant also. Try it and if you find it awesome, please vote! Oh, and it works only Chrome. Ancient-browsers-please-be-gone!
Here is how the game looks,

A chess game between pkrumins and someone. King's Indian Defence.
Joshua did all the awesome vector graphics work. I did the chess engine work, and James used his amazing dnode node.js module to blend client and server code together. James has actually redefined how web development happens. Instead of writing server code and client code, as we are so used to, with his dnode framework it's now possible to use the same code both server and client side! Much less hustle and purely ingenious!
Here is the same game in perspective view, the highlighted squares are the available moves,

The same game in perspective view.
And the moves are animated, too! The pawns shoot the opponent pieces and the queen stabs them. Try it!
Right, so my reflections on the competition.
It was well organized, and we were sent access to a Joyent deployment server and a Heroku server early on together with instructions. It turned out that Heroku's didn't support Socket.IO or websockets. Win for Joyent. Pretty much everyone went with Joyent as far as I know. We had some technical difficulties at the start with deploying our code, but guys at #node.js helped us and we got our app running pretty quickly.
We used 3 Git repositories to push the code to, our own GitHub repositories (pkrumins, substack, jesusabdullah), then the node knockout's private repository for judges, and deployment repository on Joyent. Joyent was configured so that as you push your code to its Git repo, the hooks in it would restart the node.js service and the you'd be instantly running the latest version of your code.
So I'd make changes push to my GitHub repo, James would pull from me. He'd make changes, I'd pull from him, and same for Joshua. It went pretty flawless. We had like 12 merge errors total, but those were all resolved within a minute or two.
Now some numbers. We're actually amazed by our performance. Check out these numbers:
$ git log | grep Author | wc -l
429
429 commits! Can you believe that? 429 commits in 2 days! That's 9 commits per hour on average! That is what I call hacking!
My commits:
$ git log | grep Author | grep Peteris | wc -l
169
I did 3.5 commits per hour on average. And funnily, James and Joshua each had 130 commits:
$ git log | grep Author | grep James | wc -l
130
$ git log | grep Author | grep Joshua | wc -l
130
That's 2.7 commits per hour on average! Amazing! But we also slept between the competition days. On the both days we did about 4 hours of clean sleep, shrinking our competition time to 40 hours. Then our average becomes 10.7 commits per hour! Wowsers!
Here is a graph, made with Raphael.js, that shows our git commit activity by hour, starting from 3am UTC Aug 28 to 3am UTC Aug 30:
Modern Perl Books, a Modern Perl Blog
30 August, 18:49, by chromatic, written in English
One current discussion on p5p is the namespace of fixed versions of reftype(), refaddr(), and blessed(), recently added to bleadperl.
These functions are part of Scalar::Util right now. Unfortunately, they return undef for non references. This leads to code like:
my $ref_type = reftype( $maybe_ref );
do_something_with_ref( $ref_type ) if defined $ref_type;
(If you don't follow all of the reasons why you have to do that, that's good; you haven't imagined all of the odd and strange ways people might name their classes in various parts of the Perl 5 internals and DarkPAN modules. Safety dictates finding these corner cases.)
Anyhow.
Making these fixed functions available in the core without having to load Scalar::Util offers some advantages but also some disadvantages. It's the "You can't add new keywords to Perl 5" problem. What if someone else defined functions of that name?
Worse, what if someone loads Scalar::Util and imports its functions and expects those semantics instead of the new semantics?
(Apparently it's impossible to detect the declaration or importation of symbols with conflicting names so as to produce warnings or exceptions in this case, though I don't see why. If we were in the habit of declaring the version of Perl 5 our code uses, we wouldn't have these problems.)
The discussion inevitably circled back to the ineffable question of "If this new feature is going in the core, how do people use it in previous releases of Perl 5?" That is, "You've added a new feature to Perl 5 which will be in Perl 5.14 released next year. Is there any way to backport that feature to Perl 5.12? How about Perl 5.10? You know, RHEL 3 is still around. Why do you hate Perl .5.8?"
At some point the weight of ensuring that code written for a future version of Perl 5 can run correctly (if you cram in enough flying buttresses of CPAN shims) on code written for obsolete versions of Perl 5 will pull down the entire edifice. Allowing code written for previous versions of Perl 5 to run on modern versions unmodified (or with a simple use 5.10; at the top—I know a great combination of find and sed which can perform this kind of textual manipulation {and if you're on Windows, use PPT to get portable versions of these tools}) is often good and useful.
Going the other way... well, I don't understand it. If it's possible and someone wants to do it, fine. Why should it block improving the next release of Perl 5 though?
/var/log/rant
30 August, 17:12, by Dave Jacoby, written in English
You might remember me posting
how to post status updates to Buzz, albeit via Perl. I mentioned how I wanted to do the same or similar with Facebook. I got nice suggestions of how to handle it via
WWW::Facebook::API, and I tried to wrestle with Facebook's OAuth or similar implementation to get the access I need to do what I want. And then I figured out another way.
#!/usr/bin/perl
# usage: echo big long string of text | facebook.pl
# returns "big long string of text"
use 5.010 ;
use strict ;
use warnings ;
use Carp ;
use Data::Dumper ;
use Net::SMTP::TLS ;
use Getopt::Long ;
use IO::Interactive qw{ interactive } ;
use subs qw{ send_mail get_credentials } ;
my $status = join ' ', @ARGV ;
if ( length $status < 1 ) {
while ( ) {
$status .= $_ ;
}
chomp $status ;
}
my $identity = 'MY_IDENTITY_STRING' ;
my @to ;
push @to, 'GETYOUROWNSPECIALEMAILFROM@m.facebook.com' ;
my $body = $status ;
my %msg ;
$msg{ body } = $body ;
$msg{ to } = \@to ;
$msg{ cc } = \@cc ;
say send_mail %msg ;
exit ;
sub get_credentials {
#this is the point where my setup sucks
my %creds ;
my $config = '/home/jacoby/.smtp_identities' ;
if ( open my $fh, '<', $config ) {
while ( <$fh> ) {
my $line = $_ ;
chomp $line ;
$line = ( split m{\#}mx )[ 0 ] ;
next if length $line < 1 ;
$line =~ s{\s}{}gmx ;
my @line = split m{,}mx, $line ;
next if $line[ 0 ] ne $identity ;
$creds{ from } = $line[ 1 ] ;
$creds{ server } = $line[ 2 ] ;
$creds{ username } = $line[ 3 ] ;
$creds{ password } = $line[ 4 ] ;
}
close $fh ;
}
if ( defined $creds{ username } ) {
return %creds ;
}
say 'No identity chosen' ;
exit 1 ;
}
sub send_mail {
my %msg = @_ ;
my %creds = get_credentials ;
my $body = $msg{ body } ;
my $to = $msg{ to } ;
my @to = @$to ;
my $mailer = new Net::SMTP::TLS( $creds{ server },
Hello => $creds{ server },
Port => 587,
User => $creds{ username },
Password => $creds{ password }, ) or croak $!;
$mailer->mail( $creds{ from } ) ;
$mailer->to( @to ) ;
$mailer->data ;
$mailer->datasend( 'Subject: ' . $body . "\n" ) ;
$mailer->datasend( 'From: ' . $creds{ from } . "\n" ) ;
$mailer->datasend( 'To: ' . ( join ',', @to ) . "\n" ) ;
$mailer->datasend( "\n" ) ;
$mailer->datasend( '' ) ;
$mailer->dataend ;
$mailer->quit ;
return $msg{ body } ;
}
I already had it, so I just had to modify it slightly, but it came to me. You can set status and upload images via email. I just hand to double-check the right way — statuses in subject, not body — and came right up.
get_credentials is my method for not hard-coding information into the code, and here I do exactly that for the
$to email and the
$identity string.
I could see using the big and scary Facebook API if I wanted to code up the next
Farmville. I know my wife wants me to do that. But for this small purpose, there's little need to go through all that.
olegm
30 August, 15:31, by leonard, written in English
On this Thursday at 8:00 PM I will be holding the first organizational meeting for Frozen Perl 2010.
We will be meeting at
Overflow Expresso Cafe in Minneapolis.
If you are interested in helping organize workshops and conferences please reply below and attend. I look forward to hearing from all of you
Khaos
30 August, 12:33, by karen, machine translated from Japanese
I Submitted my 10 Things To Do With A Conference T-shirt Talk to YAPC:: Asia . I Could Give this Talk in English, but I've been in Japan for over three years and Now I Think it's time to attempt a Japanese Talk . There is no way that I am ready to give a full-length talk in Japanese but I should be able to manage 5 minutes.
I have written the talk description in Japanese, which I will include in this post, and today I started translating the talk. There is no way that I can ad lib in Japanese so this is going to be my most prepared talk I have given since I stopped doing public speaking competitions!
10 Things to conference T-shirt.
YAPC I have ever attended a meeting of twenty. So the conference has a ton of T-shirts. We're talking about now is how did that for my T-shirt.
Анатолий Шарифулин
30 August, 09:28, machine translated from Russian
Send mail to Mojolicious - easily using
Mojolicious:: Plugin:: Mail .
And who pizzhi can send email from a web application?
Requirements: letter from the design template, the theme of the letter there in the code only to whom and dispatch.
In Mojolicious it this way:
- Connection
$ Self -> plugin (mail => (
from => 'sharifulin@gmail.com',
encoding => 'base64',
type => 'text / html',
how => 'sendmail',
howargs => ['/ usr / sbin / sendmail-t'],
));
- Using the controller
my $ data = $ self -> helper ('render_mail', 'user / signup');
$ Self -> helper ('mail', mail => (
To => 'sharifulin@gmail.com',
Subject => $ self -> stash ('subject'),
Data => $ data,
));
- Template (user / signup.mail.ep)
% Layout 'default', subject => 'Subject', title => 'Thank you';
<p> This HTML </ p>
- Template with the design (layouts / default.mail.ep)
<h2> <% = $ title%> </ h2>
% = = Content
<p> Footer </ p>
More examples of the generation of letters to Mojolicious
here
use Mojolicious or die;
use Perl or die;
JFDI
koorchik's Perl blog
30 August, 09:20, by koorchik, machine translated from Russian
Internal Server Error
30 August, 02:34, machine translated from Russian
But
Karl tells step by step , as the classical implementation of Pascal's triangle can be sunk to
my @ pascal: = do [1], -> @ p ([0, @ p Z + @ p, 0]) ... *
very Perl6.
Dereferenced.com
29 August, 23:16, by rjray, written in English
Version: 3.230
Released: Sunday August 29, 2010, 04:00:00 PM -0700
Changes:
- imgsize
- lib/Image/Size.pm
perlcritic clean-ups from new rules.
- lib/Image/Size.pm
- t/Test_emf_small.emf (added)
- t/all.t
RT #59995: Added support for Windows Enhanced Metafile Format (EMF).
- t/00_load.t (deleted)
- t/01_pod.t (deleted)
- t/02_pod_coverage.t (deleted)
- t/03_meta.t (deleted)
- t/04_minimumversion.t (deleted)
- t/05_critic.t (deleted)
- xt/00_load.t (added)
- xt/01_pod.t (added)
- xt/02_pod_coverage.t (added)
- xt/03_meta.t (added)
- xt/04_minimumversion.t (added)
- xt/05_critic.t (added)
Move the author/distro-sanity tests to an “xt” directory.
Perl Developer
29 August, 14:30, machine translated from Russian
# curl-L
http://cpanmin.us | perl - - self-upgrade
# Cpanm Task:: Dancer
# Cpanm Starman
# Dancer-a NewProject
Psychology of Programming
29 August, 11:44, by admin, written in English
Tony Schwartz/Harvard Business Review has an interesting bullet point list of what is necessary to excel in any field: Six Keys to Being Excellent at Anything
It’s based on Anders Ericsson’s work in the field, and holds as well for computer programmers as practitioners in any other field.
See also: Accelerate your Perl learning
Psychology of Programming
29 August, 11:40, by admin, written in English
The video recording of my talk from YAPC::NA on the Psychology of Perl is online. It has a very funny beginning when Tatsuhiko Miyagawa walks into the room receiving standing ovations as I start my talk, which is really weird in the video. Still made for a fun start of the talk…
I have to admit I haven’t watched the whole video myself, but word around is that people liked it. Which is motivating for putting together a larger, more detailed talk for a smaller interested audience, rather than a quick overview for a generally less-than-interested audience.
Donnie Knows - Perl
29 August, 11:12, by macnod, written in English
I was recently talking on the phone with a person who lives at least 2,200 miles away and whom I'd never met or spoken to before. This is a surprisingly common occurrence in this day and age. I was explaining some of the things that I like about Perl. When I got to the part about how I love writing 4 or 5 lines of code where programmers of other languages have to write 20 or 30, my new friend hinted that he thought I was talking about completely unreadable Perl code.
read more
Perl Developer
29 August, 09:54, machine translated from Russian
wants to raise on his servake wiki where I and my family will add a variety of information (mainly going to use it as a hierarchical storage options with short kamentami, the bulk of the changes will do all the same I).
It is necessary that the wiki was more or less fonts. Beautiful design is not required.
Encourage your wiki that
* Does not require half-CPAN'a (in particular, Catalyst :-) and that was in better in terms of consumption of RAM
* Works under mod-pearl
* Uses a filesystem (or sqlite) either mysql for data
Perl HowTo
28 August, 17:45, by Thomas Fahle, machine translated from German
Both Perl and stand at this year's presentations were FrOSCon accepted very well.
Presentations of the Perl Developer Rooms
The following is a summary of the slides of the presentations of the Perl Developer Rooms at FrOSCon 2010:
Team
The success of the stand and the talks would be without the volunteers have been impossible. Deserve special thanks:
See also
Missing contributions and additions please as a comment. Thank you.
Игорь Пашев
28 August, 16:41, machine translated from Russian
Nakovnokodil script to rename files "Star Trek"
on the basis
of data Wikipedia .
"Star Trek" download know where.
#! / Usr / bin / env perl
use strict;
use warnings;
use integer;
use utf8;
use open qw (: utf8: std);
use File:: Find ();
use File:: Basename;
use vars qw / * name * dir * prune /;
* Name = * File:: Find:: name;
* Dir = * File:: Find:: dir;
* Prune = * File:: Find:: prune;
my $ REGEX = q ^ <td align= "center"> (\ d +) \. (\ d +) </ td> <td> «<b> (.+?)</ b>» <br> .* ? lang = "en" >(.+?)</ span> ^;
$ REGEX = ~ s # \ s + # # G;
$ REGEX = ~ s #>? <#>? <# G;
my $ CNT ='';
while (<STDIN>)
(
s / (\ n | \ t \ r) + / /;
s / \ s \ s + / /;
$ CNT .= $ _;
)
print '#! / bin / bash
set-e
set-u
';
my% SER = ();
while ($ CNT = ~ s / $ REGEX / / i)
(
# Print qq # "$ 1x $ 2 - $ 3 ($ 4). Avi" \ n #;
$ SER ("$ 1
Hacking Thy Fearful Symmetry
28 August, 07:33, written in English
[yanick@enkidu shuck]$ perl -V:news
Do you regularly scuba dive in a motley sea of other peeps' codebase, trying to bring on surgical changes without doing too much collateral b0rking on the code formatting? If so, Steffen Mueller has a nifty trick to share with you. Using Text::FindIndent, he shows how to configure Vim such that it can magically adapts to any indentation policy.
Talking of Vim, Andy Lester let us know that Vim 7.3 is out, with a bunch of upgrade to its Perl-related support files (and that includes brand-new support for Perl 6).
CPAN is great, CPAN is awesome. But, as we all know, the leviathanesque amount of distributions it contains is sometime daunting. Which module should I use to perform $random_task? Jesse Thompson proposes to look at how many other modules are dependent on a distribution as a metric, and provides a greasemonkey script to retrieve that information straight on the CPAN search page.
This year we've seen the rise of a lot of über-cool cpan* and perl* utilities. The latest, announced by Cornelius, is a little speed-demon called cpansearch. Written in C (which gives it mongoose-like response time) it is a module searching tool. Already cool on its own
$ time cpans XPath | head
Source list from: http://cpan.nctu.edu.tw/modules/02packages.details.txt.gz
Apache::AxKit::Language::XPathScript - 0.05 (M/MS/MSERGEANT/AxKit-1.6.2.tar.gz)
Apache::XPointer::XPath - 1.1 (A/AS/ASCOPE/Apache-XPointer-1.1.tar.gz)
AxKit2::Transformer::XPathScript - 0 (M/MS/MSERGEANT/AxKit2-1.1.tar.gz)
B::XPath - 0.01 (C/CH/CHROMATIC/B-XPath-0.01.tar.gz)
Cindy::XPathContext - 0 (J/JZ/JZOBEL/Cindy-0.15.tar.gz)
Class::XPath - 1.4 (S/SA/SAMTREGAR/Class-XPath-1.4.tar.gz)
Config::XPath - 0.16 (P/PE/PEVANS/Config-XPath-0.16.tar.gz)
Config::XPath::Reloadable - 0.16 (P/PE/PEVANS/Config-XPath-0.16.tar.gz)
Email::MIME::XPath - 0.005 (H/HD/HDP/Email-MIME-XPath-0.005.tar.gz)
real 0m0.168s
user 0m0.016s
sys 0m0.020s
it can yet achieve higher levels of radness if combined with other Perl tools like cpanm:
# install all that is tiny
$ cpans -n Tiny | cpanm
YAPC::NA and YAPC::Europe came and went, but Karen Pauley reminds us that there's still YAPC::Asia happening in Tokyo in October, and that the tickets are now on sale.
What? Didn't attend any YAPC::* yet this year? Oh well, at least Matt S Trout points us where we can download videos of some of their talks.
Have you noticed that you can't use the 5.10 features (like the smart match, say, given / when) under the Perl debugger? Pablo Marin-Garcia did, and dug to find out why. Also check the comments for a dirty way to force the debugger into a more modern attitude.
Moose is a mighty beast, but it's not the fastest ungulate you'll ever meet. But thanks to Dave Rolsky, it now compiles 10% faster than it used to. w00t!
Alberto Simões reports that the
Perl Indonesia
28 August, 01:23, by Steven Haryanto, written in English
I maintain code for a few daemons/services written in Perl (most of them serve requests by forking/preforking). Reading
post on Ubic, I started to feel that I am reinventing a lot of wheels. Currently I am doing these by writing my own code, as much as which I hope can be offloaded to CPAN in the future:
- Autorestart when process size is becoming too big. We need to do this gracefully, meaning wait until there is no more clients being serviced, unless process size really gets too big in which case we need to restart immediately. Checking period can be configured.
- Autorestart if script or modules change on disk. Also needs to be done gracefully. This is usually being recommended to be used only on development environment, but I use this too in production, for ease of deployment. But we need to check first (e.g. via "perl -c" or "eval + require" whether the new code from disk is okay.
- Avoid duplicate instance (currently always using Proc::PID::File, but I'm open to better mechanism).
- Limit clients concurrency. Sometimes this is simple (a single limit for all clients) and sometimes not so much (different limits for different IP/IP blocks/authenticated users/groups/etc).
- Reap dead child processes and maintain a count of child processes.
- Handle timed out clients. This is rather cumbersome with blocking I/O.
- Write init script. This is the part I dislike the most, since there are tons of different OS flavors out there, and with more recent efforts like upstart, launchd, systemd, sooner or later I will certainly have to write different init scripts. I wish there is something equivalent to PSGI/Plack for general services, which can plug my code to whatever service manager might be out there.
Хабрахабр: Метки / perl
27 August, 16:36, by pentarh, machine translated from Russian
Based on
Writing a plugin for Nagios
Actually, pykh-pop is good. However, in this article I want to draw attention to the CPAN-module
Nagios:: Plugin , which makes it much easier to write a Nagios plug-in Perl, and readability of source code.
Example - the plugin to verify that the login to a remote FTP. As part of standard plug-ins I have such functionality not found on this quickly and accurately wrote this.