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 feature qw( :5.16 ); | |
use DateTime; | |
my $now = DateTime->now( time_zone => 'America/Chicago' ); | |
my $lon = DateTime->today( time_zone => 'Europe/London' ); | |
$lon->set_hour( 6 ); | |
$lon->set_minute( 22 ); | |
while ( $lon < $now ) { |
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 -e'use strict "vars"; BEGIN { printf "\%8d -> %60s", $^H, unpack( "b*", $^H ) }' | |
1408 -> 10001100001011000000110000011100 | |
» perl -e'use strict "subs"; BEGIN { printf "\%8d -> %60s", $^H, unpack( "b*", $^H ) }' | |
832 -> 000111001100110001001100 | |
» perl -e'use strict "refs"; BEGIN { printf "\%8d -> %60s", $^H, unpack( "b*", $^H ) }' | |
290 -> 010011001001110000001100 | |
» perl -e'use strict; BEGIN { printf "\%8d -> %60s", $^H, unpack( "b*", $^H ) }' | |
2018 -> 01001100000011001000110000011100 | |
» perl -e'use strict "refs", "vars", "subs"; BEGIN { printf "\%8d -> %60s", $^H, unpack( "b*", $^H ) }' | |
2018 -> 01001100000011001000110000011100 |
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 Test::More; | |
use Mojo::Base; | |
use Mojo::IOLoop; | |
use Mojo::IOLoop::Delay; | |
use Mojo::UserAgent; | |
use Mojo::IOLoop; | |
{ | |
package Statocles::Command::_MOJOAPP; |
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 Test::Mojo; | |
{ | |
package Statocles::Command::_MOJOAPP; | |
# Currently, as of Mojolicious 5.12, loading the Mojolicious module here | |
# will load the Mojolicious::Commands module, which calls GetOptions, which | |
# will remove -h, --help, -m, and -s from @ARGV. We fix this by copying | |
# @ARGV in bin/statocles before we call Statocles::Command. |
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; | |
use Mojo::IOLoop::Stream; | |
my $stream = Mojo::IOLoop::Stream->new(IO::File->new("</dev/urandom")); | |
$stream->on(read => sub { | |
my ($stream, $bytes) = @_; | |
print STDERR "Read from stream\n"; | |
}); | |
$stream->on(error=>sub { |
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 FooMoo; | |
use Moo; | |
has foo => ( | |
is => 'rw', | |
default => sub { 'foo' }, | |
clearer => 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
use v5.20; | |
use Class::Anonymous; | |
my %hash = ( | |
foo => 'bar', | |
baz => 'fuzz', | |
); |
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; | |
use feature qw( say ); | |
package Hash::Object; | |
sub new { | |
my ( $class, %self ) = @_; | |
return bless { %self }, $class; | |
} |
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 My::Pythonic::Package { | |
use My::Pythonic qw( Base ); | |
class MyClass extends Base { | |
} | |
} | |
# Now in package main again | |
use My::Pythonic::Package qw( MyClass ); | |
my $obj = MyClass->new; |