This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <time.h> | |
#include <stdio.h> | |
#include <math.h> | |
int main() { | |
time_t test; | |
int last_year = 0; | |
struct tm *date; | |
int i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <time.h> | |
#include <stdio.h> | |
#include <math.h> | |
int main() { | |
time_t test; | |
int last_year = 70; | |
struct tm *date; | |
int i; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/perl | |
# Create a remote branch | |
my($remote, $branch, $start) = @ARGV; | |
die "$0 <remote> <newbranch> <start>\n" if @ARGV < 2; | |
$start ||= $remote; | |
system("git push $remote $start:refs/heads/$branch"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use v5.10; | |
use Test::More; | |
# Can you make this test pass just by changing UNIVERSAL::id and other | |
# dirty tricks? | |
# | |
# You cannot store anything in the object. | |
# You can make no assumptions about the structure of the object. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# The idea here is to take the benefits of make (highly visible code, | |
# excellent dependency tracking) and combine them with Module::Build | |
# (portable, OO overrides). | |
# This is all valid Perl code (with a small source filter) | |
# To use, you run the schmakefile directly. | |
# perl schmake | |
# perl schmake test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl | |
use strict; | |
use warnings; | |
use autobox; | |
sub UNIVERSAL::mo { | |
return Meta::Instance->new($_[0]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
my $File = "/etc/passwd"; | |
use Benchmark "cmpthese"; | |
sub schwern { | |
my($fh, $limit) = @_; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package MooseX::AlwaysCoerce; | |
use strict; | |
use warnings; | |
use namespace::autoclean; | |
use Moose (); | |
use MooseX::ClassAttribute (); | |
use Moose::Exporter; | |
use Moose::Util::MetaRole; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
has "coerce" => ( | |
is => 'rw', | |
lazy => 1, | |
reader => "should_coerce", | |
default => sub { | |
return 1 if shift->type_constraint->has_coercion; | |
return 0; | |
} | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# So my $github = $obj->github({ arg => "foo" }) works; | |
has github => | |
isa => "Gitpan::Github|HashRef", | |
is => 'rw', | |
lazy => 1, | |
trigger => sub { # trigger doesn't take a method | |
my($self, $new, $old) = @_; | |
return $new if $new->isa("Gitpan::Github"); |