Test Post - sorry for the noise
Hopefully some syndication to my other site will work.
Once again sorry for the noise.
Hopefully some syndication to my other site will work.
Once again sorry for the noise.
We're starting our usual monthly DC Perl Mongers meeting a bit early this Tuesday (September 7th) to have a little pizza and celebrate Rakudo-Star! Arrive at 6:30pm at the Starbucks at 18th and K Street NW (call me, Brock, if you miss us and need to be let in, number on the website) if you want food. But feel free to wander in any time thereafter, we usually stay as late as 10:00pm. We'll swoop down and look for people at the normal 7:30pm time too :)
Other activities:
* Bring your laptop!
* Installing Rakudo-Star
* Giving hands-on tutorials
* Beginner and Advanced welcome!
* Never been to DC.pm before? No problem, come have some free pizza!
Please put your name on http://dc.pm.org/Rakudo-Star_Party (or email the mailing list, which can be found at http://dc.pm.org/) so we know how much food to get.
If you have any questions, email the list or me directly -- awwaiid@gmail.com will do :)
About Rakudo Star: "Rakudo Star" is a useful and usable distribution of Perl 6. Current releases are aimed at "early adopters" of Perl 6. We can tell you ALL about it when you arrive :)
I am still slowly working my way through Dist::Zilla attempting to get the config that works for me...
I suspect that the plethora of PluginBundles:: personid are down to it being very hard to slightly modify a config other than by writing it out in full or by nasty filtering gymnastics... For example I've been building a Task:: module for work - this pulls in everything I want as a base system on our servers. I started with an existing Task module, git cloned it, and modified it into the form I wanted - bringing along the initial Dist::Zilla config and changing that to suit as well. The dist.ini file worked well for it - I just wanted to make 3 changes:-My mad experiment in CPAN mirrors has grown a couple of new tentacles. Previously it could be a perl-X.Y.Z-specific mirror, such as the CP5.6.2an, or an OS-specific mirror such as the cpMSWin32an. Now it can combine the two such as in the CP5.8.8-irixAN and all of those can also be combined with a date/time to only include stuff that was already on the CPAN as at that time, such as at the CP2000AN.
Why do this? Let's assume that you have a large complex application which uses lots of stuff from the CPAN, and depends on Elk version 1.009 and ListOfDogs version 5.1, and will break with any later version of Elk (or of ListOfDogs). You get a feature request from
a user, and think "ah-ha, there's a module for that", and so you go to install Some::Module. Unfortunately, the latest version of Some::Module depends on Elk 1.234, so your CPAN client merrily upgrades Elk, breaking everything. Doom and Disaster. Having a CPAN "mirror" nailed to the date of the last release of Elk and ListOfDogs that works for you will save you from pain, suffering, and the Dark Side.
One of the problems with the Ironman Challenge is that it’s too successful! I’m sure I saw an interesting post about daemoni[sz]ing scripts … can I find it now? Of course not!
EDIT: Perseverance paid off! Here’s the sneaky post I was looking for!
The Pittsburgh Perl Workshop 2010 will be Saturday October 9 and Sunday 10 at the Gates Center at CMU.
Don't miss your chance to speak at this years Workshop. The Call For Papers ends Monday Sept 6.
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.
Yes, Dave Vaux, one of the british daves helps me translating my perl 6 tutorial and I'm writing here and there new lines into it. More important I'm reading synopses again. Im chatting with the Perl 6 crew again. What a great feeling, even jnthn is currently traveling. But I'm doing it more focussed then earlier. And when I learn something it gets immediately into stuff i write for the wiki, talks, slides. And to all of you who also stay at perl booths, I will try deliver them also in english. At least in a git so then TPF and bunch aroung gabor can do something out of it. Yes one more promise, but my perl 6 talk for mrccc is getting currently not so bad, so im hopeful to deliver there something too.
Occasionally I find a bug in someone's module and post a patch or a bug report. About half the time, the bug is fixed and the new module is released in less than a week. Could be better, but not too shabby. However, about the other half of the time the bug either goes unanswered, or I hear back from the module author that the patch needs to wait until some big release that they are waiting on. I hereby declare bullshit on that. Dist::Zilla makes it so ridiculously easy to push out a release that there is no longer a reason to wait on pushing a bugfix release immediately.
I’m done with Readonly. It has served it’s purpose but I’m frustrated to the point of writing a replacement. I still think it’s a good idea to declare variables readonly, but as an implementation I find Readonly unworkable. The problem is two-fold.
Readonly hasn’t been updated in 6 years. It has collected quite a list of bugs. Not all of them can be fixed, but most that can be are either trivial or already have patches. Fact is it hasn’t been done and I have my doubts on whether it will be done.
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?
It wasn't fun finding out that some legacy code creates a bunch of filehandles on the fly to do logging.
package Some::Client;
use Some::Logging::Module;
# later ...
print MAGICLOGHANDLE $some_data;
That MAGICLOGHANDLE is dynamically generated and shoved into my namespace (along with a ton of other handles, one per log). So I needed to test what was being printed to it. Fortunately, Perl's dynamism makes this really, really easy.
I'm happy to announce the release of Test::Class::Filter::Tags. This module uses the new filter support introduced in version 0.36 of Test::Class to allow selective running of Test::Class tests.
With the filter support of Test::Class, it's now possible to supply any number of filter subs, when running Test::Class tests. Each filter is given the opportunity to suppress the running of each test; If any filter says to suppress a specific test, that test will not be executed.
Using this mechanism, when Test::Class::Filter::Tags is used in your
Test::Class classes, you can specify 'Tags' attributes on non-fixture
(ie, not startup, setup, teardown or shutdown tests). When running tests,
you can set an environment variable of TEST_TAGS
, to run only the subset
of the tests that have the specified tags. Conversely, you can limit a
subset of tests that have specified tags via the TEST_TAGS_SKIP
environment
variable. Both of these vars can be used to give even more granularity in
deciding what tests are run.
In my previous post I showed most trivial example of ubic service.
Now it's time to talk about more interesting stuff :)
Every ubic service is simply a perl object which implements start/stop/status methods.
It is very similar to /etc/init.d shell scripts, but since perl is a real programming language, you don't have to copy-paste tons of boilerplate code every time (Dave Rolsky, if you're reading this - your silki init script is good, but "apache2-backend" line in comments means it was copy-pasted too; is there anyone who can actually write proper init script by hands?).
又名:如何用一行Perl 6打印杨辉三角前n行。
从此时开始到目前为止,网上至少有三篇关于如何用Perl 6打印杨辉三角的文章:这里(TimToady), 这里(Moritz), 和 这里(Masak)。
"There's more than one way to do it.",好吧,我也来写一个,下面这行代码打印杨辉三角的前10行:
([1], -> @p { 0, @p Z+ @p, 0 } ... *).[^10].perl.say;
(......多少都有些抄袭的嫌疑,其实就是直接拼成一行了,不是吗?:))
简单解释下:
"infix:<...>
"称为"Series Operator"(S03),相当于把对一个块的求值结果push
到最前面的List
里面,直到满足右边的条件为止。比如:
(1, {$_ + 1} ... 5).perl.say;
→ (1, 2, 3, 4, 5)
"*
"在这里是一个被叫做"Whatever
"(S02)的东西,在这里起构造惰性求值列表的作用。
中间自"-> { }
"起,是一个由"->
"(S06)构造的轻量型匿名函数块,即要应用("apply")的部分。类似于Perl 5中"map BLOCK LIST
"的"BLOCK
"。同时,"Z+
Operator"(S03)将两边列表结对相加。关于此操作符的用法举例如下:
(1, 2, 3 Z+ 4, 5, 6).perl.say;
→ (5, 7, 9)
额外一提:"Z+
"属于"Zip Operator"系列,类似的还有"Z~
",可以用它实现成对字符串拼接:
(1, 2, 3 Z~ 4, 5, 6).perl.say;
→ ("14", "25", "36")
现在,把代码中的"10
"改成需要打印的行数,就可以实现"用一行Perl 6打印杨辉三角前n行"了。:)
顺便说下,现在想试试Perl 6的话用不着安装,直接Try Rakudo!
There's really nothing extraordinary about this and certainly nothing specific to Perl 6, but I really liked how it felt writing code to find prime factors. I do note, however, that the habit of using a dash instead of an underscore in identifiers does slow down the Perl 6 to Perl 5 translation (since I'm doing that manually). Hopefully we won't need to keep doing that translation in the future.
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:
Poker tourney with buyins going to the TPF, and higher end schwag going to the winners?
I am currently in the middle of trying a new mechanism to deploy perl applications (several which are catalyst based) on servers at work while attempting to keep the level of supporting system (ie perl and the required modules) maintenance work to a minimum whilst being able to use modern perl - and we are running on Centos systems by default, so currently the system perl is 5.8.8. I intend to write about my proposed solution to this in a few weeks when I have had more of a chance to see how it works...
However as part of this I have been building perl and a whole raft of supporting modules under a set of build system scripts - encouragingly the whole build appears to be around one hour in length.
What I wasn't expecting to see was test failures when building the modules.
I really wasn't expecting to see a set of failures down to the tests failing in XML::Parser - thats a widely used and slow changing module.
So I went digging... and finally got to the Red Hat Bugzilla entry #556415.
A undertested security fix to expat had caused a regression - which went unnoticed other than by the XML::Parser test suite.
Thats a big win for the perl testing culture.
I broke $work yesterday when a change I'd made that I thought was mundane was not in fact. I'd changed some code from: if ( keys %$hash_ref ) {
to if ( %$hash_ref ) {
under the theory that we weren't supporting any perl less than our current production at perl-5.10.0.
What I'd completely missed was that $hash_ref
might be undef
and that keys %$...
would auto-vivify the hash if necessary. Previously, the hash would be created as a side effect of dereferencing it. Afterward, I got an exception because the hash wasn't being automatically created just by looking at it.
The reason for this is keys()
is actually an lvalue, something you can assign to. The meaning of keys( %... ) = 8
is actually fairly obscure and not what you would guess if you haven't read the documentation for keys()
. Because keys()
is an lvalue, the dereference %$...
will auto-vivify anything necessary because I might want to modify it.
When I dropped the usage of something strictly defined as an lvalue function, the dereference stopped auto-vivifying and now I had exceptions in production. Wheee!
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.