Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

karlgoethebier's scratchpad

by karlgoethebier (Prior)
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 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

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?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2017-11-20 03:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (283 votes). Check out past polls.

    Notices?