Skip to content

Instantly share code, notes, and snippets.

View perigrin's full-sized avatar

Chris Prather perigrin

View GitHub Profile

Title: Bread::Board Author: Chris Prather Date: 2009-11-03 10:30

So I've been working on [Blawd][1] some more this week, trying to clean up the code so I can get some of the TODOs out of the way. One of the big TODOs is to implement a configuration system.

I had built the application organically much the way I have built many different applications over time. I had a master Blawd class that wired everything Entries, Indexes, Storage and Rendering classes, together by passing around attributes to constructors. Pretty standard stuff really. The problem is that building a configuration out of this either you end up with a god object (one big object that gets passed around or is a Singleton), or lots of small attributes and methods for passing configuration around. None of these approaches appealed to me. Here's a paired down example from Blawd.

package Blawd;

use 5.10.0;

Title: Everybody Wants Some … CPAN Author: Chris Prather Date: 2009-11-10 12:04

Everybody Wants Some … CPAN

So the twitters were all a … well twitter … with the [People want CPAN :-)][1] thread. This had some amazing synchronicity with the Perl talks we gave at [Big Lamp Camp][2] in Nashville this weekend. The main thrust of [Stevan][3] and Cory's talks were "It's the CPAN stupid."

However reading through the Python thread I've seen some places where people are ignorant of the reality of CPAN.

Title: Accessors, what's in it for Me
Author: Chris Prahter
Date: 2009-11-13 15:14
# Accessors, what's in it for *Me*
So there has been some discussion recently on various places I almost never go to on the internet. That has bled over into #moose-dev, the developer channel for Moose.
The argument came up apparently that there's no point to an accessor that is just a glorified wrapper around hash key assignment. The basic assumption is that Moose's accessors are basically:

Title: What Stops Me From Using Perl6 Today Author: Chris Prather Date: 2009-11-16 14:12

What Stops Me From Using Perl6 Today

I have to confess mst asked me to step forward and make a comment about the [Perl5][mst] & [Perl6][maask]. I suspect because I'm a prime example of a person who's deeply involved in what maask calls the Perl5 story. This is because I've been bound up tightly with the Moose community for a while, and I've recently founded a [company][tamarou] that is doing Modern Enlightened Perl development. My bread is buttered by Perl5.

Recently because of mst and maask sparking a conversation I have started taking a really close look at Perl6. One of the things that struck me was how polished and complete the core Perl6 language was, and the Rakudo implementation.

package MyApp::Model::User;
use Moose;
use KiokuDB::Util qw(set weak_set);
use MooseX::Aliases;
use MooseX::Types::Email qw/EmailAddress/;
use namespace::autoclean;
with qw(
KiokuX::User
use 5.10.0;
use MooseX::Declare;
use Bread::Board;
class ParentConfig {
has base_directory => ( is => 'ro', isa => 'Str', required => 1 );
has media_directory => (
isa => 'Str',
is => 'ro',
lazy_build => 1,
my $code = q{
package YP::XML::Atom::Feed;
use Moose;
use namespace::autoclean;
use XML::Toolkit;
has 'author_collection' => (
isa => 'ArrayRef[YP::XML::Atom::Author]',
is => 'ro',
@perigrin
perigrin / glyph_odds.pl
Created November 11, 2010 16:59
perl glyph_odds [ministry level] [trials]
#!/usr/bin/perl
use 5.12.2;
use List::Util qw(reduce sum);
sub factorial {
my ($in) = @_;
return 1 unless $in;
return reduce { $a * $b } ( 1 .. $in );
}
Ach Quiorvoo 1
Aegloegga 8
Aes Kniondoo Eamb 4
Aes Kniondoo Eamb 8
Aesphizz 5
An Knessee Iopr 2
Blagl 1
Blou Omeu 6
Blou Omeu 7
Clui Oapa 6
package Wrapper;
use Moose;
use CPAN::Thing;
has cpan_thing => (
isa => 'CPAN::Thing',
handles => [qw(list of methods)],
default => sub { my $self = shift; CPAN::Thing->new( arg1 => $self->arg1, arg2 => $self->arg2 ) },
);