function return in scalar context

sub lowercase {
    return map { lc } @_ ;
}

$jim = lowercase('jim') ;
print "$jim\n" ;

Naturally that this snippet of code prints 1. I understand the explanation of "an array in scalar context blah blah blah". But it's so counter-intuitive because many functions are intended to mutate each element in a list. Presumably one should define separate functions depending on whether an array is expected, but that's so non-perlish. There's no elegant way to throw the wantarray operator in that example function. And even if there was, it's awkward to use the same idiom repeatedly.

I'd prefer simply to use a pragma such as the following:

Salt Lake Perl Mongers welcome Damian Conway, August 1st

Salt Lake Perl Mongers, with help from Bluehost, and Utah Open Source are pleased to announce a special presentation by Damian Conway:

Temporally Quaquaversal Virtual Nanomachine Programming In Multiple Topologically Connected Quantum-Relativistic Parallel Spacetimes...Made Easy!

Now who could miss that?! (It is free, after all.)

Date: Thursday, August 1st at 7:15pm (Parking is free after 7:00pm.)
Location: Utah Valley University, Liberal Arts Building, Room 101.

Reservations are recommended; visit the Salt Lake Perl Mongers website for details.

The talk will last about 90 minutes, followed by a Q&A session. If you're within driving range of our venue in Orem, UT, or happen to be in Utah August 1st, -- quoting one of our members -- "Your nerd card will be revoked if you miss this."

Here's the synopsis of Damian's talk:

Firebase with perl

I was looking at ways to add instant notifications for a social feature that we are working on for the new version of Brainturk.com, I came across Firebase which is a scalable real-time backend database that makes it easy to build real time apps.

I wanted to use this from my server as well as from Javascript and looking at their libraries for custom generators they have libraries for ( php, python, ruby, node, java , .net ) but no perl library was available.

The beauty of CSV

So I'm working on a site right now that will be powered by Perl on the back and d3.js on the front.

And here's what I'm loving about d3, I can feed it CSV files. Yup. Not JSON. Not XML. Good old CSV.

I know, it's a bit primitive. And there's a good chance at some point I end up JSONing everything up. But I love me some CSV. And there are 551 CPAN packages for pushing, pulling, parsing, encoding or otherwise mangling it.

A note for users of Tree and Tree::Binary

There used to be 2 Tree::Binary modules on CPAN: One standalone and one within
Tree. The latter is now Tree::Binary2.

Please ensure the one you're using is the one you think you're using!

'Nuff said.

Figures from Week One of London Perl Workshop

It has been a week since the announcement of the London Perl Workshop hit the inboxes of all those on the announce list and was first populated across the internets. In the first of a series of weekly reports we look at what has happened in the past seven days in our Facts and Figures news.

Sponsors:
We have been happy to announce a new sponsor in the first week and the enticing news is that there should be a few more joining them in next weeks news (as evidenced by the news items today). We would like to firstly say a big hello to AntibodyMX, Magnum Solutions, Shadowcat Systems, the Enlightened Perl Organisation and the University of Westminster who joined us before the announcement last week. Joining them has been Nestoria who have been a long time supporter, sponsor and contributor to the event, it is good to have you along.

Submitted Talks:
We have had two talks submitted already:

John Davies has submitted: Bug driven documentation

Traits, traits and more traits

So, a few days ago I posted about adding p6-style traits to the p5-mop, a couple days later I posted about how they helped me keep things simple when adding overload support to the p5-mop. Since this is a new approach and has not had the benefit of battle testing that the subclass/role heavy Moose approach has, I have been experimenting with it to see how far it can be taken.

Perl 5 Porters Weekly: July 8-14, 2013

Welcome to Perl 5 Porters Weekly, a summary of the email traffic of the perl5-porters email list.

Topics this week include:

  • experimental? internal functions with M flag
  • experimental? Sun Studio Compilers for Linux OS
  • perlopentut branch for review

A generator object for Perl 5

I have recently started a new job and it has forced me to learn more Python than I have ever had need to learn. I decided that I should take this as an opportunity to learn, and as Miyagawa-san has often done, steal when possible.

One thing that fascinated me is Python’s yield or generator pattern. In this pattern, you can make a function (or my case an object) which implements a lazy iterator returning a value (or possibly values (see below)) without leaving the while loop that generates them.

Decadon: Registration

This year the London Perl Workshop has taken the bold step of having tickets for the event. They are priced in four stages and are entirely voluntary as to which stage you purchase:

Workshop Attendee (zero pounds)
The London Perl Workshop is a free to attend event which means we place no fiscal barrier to being there. All persons are eligible for a ticket.

Workshop Friend (twenty-five pounds)
A friend of the Workshop is helping to support the event they respect, and we admire your brio in doing so.

Workshop Lover (fifty pounds)
Wow, you really like us, and this stunning contribution will be used at this event and next year.

Workshop Sponsor (one hundred pounds)
You realise this makes you a SPONSOR! It also makes you a star, contributions at this level are making a great impact and we thank you for making that special choice.

Return to Perl

Perl was the first language I loved. So, for a project I'm working on it's time to go back to her.

More on the project in later posts. But I'm hoping it's something that will take the world by storm.

On Starting a Perl Mongers group in the Philippines

Following up to szabgab's blogpost: a couple of years ago, I called out for people interested in getting together to make a new Perl group here in my country, the Philippines. I saw that there were already some registered Perl mongers groups in pm.org for Makati, Manila, and elsewhere, but all of their websites, and even the contact persons listed form, were simply inactive or unreachable. There were a few people responding to my call, but I made the mistake of not following through to that call myself, due to other circumstances happening at that time.

How to create portable web application in Perl

How to create portable web application in Perl

I'm Yuki kimoto, Japanese perl programmer.

I like creating web application by perl.
I release GitPrep a few weeks ago.

This is very portable web application and inatallation is easy.
Requirement is only Perl 5.8.7.
What technology is used?
I explain a little.

GitPrep(Github)

cpanm

cpanm is very good. cpanm can specify module version in cpanfile.

this is cpanfile.

    requires 'DBI', '== 1.625';
    requires 'DBD::SQLite', '== 1.37';
    requires 'Object::Simple', '== 3.09';
    requires 'DBIx::Custom', '== 0.28';

And I prepare setup.sh. this is automatically setup script for application.

Build Something People Want

A while back I said "just build something”. That was a bit of a lie. You need to build something people want. Don’t be the one who builds something s/he thinks people want. Make sure. Do you want it? Are you building it for someone who will use it immediately? Do you work somewhere that could use it if it existed? Do some basic market research. If you build something people want, then you’re already on your way to success.

[From my blog.]

Installing Term::ReadLine::Gnu on OS X, the easy way

If you try to install Term::ReadLine::Gnu on Mac OS X, you will ordinarily run into this unpleasantry from the Makefile.PL (which will likely end up in such as ~/.cpanm/build.log):

The libreadline you are using is the libedit library. Use the GNU Readline Library.

Here I will assume that you are using Homebrew and have installed GNU Readline:

brew install readline

Even so, you will get this error. This is because of how Homebrew installs Readline. Since OS X ships libedit as libreadline, Homebrew tries to avoid conflicts with system software by installing Readline as “keg-only” software – that is, it’ll install it within its package-managed filesystem hierarchy beneath /usr/local/Cellar, but it won’t link the libraries into /usr/local/lib, so that they won’t be visible to software that isn’t explicitly linked against it.

There is an easy and obvious way around this:

Update on the licenses and the repository links on CPAN

In December 2012 I checked how many Perl modules on CPAN have license information, and link to their repository in their META files. Later, in February 2013, I published an update.

Today I checked the 1,000 most recently uploaded modules again:

DateHas licenseHas repository link
December 201282.6%49.6%
February 201383.4%49.7%
July 201387%60.1%

It's a nice improvement, but remember these are the 1,000 most recent uploads. The percantages would be a lot lower if we looked at all the packages currently on CPAN.
I think both of these numbers should be around 99.7%.

If you'd like to check your module, you can use the metacpan_meta.pl 1000 PAUSEID command with you PAUSEID after installing MetaCPAN::Clients. That will show the 1000 most recent upload for the given PAUSEID. Even if some of them were 5 years ago. It will also show the list of offending distributions.

If you'd like to update them, here are two articles I wrote showing how to make that happen:
link to repository and add license field to META files.

The grep test - my personal experience

Possible you've read the grep test, particularly if you read Hacker News. The premise of "the grep test" is that if you write code that is not greppable, you fail "the grep test". Whether or not this is a good thing is a matter of debate, but here's my experience.

APIs and Marketing

If you are a software developer and have created or are creating a start-up, then please do not forget about building a web services API. Not only will it be an excellent way to build out a web site and connect mobile clients, but a web services API can be an excellent marketing tool. 

The API allows other people to build their own stuff on top of your API. Sometimes these will just be hobbyists playing around, but those hobbyists can be an excellent marketing tool as they’ll likely write blog posts and release their source code out on GitHub, or elsewhere. In addition, businesses may tie into your service, which is not only an additional source of revenue, but they’ll likely tout their integration with you on their web site. 

[From my blog.]

Crowdsourcing self-confidence

Update 12 hours later

I received a massive amount of feedback: here, on the mailing list and in private email. I humbly thank all of you for the many words of encouragement. I am planning to summarize in more detail what I took away from this in a separate post soon (once I am back from an internetless trip this weekend).

Original Text

TL;DR - There is this thing called DBIx::Class . It has a number of users, and a number of staunch non-users, which is all fine. Bottom line - it seems to be relatively important . For good AND for bad, I happen to be an integral part of this project for nearly 5 years. A number of my friends (who badgered me into writing this) believe that I am in a relatively unique position to "to boldly take this project where no ORM has gone before". Furthermore I am at a life-junction where I indeed

Overheard on stackoverflow

Commenter: why did you comment out use strict;?

OP: because i was getting errors and warnings because not all variables are defined as "my" or "our". it is for testing purposes only. I will uncomment that line later when the script works.


No link to protect the innocent.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.