Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

karlgoethebier's scratchpad

by karlgoethebier (Abbot)
on Nov 02, 2012 at 12:43 UTC ( #1001959=scratchpad: print w/replies, xml ) Need Help??

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.

See also

Double Bracket Operator

#!/usr/bin/env perl use strict; use warnings; use feature qw(say); while (<<>>) {say} __END__
perl -MO=Deparse use warnings; use strict; use feature 'say'; while (defined($_ = <<>>)) { say $_; } __DATA__ 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

Class::Tiny and Role::Tiny

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__

Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2022-05-25 20:17 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (90 votes). Check out past polls.