Public Scratchpad | Download, Select Code To D/L |
For Discipulus
Similarly there is running through Ottilie’s diary a thread of affection and attachment which unites and characterises the whole. Thereby these notes, observations and selected aphorisms and whatsoever may be found here, become peculiarly characteristic of their writer and meaningful to her. Each single part that we have selected and communicated gives the most definite testimony of this.
Double Bracket Operator
#!/usr/bin/env perl use strict; use warnings; use feature qw(say); while (<<>>) {say} __END__
perl -MO=Deparse double_bracket_op.pl double_bracket_op.pl use warnings; use strict; use feature 'say'; while (defined($_ = <<>>)) { say $_; } __DATA__ double_bracket_op.pl syntax OK
For Lady_Aleena:
#!/usr/bin/env perl use strict; use warnings; use Cpanel::JSON::XS; use feature qw(say); use Data::Dump; use Path::Tiny; my @data = <DATA>; chomp @data; dd \@data; my $json = encode_json \@data; dd $json; my $file = path(q(json.dat)); $file->spew_utf8($json); my $data = decode_json $file->slurp_utf8; dd $data; say q(Cool beans!); __DATA__ foo bar nose cuke
package MyClass; use Class::Tiny qw(something); use Role::Tiny::With; use feature qw(say); say q(package ) . __PACKAGE__; with qw(MyRole); 1; package MyRole; use Role::Tiny; use feature qw(say); requires qw(something); say q(package ) . __PACKAGE__; around 'something' => sub { print q(Long John Silver said ); uc &{ (shift) }; }; 1; #!/usr/bin/env perl use strict; use warnings; use MyClass; use feature qw(say); say q(package ) . __PACKAGE__; my $object = MyClass->new( something => q("I reckon i settled you.") ) +; say $object->something; __END__
For review
package Foo { use strict; use warnings; sub new { my ( $class, $foo ) = @_; bless \$foo, $class; \$foo; } sub foo { ${ (shift) }; } 1; } package Bar { use strict; use warnings; use parent qw(Foo); my $modify = sub { uc shift }; # my $modify = sub { ... }; sub bar { # my ( $self, $foo ) = @_; $modify->( shift->SUPER::foo() ); } 1; } #!/usr/bin/env perl use strict; use warnings; use feature qw(say); use Bar; my $object = Bar->new(q(lorem ipsum kizuaheli)); say for ( $object->foo(), $object->bar() ); __END__