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 Foo; | |
# by Eugen Sobchenko, [email protected] | |
use base qw( Class::Accessor ); | |
Foo->follow_best_practice; | |
Foo->mk_accessors( qw( id foo bar ) ); | |
sub search_by { |
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 | |
# by Eugen Sobchenko, [email protected] | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
sub reverse_list { |
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
-module(euler). | |
-compile(export_all). | |
%% problem 1 | |
%% If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. | |
%% Find the sum of all the multiples of 3 or 5 below 1000. | |
%% Answer: 233168 |
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
-module(test). | |
-compile(export_all). | |
-record(test, {foo, bar}). | |
%% fails with "{atomic,{aborted,nested_transaction}}" | |
add_table1() -> | |
F = fun() -> | |
% ... | |
mnesia:create_table( test1, |
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
my ( $error, $failed ); | |
{ | |
local $@; | |
$failed = not eval { | |
# ...; | |
return 1; |
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/env perl | |
use strict; | |
use warnings; | |
use MojoX::Redis; | |
my $redis1 = MojoX::Redis->new(); | |
$redis1 | |
->sadd ( "set1" => "foo" ) |
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/env perl | |
use strict; | |
use warnings; | |
use MojoX::Redis; | |
my $redis1 = MojoX::Redis->new(); | |
$redis1 | |
->sadd ( "set1" => "foo" ) |
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/env perl | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
sub foo { | |
wantarray ? () : undef; | |
} |
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/env perl | |
use strict; | |
use warnings; | |
use Mojolicious::Lite; | |
post '/' => sub { | |
my $self = shift; | |
$self->render_data($self->req->body, format => 'bin'); |
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/bash | |
# install perlbrew | |
curl -L http://xrl.us/perlbrewinstall | bash | |
$HOME/perl5/perlbrew/bin/perlbrew init | |
echo source $HOME/perl5/perlbrew/etc/bashrc >> ~/.bash_profile | |
source $HOME/perl5/perlbrew/etc/bashrc | |
# install cpanm | |
cd $HOME/perl5/perlbrew/bin |
OlderNewer