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 MooseX::Declare; | |
class Person { | |
has 'position' => (is => 'ro', isa => 'Int'); | |
has 'alive' => (is => 'rw', isa => 'Bool', default => 1); | |
has 'succ' => (is => 'rw', isa => 'Person', default => undef); | |
# Create a chain of people | |
method createChain(Int $n) { | |
return $self unless $n > 0; | |
my $succ = Person->new( position => $self->position+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
package Person; | |
use Moose; | |
has 'position' => (is => 'ro', isa => 'Int'); | |
has 'alive' => (is => 'rw', isa => 'Bool', default => 1); | |
has 'succ' => (is => 'rw', isa => 'Person', default => undef); | |
# Create a chain of people | |
sub createChain { | |
my ($self, $n) = @_; | |
return $self unless $n > 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
package Person; | |
use parent 'Class::Accessor::Fast'; | |
__PACKAGE__->mk_accessors(qw/position alive succ/); | |
# Create a new, living Person with the given position | |
sub new { | |
my ($class, $args) = @_; | |
return $class->SUPER::new( { %{$args}, alive => 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
package Person; | |
# Create a new, living Person with the given position | |
sub new { | |
my ($class, %args) = @_; | |
my $self = bless { %args, alive => 1 }; | |
bless $self, $class; | |
return $self; | |
} | |
# Create a chain of people |
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 WWW::Mechanize; | |
$|=1; | |
my ( $user, $pass ) = ( 'user_id','user_password' ); | |
my $mech = WWW::Mechanize->new(); | |
#$mech->agent_alias( 'Windows IE 6' ); |
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 Schedule::Cron; | |
use Net::Twitter::Lite; | |
my $cron = Schedule::Cron->new( sub {} ); | |
$cron->add_entry( '0 0-23 * * *', \&twit ); | |
$cron->run( detach => 0 ); |
NewerOlder