Acme-Sneeze

 view release on metacpan or  search on metacpan

lib/Acme/Sneeze.pm  view on Meta::CPAN


use strict;
our $VERSION = '0.02';

use Exporter::Lite;
our @EXPORT = qw(sneeze);

sub sneeze {
    my $self = shift;
    my $pkg  = caller;
    bless $self, $pkg;
}

1;
__END__

=head1 NAME

Acme::Sneeze - Bless you

=head1 SYNOPSIS

  package Your::Object;
  use Acme::Sneeze;

  package Others;

  my $object = Your::Object->new;
  $object->sneeze;    # "bless you!"

  print ref($object); # will print "Others"

=head1 DESCRIPTION

When you sneeze in America (or other English speaking countries),
you'll be blessed. But the problem is that they say "Bless you"
without the 2nd parameter: the package name.

So with Acme::Sneeze, your object will have I<sneeze> method, and when
you sneeze you'll be automatically blessed to the current package.

=head1 TODO

=head2 LOCALIZATION

In Japan, sneezing twice implies that "someone is talking about you." I
guess I<Acme::Sneeze> should be localized to increment reference count
of the object if the users locale is set to JP.

In Poland, the common response I<Sto lat> translates as I<Hundred

t/01_sneeze.t  view on Meta::CPAN

use strict;

package Foo;
use Acme::Sneeze;
sub new { bless {}, shift }

package Bar;

use Test::More 'no_plan';

my $foo = Foo->new;
isa_ok $foo, 'Foo';

$foo->sneeze;
isa_ok $foo, 'Bar';

t/02_universal.t  view on Meta::CPAN

use strict;

package Foo;
sub new { bless {}, shift }

package Bar;

no warnings 'once';
require Acme::Sneeze;
*UNIVERSAL::sneeze = \&Acme::Sneeze::sneeze;

use Test::More 'no_plan';

my $foo = Foo->new;



( run in 1.232 second using v1.01-cache-2.11-cpan-de7293f3b23 )