Skip to content

Instantly share code, notes, and snippets.

@stevan
stevan / oslo.pm-moose-hackathon-info.mkd
Created May 5, 2012 14:59 — forked from sjn/oslo.pm-moose-hackathon-info.mkd
Moving to Moose 2012 hackathon status

Moving to Moose hackathon 2012

Oslo Perl Mongers would like to invite to a Moving to Moose double-hackathon near Stavanger, Norway! We're planning four full days of hacking, discussion and fun at the Preikestolen Fjellstue conference hotel. And if the weather allows it, we'll do a 5+5km hike to Preikestolen and back!

The hackathon topic is two-fold: Getting a proper Meta Object Protocol into Perl5 core, and moving CPAN modules to Moose. We're specifically inviting two communities - the #p5-mop and #perlrdf crowds.

With that said, the hackathon is also open for others! We intend on allowing commercial attendees too, and hope the high-bandwith discussions, hacking and networking will function as a great door-opener for anyone who wants to become part of the Perl community.

The #perlrdf Moose hackathon

@stevan
stevan / oslo.pm-moose-hackathon-info.mkd
Created May 5, 2012 13:15 — forked from sjn/oslo.pm-moose-hackathon-info.mkd
Moving to Moose 2012 hackathon status

Moving to Moose hackathon 2012

Oslo Perl Mongers would like to invite to a Moving to Moose double-hackathon near Stavanger, Norway! We're planning four full days of hacking, discussion and fun at the Preikestolen Fjellstue conference hotel. And if the weather allows it, we'll do a 5+5km hike to Preikestolen and back!

The hackathon topic is two-fold: Getting a proper Meta Object Protocol into Perl5 core, and moving CPAN modules to Moose. We're specifically inviting two communities - the #p5-mop and #perlrdf crowds.

With that said, the hackathon is also open for others! We intend on allowing commercial attendees too, and hope the high-bandwith discussions, hacking and networking will function as a great door-opener for anyone who wants to become part of the Perl community.

The #perlrdf Moose hackathon

@stevan
stevan / oslo.pm-moose-hackathon-info.mkd
Created March 30, 2012 18:21 — forked from sjn/oslo.pm-moose-hackathon-info.mkd
Moving to Moose 2012 hackathon status

Moving to Moose hackathon 2012

Oslo Perl Mongers would like to invite to a Moving to Moose double-hackathon near Stavanger, Norway! We're planning four full days of hacking, discussion and fun at the Preikestolen Fjellstue conference hotel. And if the weather allows it, we'll do a 5+5km hike to Preikestolen and back!

The hackathon topic is two-fold: Getting a proper Meta Object Protocol into Perl5 core, and moving CPAN modules to Moose. We're specifically inviting two communities - the #p5-mop and #perlrdf crowds.

With that said, the hackathon is also open for others! We intend on allowing commercial attendees too, and hope the high-bandwith discussions, hacking and networking will function as a great door-opener for anyone who wants to become part of the Perl community.

The #perlrdf Moose hackathon

-module(mydemo_resource).
-export([init/1, to_html/2]).
-include_lib("webmachine/include/webmachine.hrl").
init(Config) ->
{ok, undefined}.
to_html(ReqData, State) ->
{"<html><body>Hello, new world</body></html>", ReqData, State}.
my %args = (
foo => 'bar',
(cond(
($answer == 42) { answer => $answer }
($answer) { wrong_answer => 1 }
(otherwise) { no_anwser => 1 }
)),
);
my %args = (
foo => 'bar',
(do {
if ($answer == 42) { answer => $answer }
elsif ($answer) { wrong_answer => 1 }
else { no_anwser => 1 }
}),
);
use Moose;
use Class::MOP::Attribute;
use Class::MOP::Class;
use Data::Dumper;
my $ass = Class::MOP::Class->create(
'FooBarski' => (
version => '0.01',
)
);
# get the dispatcher instance ....
my $dispatcher = $class->dispatcher(':canonical');
# walk the methods
my $method = ::WALKMETH($dispatcher, $label, %opts);
unless (defined $method) {
# if we find an AUTOLOAD anywhere in the chain, then we can use it ...
if ($method = ::WALKMETH($class->dispatcher(':canonical'), 'AUTOLOAD', %opts)) {
$class->STORE('$AUTOLOAD' => $label);
}
sub ::WALKMETH {
my $dispatcher = shift;
{ ($dispatcher->() || return)->get_method(@_) || redo }
}
sub ::WALKCLASS {
return $_[0]->();
}
::Class.meta.add_method('BUILDALL' => method (%params) returns Void {
my Dispatcher $dispatcher = $self.meta.dispatcher(:descendant);
for WALKMETH($dispatcher, 'BUILD') -> Method $method {
$method.($?SELF, %params);
}
});