in reply to Re^2: Overriding Global Variables
in thread Overriding Global Variables
"...I take back..."
Some callow ideas. Perhaps they are helpful:
package Debug { use Role::Tiny; use feature qw(say); requires qw(debug); say __PACKAGE__; sub spew { my ( $self, $message ) = @_; $message if $self->debug; } 1; }
package Foo { use Class::Tiny qw(nose debug); use Role::Tiny::With; use Class::Method::Modifiers; use feature qw(say); with qw(Debug); after 'nose' => sub { say shift->spew(__PACKAGE__); }; 1; }
package Bar { use Class::Tiny qw(nose debug); use Role::Tiny::With; use Class::Method::Modifiers; use feature qw(say); with qw(Debug); after 'nose' => sub { say shift->spew(__PACKAGE__); }; 1; }
#!/usr/bin/env perl use strict; use warnings; use Foo; use Bar; use feature qw(say); say __PACKAGE__; my $foo = Foo->new( { debug => 1, nose => q(kumquat) } ); my $bar = Bar->new( { debug => 1, nose => q(cuke) } ); say $foo->nose(); say $bar->nose(); __END__ karls-mac-mini:Mano_Man karl$ ./run.pl Debug main Foo kumquat Bar cuke
Best regards, Karl
«The Crux of the Biscuit is the Apostrophe»
perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help
|
|---|