Monday, February 18, 2013

Just add a space

So, the thing to do these days seems to be to comment on the idea of renaming (or not renaming) Perl. My gut instinct is that it will do no good and possibly do harm. If I saw a project I had thought was stagnated rename itself with a lot of fanfare and then went and looked at it and found it was in the same state as before, then I would worry about the competence of the people running the project. That said, I think there is definitely a way to have our cake and eat it too here:

All we have to do is add a space.

Just add a space to Perl 5.X.X to get Perl 5 X.X.  Our language is Perl 5.  We should own that fact.  Yeah, there is another language named Perl 6 that might be better (if it is every finished) and one named Perl 4 that is worse.  We are currently on version 16.2 of Perl 5.  Our version number is now significantly more than 6, which lets the people who want to rename Perl to get people to stop paying attention to the fact the Perl 6 is still not production ready to have a version greater than 6 while not confusing the issue.

And while we are at it, let's sit down with Ubuntu and Red Hat and come up with a way to package Perl 5 that suits both us and them.  Something that makes their life easier and encourages them to release newer versions of Perl 5, while, at the same time, fits our needs as developers.

Thursday, September 2, 2010

I need a few lines of nasty Perl 5 code.

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.

Wednesday, July 14, 2010

Adventures in Ignorance: Autovivification for fun and profit

Perl 5 autovivifies hashes and arrays when an undef is used as a hashref or arrayref. Normally you see this when using multidimensional data structures like this:

my %hash;
$hash{foo}{bar} = 1;

The value in $hash{foo} is undefined, so Perl 5 turns it into a hashref so it can lookup the key "bar" in it. This is somewhat dangerous because you can create keys without meaning to:

if ($hash{bar}{baz} == 1) {
say "found "bar/baz";
}

Here the key "bar" will be added to the %hash if it doesn't already exist. To prevent this we must check every level but the last with exists:

if (exists $hash{bar} and $hash{bar}{baz} == 1) {
say "found "bar/baz";
}

When I think of autovivification, that is all I normally think of, but today I realized you can use it for more than that. I have a couple of hashrefs I want to set the initial size of with keys. I was saying

my $hashref     = {};
keys(%$hashref) = 1024;

As I wrote that I wondered if autovivification would turn an undef in $hashref into a hashref for me, and sure enough it will:

#!/usr/bin/perl

use 5.012;
use warnings;

use Scalar::Util qw/reftype/;

my $hashref; #not really a hashref yet
keys(%$hashref) = 1024; #but now it is

say reftype $hashref;

Friday, July 9, 2010

Adventures in Ignorance: when both Perl and the Developer are too smart for their own good.

So, split returns the number of fields it would have split into when called in scalar context, but it also throws a warning in Perl 5.10: "Use of implicit split to @_ is deprecated". In an attempt to placate the warning I wrote

my $count =()= split $delim, $string;

but was surprised to find that every string returned 1. This is due to a nice little optimization that split does for you:

When assigning to a list, if LIMIT is omitted, or zero, Perl
supplies a LIMIT one larger than the number of variables in the
list, to avoid unnecessary work. For the list above LIMIT
would have been 4 by default. In time critical applications it
behooves you not to split into more fields than you really
need.
To get around this you must specify your own limit of -1:

my $count =()= split $delim, $string, -1;

Of course, -1 doesn't have the same behavior as no limit or a limit of 0 (a limit of -1 preserves empty trailing fields), so this is not necessarily what you want. This leaves us with the last line of defense, turning off warnings (and it isn't pretty):

my $count = do {
no warnings "deprecated";
split $delim, $second;
};

Thursday, July 1, 2010

Announcing the Perl 5 Documentation Team

I am excited to announce the formation of the Perl 5 Documentation Team. Our goal is to have the best, most current, and easiest to use and understand documentation of any programming language. Why settle for small goals?

Since the success of this team will depend on having both expert and novice points of view, membership is open to all, regardless of experience level with Perl. This is an excellent opportunity for people who would like to make a contribution back to the Perl community to do so in a way that doesn't require expert programming abilities.

If you are interested in being part of the team, please subscribe to the Perl Documentation mailing list, as future discussion will occur there (look for the thread named "I want to sign up"). If you know of other people who may be interested in being part of this effort, please pass this message on to them.

Areas where the team will be active include:

  • Reviewing and updating documentation to ensure that it is friendly to new users
  • Updating examples in documentation to a style compatible with Modern Perl practices
  • Updating the documentation so that all examples longer than one line contain a use statement indicating the minimum version of Perl 5 required to run the example
  • Monitoring p5p for incoming documentation patches, ensuring they contain a patch against the current delta, and forwarding them to committers as needed
  • Monitoring p5p for patches that will require modification of documentation, and ensuring that the documentation is modified appropriately
  • Verifying that perlglossary contains current accurate definitions for all jargon terms

Goals to be met for the Perl 5.14.0 release include:

  • Recruit novice and experienced Perl programmers to the team, and create a Perl module (a la Perl::Staff) and a Perl 5 wiki entry listing the team members
  • Finalize perlopquick as a replacement for perlop and modify the new perlop so that perlop and a shorter perlopref can be generated from a single source document
  • Extend perldoc to use the new perlop to provide documentation on operators (tenative proposal: perldoc -O "^=")
  • Create a perlfuncref, a series of short summaries of information in perlfunc, analogous to perlopref (Again, both of these will be generated from a single source document for ease of maintenance)
  • Define a policy for documenting documentation changes in the Perl deltas (e.g. perl5133delta.pod)
  • Define a set of documentation style guidelines, covering structure, style, and content
  • Formally define the Perl 5 Documentation Team functions
  • Set deadlines for the defining of longer term goals
  • Create a logo for the Perl 5 Documentation Team
  • Find a better name or nickname for the Perl 5 Documentation Team

Potential longer term (post-5.14.0) goals:

  • Clean up perlre
  • Extensive review and Modernization of all examples
  • Develop a plan to integrate with the Pod2 translation project

Wednesday, March 3, 2010

Parts of Perl you never knew existed

This is a list of some of the darker, scarier, or lesser known areas of Perl. I am going to be grouping them into a set of talks to scare, disgust, and delight the DC Perl Mongers. There is no ordering to them In this post; I am just trying to start a list of talk items.

  • Prototypes
  • what happens when you add a & to the start of a function call (aka why you shouldn't)
  • split in void context
  • goto function
  • values vs variables (a superset of lists vs arrays)
  • wantarray and contexts (void, scalar, list)
  • pseudohashes
  • tie
  • typeglobs
  • PadWalker
  • source filters
  • adding methods to existing classes
  • interpolating things that aren't scalars or arrays
  • when to use each vs keys
  • warnings
    • how to disable certain warnings without affecting other warnings
    • how to add categories
  • B::Deparse, showing the magic Perl does for you
    • while (<>), while (readline), and while(readdir)
    • default values for split, print, etc.
  • do file
  • weird operators
  • special variables
    • %main::
    • $]
    • $"
    • $,
    • $/ and $\
    • %SIG
  • what strict does and why
    • symbolic references
    • barewords
  • regex magic
    • \k
    • \g
    • \G
    • \Q
    • differences between scalar and list context
    • recursion

Tuesday, October 20, 2009

Day six with Google Wave

Well, I am starting to get a real understanding of why they made the UI decisions that seemed weird at first. I am even considering reading the specs and seeing if I get talk to their implementation of the server with my own client (to get things like growl/libnotify notifications working).

On the browser side, it seems to work best with Google Chrome. This is not a big shock. It doesn't seem as memory hungry with Google Chrome (63 MB vs 200 MB in Safari or Firefox on the first page), but it does seem to grow in size over time as I access waves (102 MB after accessing 10 waves). Another nice thing about Chrome is its model for tabs. Each runs in its own process, so killing a tab frees all of the memory associated with it. This means that when it starts eating too much memory, I can simply start a new Google Wave tab and close the old one instead of having to shutdown the whole application (which is what I have resorted to with Firefox and Safari). The downside is that Google Chrome has not been released for OS X. Luckily there is a developer version available for Linux and OS X (which is what I have been running).

Thursday, October 15, 2009

Google Wave day two

I have finally had an IM-like exchange with one of my friends. It is confusing to say the least. Should I start a new blip after each exchange? Should I modify my blip in response to the other one instead? Should I clean the exchange up for others on the Wave? I figure social rules will develop similar to how bottom vs top vs inline rules developed for email; of course, that means we are in for another round of religious debates and flames.

The idea of flames brings up another thought. What will flames look like when you can edit not only your own messages, but other's messages as well? Google Wave needs a reputation system of some form. One that weights a person's reputation based on the opinion's of people you already trust. It also needs a way to control who can see a wave vs who can edit it. There are already read-only waves, but only the system can create them. I think it might become important for blips to be marked read-only, or writable only by a specific subset of the wave participants.

As for the memory issue I mentioned yesterday, it isn't so bad if I stay away from Waves that have many blips. Firefox (on OS X) is eating about 300 MB, which is up from the 100 MB it normally eats, but it has not yet exploded to the 1 GB mark like it did yesterday.

Wednesday, October 14, 2009

Day one with Google Wave

So I got a Google Wave invite yesterday morning and immediately signed up. The interface is nice, if a bit slow at times on my 2.16 GHz MacBook Pro with 2 GB of RAM. It also ate 1 GB at one point and Firefox started acting weirdly (left clicks on flash apps were generating right click behavior). Firefox normally eats around 100 MB of RAM on my machine, but right now with Google Wave open, and having only worked with two waves, it is eating 300 MB.

If have mostly used it like email so far, I haven't had a chance to play with the IM like features. I have used the wiki-like editing feature though, replayed the history of a couple of waves, and used the map gadget and everything worked pretty much the way I expected it to. I played a little with the kasyntaxy bot and it was interesting, but its Perl syntax highlighting leaves a lot to be desired.

If you are on Google Wave as well, drop me a line at chas.owens.

Monday, October 12, 2009

A blogger gadget for Ironman

So, since my badge is now working, I thought it would be a good idea to add my badge to my blog. It turned out to be fairly simple, and if you are using blogger, you can just reuse my work. All you need to do is
  1. Click "Customize"
  2. Click "Add a Gadget"
  3. Click "Add your own"
  4. enter the URL http://wonkden.net/ironman_perl_gadget.xml
  5. Click "ADD BY URL"
  6. Set the background color
  7. Set the name you registered with the Ironman competition
  8. Set the sex of your badge
  9. And, finally, click "Save"
Just for the record, here is the XML used to create the gadget:
<?xml version="1.0" encoding="UTF-8" ?> 
<Module>
<ModulePrefs
title = "Ironman Perl Gadget"
title_url = "http://wonkden.net/ironman_perl_gadget.xml"
height = "80"
author = "Chas. Owens"
author_email = "chas.owens@gmail.com"
/>
<UserPref
name = "bg"
display_name = "Background Color"
datatype = "string"
required = "true"
/>
<UserPref
name = "ironman-name"
display_name = "Ironman Perl name"
datatype = "string"
required = "true"
/>
<UserPref
name = "ironman-sex"
display_name = "Sex"
datatype = "enum"
required = "true"
>
<EnumValue value="male" display_value="Male"/>
<EnumValue value="female" display_value="Female"/>
</UserPref>

<Content type="html">
<![CDATA[
<script type="text/javascript">
var prefs = new _IG_Prefs();
var name = prefs.getString("ironman-name");
var sex = prefs.getString("ironman-sex");
var color = prefs.getString("bg");
var html = '<div align="center" style="background-color: ' + color + '"><img src="http://ironman.enlightenedperl.org/munger/mybadge/' + sex + '/' + name + '.png" alt="Ironman Perl badge for ' + name + '"></div>'

document.write(html);
</script>
]]>
</Content>
</Module>

Should PERL_UNICODE be considered harmful?

I set PERL_UNICODE to "SDL" as a matter of course when setting up my environment. This means that all of my filehandles will use the UTF-8 PerlIO layer unless the locale says otherwise or a specific layer is chosen explicitly. I do this because I don't want to have to worry about calling binmode or explicitly setting the PerlIO layer when opening a file:
open my $fh, "<:utf8", $filename
or die "could not open $filename: $!"
This has worked fine for me for years; however, recently I have noticed a few problems with it:
  • You cannot compile Perl will it set
  • Many modules fail their tests when it is set
  • Scripts that work just fine in your environment fail in other environments
  • since it affects all filehandles, it could cause bugs in modules (I have never actually seen this)
Given these issues, I am starting to consider PERL_UNICODE harmful and thinking about giving it up.

Does anyone know of any arguments to keep using it, or, conversely, more arguments to stop using it?

Monday, October 5, 2009

Yay! my badge works, Boo! no time for Perl

Yay! I am a bronze man. Also, all of my projects either on hold or are going to progress very slowly for the next few months. My wife has been in and out of the hospital for the last few months, the last time via an ambulance. I have been force to make lifestyle changes such as fixed times to go to bed at night (2200 ET versus somewhere between 2000 ET and 0600 ET) and get up in the morning (0630 ET vs somewhere between 0900 ET and 1100 ET) and the careful cooking of all of our meals (did you know there was a meal called breakfast that didn't entail just grabbing a soda on the way out the door?), so I don't have nearly as much discretionary time as I once did. Hopefully in a couple months she will be strong enough to start helping with things again and I will get some time back for Perl.

Monday, September 28, 2009

perlopref needs you

The perlopref document is nearing completion. I need to add the file test, quote-like, regex quote-like, and I/O operators, but now is a good time for other people to go over the document and make sure I haven't made any mistakes or omissions.

I am also thinking about changing the name to perlopquick since it isn't really a reference (it doesn't contain everything about the operators).

Sunday, September 20, 2009

giving some love to do

The do {} construct does not get much love in most of the code I see. Besides do {} while loops, it is very useful for combining steps and limiting the scope of variables:
my $contents = do {
local $/;
open my $fh, "<", $filename
or die "could not open $filename: $!";
<$fh>;
};
The snippet above keeps the change to $/ and the $fh variable local to the section that needs it.

Sunday, September 13, 2009

adventures in ignorance: what I have learned from perlopref so far

While working on perlopref I have learned a few things about Perl I had never known. This is a short list of the things I learned (besides the bit about modulo that I have already blog'ed about).

Only the plain assignment operator (=) can do list assignment. I found this out when I expected @a x= 5 to do something (besides throw an error that is). This makes sense for most of the assignment operators. For instance, @x += 2 makes very little sense, but I think @a x= 3 makes some sense, but alas it is an error.

The bitwise and operator (&) has different behavior with respect to strings than the bitwise or and xor operators (| and ^ respectively). Bitwise and truncates to the length of the shorter string, but bitwise or and xor extend the shorter string to the length of the longer one with nul characters.

The arrow operator has surprising behavior with respect to coderefs. This code throws an error as I would expect:
#!/usr/bin/perl

use strict;
use warnings;

sub func {
return [qw/a b c/];
}

print func()[0], "\n";
But this code prints "a\n":
#!/usr/bin/perl

use strict;
use warnings;

sub func {
return [qw/a b c/];
}

my $ref = \&func;

print $ref->()[0], "\n";
This seems to be an extension of the rule that lets you pretend that an AoA is really a multi-dimensional array. I knew this rule allowed you to say $aoa->[0][1]("arg1", "arg2"), but I had never tried it with the function call first.

Some people use ~~X (i.e. ~(~X)) to force scalar context on X, boy are they going to be annoyed by the smartmatch operator.

I go through bouts of knowing and forgetting this, but the flip-flop operators (.. and ...) actually return useful information, not just true or false:
#!/usr/bin/perl

use strict;
use warnings;

for my $i (1 .. 10) {
my $range = ($i == 2 or $i == 6) .. ($i == 4 or $i == 8);
print "$range: $i\n" if $range;
}
The code above prints
1: 2
2: 3
3E0: 4
1: 6
2: 7
3E0: 8

The comparison operators (<=> and cmp) return -1, 0, and 1 not negative, zero, and positive. I had always though it wasn't guaranteed what the return value was, but apparently it is.

Perl 5.10.1 does not have the err operator (i.e. the low precedence version of //. I could have sworn it did, but it is not there. It looks like I am not the only one confused by its non-existence though, perlop has a section titled "Logical or, Defined or, and Exclusive Or" that only describes or and xor.

The left bit shift operator (<<) is not defined if you you shift past the boundary of your native integer. I had always assumed that it dropped those bits, but apparently that is just the behavior of the versions of C I have used in the past (ANSI/ISO C does not define the behavior of overflow due to shifting, so it is a crap shoot).

The and and or operators have different precedence levels. The and operator binds more tightly than or, so
$x == 5 and $y == 6 or $x == 6 and $y == 5
is the same as
(($x == 5) and ($y == 6)) or (($x == 6) and ($y == 5))

Saturday, September 12, 2009

Adding house policies to Perl::Critic.

Recently on Stack Overflow, someone want code that could either modify Perl source code to remove comments that where on the same line as code, or warn him that comments were on the same line as code. Apparently he had a house style that needed to be enforced. I decided a Perl::Critic policy to warn him of the style violation was the way to go. I spent about fifteen minutes looking at the docs and writing code and I came up with this:
package Perl::Critic::Policy::CodeLayout::NoSideComments;

use strict;
use warnings;

use Readonly;

use Perl::Critic::Utils qw{ :severities :classification :ppi };
use parent 'Perl::Critic::Policy';

our $VERSION = 20090904;

Readonly::Scalar my $DESC => "side comments are not allowed";
Readonly::Scalar my $EXPL => "put the comment above the line, not next to it";

sub supported_parameters { return }
sub default_severity { return 5 }
sub default_themes { return qw( custom ) }
sub applies_to { return 'PPI::Token::Comment' }

sub violates {
my ($self, $elem) = @_;

#look backwards until you find whitespace that contains a
#newline (good) or something other than whitespace (error)

my $prev = $elem->previous_sibling;
while ($prev) {
return $self->violation( $DESC, $EXPL, $elem )
unless $prev->isa("PPI::Token::Whitespace");
return if $prev->content =~ /\n/;
$prev = $prev->previous_sibling;
}

#catch # after a block start, but leave the #! line alone
return $self->violation( $DESC, $EXPL, $elem )
unless $elem->parent->isa("PPI::Document");
return;
}

1;
I was surprised at just how easy PPI and Perl::Critic makes this.

Announcing perlcolor

So, recently on the Perl Beginners list there was some discussion about the merits and flaws of documentation that comes with Perl. At one point Raymond Wan said
Perldoc is somewhat hard to get into...but it's the manual for a programming language, so that's expected; I don't think having pages to color and draw on would be a feasible idea for the next update. :-)
I immediately disagreed. I think it is a fine idea and began work on such a document. At first it was simply a joke, but I am beginning to think that it might actually be a very good, light-hearted, introduction to Perl concepts such as CPAN, reporting bugs, etc. As with just about everything I do, I have put it up on GitHub. Fork it and add to it.

=head1 NAME

perlcolor - coloring book for new perlers

=head1 IMAGES

=head2 Camels and Llamas

Camels in connection with Perl are a trademark of O'Reilly Media. O'Reilly
publishes many of the most important Perl books such as Programming Perl (aka the Camel) and Learning Perl (aka the Llama). Have you read them?

               _
.--' |
/___^ | .--.
) | / \
/ | /` '.
| '-' / \
\ | |\
\ / \ /\|
\ /'----`\ /
|| \ |
(| (|
|| ||
jgs /_( /_(

_ _
( \__//)
.' )
__/b d . )
(_Y_`, .)
`--'-,-' )
(. )
( )
( )
( . ) .---.
( ) ( )
( . ) ( . )
( ) ( . ),
( . `"'` . `)\
( . .)\
(( . . ( . )\\
(( . ( ) \\
(( ) _( . . ) \\
( ( . )"'"`(.( ) ( ;
( ( ) ( ( . ) \'
|~( ) |~( )
| ||~| | ||~|
jgs | || | | || |
_| || | _| || |
/___(| | /___(| |
/___( /___(


=head2 Monkeys

In the end we are all code monkeys. Code, code monkeys, code!

                             .="=.
_/.-.-.\_ _
( ( o o ) ) ))
|/ " \| //
.-------. \'---'/ //
_|~~ ~~ |_ /`"""`\\ ((
=(_|_______|_)= / /_,_\ \\ \\
|:::::::::| \_\\_'__/ \ ))
|:::::::[]| /` /`~\ |//
|o=======.| / / \ /
jgs `"""""""""` ,--`,--'\/\ /
'-- "--' '--'


=head2 Butterflies

Camelia is a butterfly. She is the Perl 6 mascot. Can you find the hidden
P6?

           _                           _
/ `._ _.' \
( @ : `. .' : @ )
\ `. `. ._ _. .' .' /
\;' P. `. \ / .' 6' `;/
\`. `. \ \_/ / .' .'/
) :-._`. \ (:) / .'_.-: (
(`.....,`.\/:\/.',.....')
>------._|:::|_.------<
/ .'._>_.-|:::|-._<_.'. \
|o _.-'_.-^|:|^-._`-._ o|
|`' ;_.-'|:|`-._; `'|
jgs ".o_.-' ;."|:|".; `-._o."
".__." \:/ ".__."
^

=head2 Bugs

Bugs are errors in code. Sometimes the bug is in Perl, but most of the time
the bug is your code. If you think the bug is in someone else's code, you
should report it to them. CPAN has a link for reporting bugs on each
module's page. Have you ever found a bug?

          ,_      _,
'.__.'
'-, (__) ,-'
'._ .::. _.'
_'(^^)'_
_,` `>\/<` `,_
` ,-` )( `-, `
| /==\ |
,-' |=-| '-,
)-=(
jgs \__/



=head2 Penguins

This is Tux. He is the Linux mascot. Linux is an important platform for
Perl. Linux comes in many flavors: Redhat, Ubuntu, SUSE, and many others.
Do you run Linux?
                  ___
,-' '-.
/ _ _ \
| (o)_(o) |
\ .-""-. /
//`._.-'`\\
// : ; \
//. - '' -.| |
/: : | |
| | : ,/ /,
jgs _;'`-, ' |`.-' `\
) `\.___./; .'
'.__ )----'\__.-'
`""`


=head2 Daemons

This is the BSD Daemon. His name is Beastie. BSD is an important platform
for Perl. FreeBSD, NetBSD, OS X, and others are all variants of BSD. Do
you run a BSD variant?

                    ,        ,         
/( )`
\ \___ / |
/- _ `-/ '
(/\/ \ \ /\
/ / | ` \
O O ) / |
`-^--'`< '
(_.) _ ) /
`.___/` /
`-----' /
<----. __ / __ \
<----|====O)))==) \) /====
<----' `--' `.__,' \
| |
\ / /\
______( (_ / \______/
,' ,-----' |
`--{__________)


=head2 Strawberries

Strawberry Perl is a version of Perl for Microsoft Windows. It comes with
its own build environment to make installing Perl modules from CPAN easy.
Have you every installed a Perl module from CPAN?

          VVVVVVVV 
'oOOOOOOOOo'
'ooOOOOOOoo'
'oooOOooo'
'oooooo'
'oooo'



=head2 Shebang

The shebang line is what tells the OS the path to Perl. What is the path to
your Perl?

        #  #    #  #               !!  !!
# # # # !! !!
# # # # !! !!
#### #### #### !! !!
!! !!
#### #### #### !! !!
# # # # !! !!
# # # # !! !!
# # # # !! !!
#### #### #### !! !!

#### #### ####
# # # # !! !!
# # # # !! !!
# # # # !! !!


=head1 TODO

We need a good ASCII art version of Hexley (the Darwin Mascot).

My strawberry is terrible.

=head1 LICENSE

The BSD Daemon appears to be public domain. The strawberry and the #! are
released under the same terms as Perl. The rest of the ASCII art came from
L<http://www.geocities.com/soho/7373/index.html>.

Monday, September 7, 2009

What to call the ... operator?

What should we call Perl 5's ... operator? In list context it is identical to the range operator (..) and in scalar context it is almost identical to the flip-flop operator (also ..). The Camel and perlop are strangely silent on this. I am currently calling it the alternate range/flip-flop operator for lack of a better term. What do you call it?

Sunday, August 30, 2009

meta: no time to write what I want! badges! brokeness!

Well, it has been eight days and I am pushing the limit of staying in the competition (or at least not resetting the clock). There are a few things I want to write, but don't have the time to pay attention to right now. Quick list of posts I want to write so I don't forget them:
  • simple parsing
  • shared memory (IPC and persistence)
  • dealing with Unicode combining characters (needs more research)
In other news, the Perl Ironman Badges are up finally, but sadly my name seems to be breaking it. I can find a Chas and an Owens badge, but not a Chas. Owens badge. Also, I am showing up as a paperman in both which is either a bug in its calculation or mine.

Saturday, August 22, 2009

Projects in progress as of 2009-08-22

Unicode::Digits (GitHub, CPAN)

A test is failing on Perl 5.8. This is due to the test using a character that is a digit in Perl 5.10, but not in Perl 5.8. I need to fix this problem.

I also want to add a function that will return a regex that can match a given digit or digits (i.e. it should be able to match "42", "𝟜𝟚", or "᠔᠒"), but I am still not certain how the interface should work. For instance, should it only allow single digits (forcing the user to build more complicated regexes?
my $one = digit_one();
Should it take a string and replace the digits and character classes with the expanded character classes?
my $re = digit_regex "This matches 42";
Should it be OO based and let you chose specific sets of digits?
my $ud = Unicode::Digit->new(
"ASCII", #special case, "" looks stupid
"MATHEMATICAL DOUBLE-STRUCK",
"MONGOLIAN"
);
my $re = $ud->digit_regex("[1-3]");
I am leaning toward the last one. And I am leaning toward only allowing a small subset of regex-like syntax (basically numbers and character classes containing numbers or ranges only).

autobox::dump (GitHub, CPAN)

I need to finish extending it to handle YAML and Data::Dump::Streamer.

Term::Throbber (not published anywhere)

I saw Term::Spinner and hubris struck me. First I patched Term::Spinner to be able to handle arbitrary sized frames, but then I found my self annoyed by the interface, terminology, and use of vanilla Moose in Term::Spinner, so I have written my own MooseX::Declare based version. I haven't written any tests for it yet. Once the tests are written and passing (and I am satisfied with the interface) I will put it up on GitHub and CPAN.

perlopref (GitHub)

Lots more work needs to be done before this is finished. My goal of adding at least one operator a day failed. I need to recommit myself to getting it done.

warnin's (GitHub)

I think warnin's is going to die an ignoble death. The talk of removing ' as a package separator combined with my own apathy means it is unlikely for anything new to be done with it.