http://twitter.com/briandfoy_perl
I'll tweet at (http://twitter.com/briandfoy_perl) when I have something to say in 140 characters. I'll almost always use "Perl" when I post.
I'll tweet at (http://twitter.com/briandfoy_perl) when I have something to say in 140 characters. I'll almost always use "Perl" when I post.
I've renamed the Config::INI repository to something more sensible (since no one had watched/forked it) and now you can write out Config::INI files.
my Config::INI $config .= new;
my %properties = (
a => 'b',
c => 'd',
);
my %next = (
one => 'two',
three => 'four',
);
$config.add_properties(:%properties);
$config.add_properties(properties => %next, name => 'next');
$config.write($ini_filename);
It needs more work (primarily solid error checking), but so far I'm fairly pleased with it.
Despite what you often hear, one can produce very readable perl code.
It is just not enforced.
I feel that readabilty of my code has improved since I've started my IT bachelor studies. I'm wondering if it is because
- we are forced to learn java which enforces a lot of things
- I am much worse at java than at I am at perl which forces me to write really simple code
- I code more and am humiliated more often when trying to read my own code
- I have more confidence in my solutions and think longer before hacking.
I'm not very afraid of baby perl. I want to code efficiently and want to understand my code in a year or two.
I just realized I will be sitting in a class for my birthday.
Either I'm doing something right or wrong.
Either way I'll be in St. Paul and will almost be able to eat my fill of pizza that I love.
Every so often you may have found yourself puzzled by the results the cpantesters provided, wondering which reasons may stand behind the fails or passes.
So you click on one of the FAIL reports and it doesn't reveal anything useful to you?
Chances are that if the reports contain some common pattern the new analysis site will point it out to you. Analysis uses some well known basic statistical tools that estimate the influence of independent variables on the result of the test runs.
I've been curious how one would match the following with Perl 6 grammars/regexen (spaces represented by dots)?
XXXX ..XXXX ....XXXX ....XXXX ......XXXX ..XXXX
In short, you can indent or unindent by a particular amount, with allowed indentation levels being multiples of the first indentation amount found. Each level of indentation must equal the previous or be one greater. You can unindent as much as you want so long as it's a multiple of that first indentation level. Seems like you need to have a recursive grammar that allows you to maintain state.
This is to play with the idea of matching a "YAMLish" document.
Side note: since Perl 6 is "Perl 6" and not "Perl6", it's awfully hard to search Google for.
I'm thinking about what a second edition of Intermediate Perl would look like. Of course, I would update it for Perl 5.12 (having been targeted at 5.8). Part of that is the new Perl 5.10 does()
feature that replaces most uses of isa()
. I want to come up with some good examples to show off does()
and roles for the next edition. It's not as easy as I thought it would be.
I won't go into the history of does()
: look for chromatic's various writings on that. In short, does()
asks something it if has a set of behaviors. It's almost that interface stuff that Java has.
There's a problem constructing working examples though. Who gets to define the names of the behaviors? There is still the false cognate problem that does()
was supposed to ameliorate. Two different interfaces give themselves the same name. It doesn't have to be for any good reason. Let's just leave it at "people suck at naming".
I have 22 Google Wave invitations. If anyone would like one, please contact me at mmusgrove@cpan.org.
I do not have a good use for Google Wave yet but perhaps you do.
With a regular expression engine, there are expectations. You feed a regular expression to the RE engine, it parses with it. That simple.
A general BNF parser is one which fulfills the same expectation for BNF. Write your language in BNF, you got a parser. But it hasn't been that simple.
The guys who write the textbooks have pushed general BNF parsing for years. Improvements in these algorithms have pushed the speeds down to linear or close to it for the kinds of language in practical use.
But the general parsing algorithms have languished on the textbook pages. And I did find it wasn't quite as easy as the academics suggested. There were some obstacles that they didn't forsee. But bottom line, they were right. General BNF parsing is practical.
In the past I've avoided trying to implement charts in Spreadsheet::WriteExcel because the task always seemed too big to tackle in the time scales that I get to work with.
However, prompted by a module user, I went back to revisit it. The task was still too big but I did it anyway.
So I've uploaded version 2.32 of Spreadsheet::WriteExcel to CPAN. Here is the documentation for Charts and here is an example.
I now have a basic INI file parser written in Perl 6. It's clumsy and I'm quite unsure about packaging. Any and all suggestions welcome, including patches!
The basic usage is like this. Assuming we have an INI file like this (note that we trim leading and trailing whitespace on k/v's and section names):
host = http://localhost/ port = 3333 [admin] ; these only apply to admin users name = Administrator access = all [ anonymous ] name = Guest access = none
We can read it like this:
my Config::INI $config .= new;
$config.read($filename);
# gets the host and port properties
for $config.properties.kv -> $k, $v {
say "$k => $v";
}
# gets the name and access properties under admin
my %admin = $config.properties('admin');
# dies
$config.properties('no_such_section');
Yeah, it needs a lot of work, but Perl 6 still twists my mind from time to time.
If you want to run the tests, make sure your Rakudo is up to date and:
PERL6LIB=lib/ prove --exec perl6 t/
This assumes that you have perl6 installed.
En algún momento, en una reunión con un equipo de “Desarrolladores”, un compañero y yo discutíamos sobre el proceso de recolección de datos durante una asamblea comunal, este compañero me planteaba que era muy complicado andar pidiendo el Nombre y Apellido a todas las personas de la asamblea, que esto retardaría el proceso de registro y que por lo tanto, solo iba a recoger los datos de la encuesta y serian datos anónimos.
Yo le sugerí que solo pidiera la Cédula de Identidad, y a partir de la cédula, usara la base de datos del CNE para obtener la información sobre Nombre y Apellidos.
A la anterior sugerencia, el compañero me contesto que si yo estaba loco, que obtener la base de datos del CNE era un tema burocrático que le iba a tomar varias semanas y varios oficios.
A continuación, en un par de lineas escritas muy rápido y sin ninguna preocupación por el estilo, muestro como podemos usar Perl para consultar automáticamente el portal del Consejo Nacional Electoral.
CPAN is one of the greatest things about Perl. However, sometimes I can't connect to the internet or I have spotty connectivity. That's why CPAN::Mini exists - it creates a local copy of CPAN. It takes up about 1.4 GB of space. However, this means that your local copy of CPAN is now out of date. You can run minicpan often, but I thought there could be a better solution, so I wrote CPAN::Mini::Live. This module allows you to have a local CPAN mirror which is instantly updated whenever new distributions are uploaded to CPAN.
How could this possibly work? First off, it relies upon using a CPAN mirror that is kept up to date. Andreas Koenig has been working on a way to do that using File::Rsync::Mirror::Recent and one of these mirrors using this method is the CPAN Testers CPAN mirror.
I wouldn't be able to live if it weren't for Perl! Perl5, that is.
Linux is my IDE.
Perl5 is my VM.
CPAN is my language.
(thanks, mst)
What better way to learn Perl 6 than to write software in it? I thought a nice, small project would be to write an INI file parser. Unfortunately, it turns out there there is no standard INI format. Or if there is, there it's pretty much ignored. As a result, I tried to write something which would handle something which is the least surprising to people. Thus, I trim whitespace, I allow comment lines starting with ';' and '#' and I ignore blank lines. It does not yet handle quoted strings, but I want to add that later.
I finally have a (clumsy) grammar which matches, but turning it into an AST and transforming it into a useful object has failed miserably. Tips? The code below runs on the latest version of Rakudo and the first parse shows that we match, but the second match generates errors such as:
Use of uninitialized value Use of uninitialized value Null PMC access in find_method('new') in Main (file <unknown>, line <unknown>)
And the Perl 6:
Feeling like I need to do something besides $work with my perl, I have decided recently to start working through the ProjectEuler.net problems. One of the ideas I'm looking to explore is building a framework of sorts that will host all the problems and will provide access to many common items both for use in solving the problems as well as in easing the development of the solutions.
I sort of jumped right in the other day and knocked out Problem 001 and Problem 003 while also starting to build the framework around it. I didn't start the git repository until after that but I suspect some of that will change anyway as it was real quick and dirty.
Since my last post, blogs.perl.org has stabilised and gotten much more usable.
The question now is, how do I switch over?
I've got 5 years worth of regular journal entries on various Perl topics and opinions, most of which I've very much like to keep as I move over.
So how would one go about that? Is there any way of extracting all of the posts from use.perl and importing them into blogs.perl?
If not, could there be?
Well, google this title and it'll return almost 2 million results - so it's not an original idea, but it's worth a try. So how far along have we come this past year?
My favourite new feature is "method name suffixes" in Catalyst-Controller-HTML-FormFu which allow you to split up your code into blocks that will only be called depending on the state of the current form. E.g.
Schwern recently wrote about not using numbers in test names. He's right and it's something I've been guilty of in the past, but I want to recommend that people go further and start naming test programs after packages. For example, with SQL::Statement, you have the following tests:
00error.t 01prepare.t 02executeDirect.t 03executeDBD.t 04names.t 05create.t 06group.t 07case.t 08join.t 09ops.t 10limit.t 11functions.t 12eval.t 13call.t 14allcols.t 15naturaljoins.t 16morejoins.t 17quoting.t 18bigjoin.t 19idents.t 20pod.t 21pod_coverage.t
So, if you want to write/find tests for the &SQL::Parser::feature subroutine, which .t file do you look in? Here's how I would name the tests:
I'm please to say that http://lists.perl.org/ has been revamped and is no longer a redirect.
Shlomi sorted the data (merging the wiki data + lists.cpan.org), I put the site together, Robert cleaned up and added some features.
The lists are now configured in a JSON file so it should be easier for people to supply patches (and patches are needed!).
Enjoy.
Leo
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.