Acme-Curse

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

use warnings;
use Module::Build;
require 5.006001;

my $build = Module::Build->new(
    create_readme       => 1,
    create_makefile_pl  => 'traditional',
    license             => 'perl',
    module_name         => 'Acme::Curse',
    dist_author         => 'Moritz Lenz',
    dist_abstract       => 'Remove the blessing that lay on references',
    dist_version        => '0.0.1',
    requires => {
        'perl'              => '5.6.1',
# I don't really know which Coro version is needed, but 1.0 seems like a
# reasonable guess. Might change in future.
        'Scalar::Util'      => 0,
    },
    recommends          => {},
    sign                => 0,
);

META.yml  view on Meta::CPAN

---
name: Acme-Curse
version: 0.0.1
author:
  - Moritz Lenz
abstract: Remove the blessing that lay on references
license: perl
resources:
  license: http://dev.perl.org/licenses/
requires:
  Scalar::Util: 0
  perl: 5.6.1
provides:
  Acme::Curse:
    file: lib/Acme/Curse.pm
generated_by: Module::Build version 0.280801

README  view on Meta::CPAN

NAME
    Acme::Curse - Remove the blessing that lay on references

SYNOPSIS
        use Acme::Curse qw(curse);

        my $unblessed_ref = curse($object);

DESCRIPTION
    Did you ever want to droo the blessing of an object? Well, now you can:
    Acme::Curse unblesses reference by returning a shallow, non-blessed copy
    of the object.

    Currently only references to scalar, hashes, arrays and code objects can
    be unblessed.

    Exported subs:

    curse
        Unblesses a reference to an object.

BUGS
    None known, but surely there are many.

AUTHOR
    Moritz Lenz, <http://perlgeek.de/>, <http://perl-6.de/>

LICENSE AND COPYRIGHT
    Copyright (C) 2008 Moritz Lenz

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

package Acme::Curse;

=head1 NAME

Acme::Curse - Remove the blessing that lay on references

=head1 SYNOPSIS

    use Acme::Curse qw(curse);

    my $unblessed_ref = curse($object);

=head1 DESCRIPTION

Did you ever want to droo the blessing of an object? Well, now you can:
Acme::Curse unblesses reference by returning a shallow, non-blessed copy
of the object.

Currently only references to scalar, hashes, arrays and code objects can
be unblessed.

Exported subs:

=over 4

=item curse

Unblesses a reference to an object.

=back

=head1 BUGS

None known, but surely there are many.

=head1 AUTHOR

Moritz Lenz, L<http://perlgeek.de/>, L<http://perl-6.de/>

t/basic.t  view on Meta::CPAN

use strict;
use warnings;
use Test::More tests => 10;
use Scalar::Util qw(blessed reftype);

BEGIN {
    use_ok('Acme::Curse');
}
Acme::Curse->import('curse');


my $h = bless {};
ok blessed($h),             'Basic sanity';

ok !blessed(curse($h)),     'Can curse hash ref';
is reftype($h), 'HASH',     'Cursing a hash ref results in a hash ref';

my $a = bless [];
ok !blessed(curse($a)),     'Can curse array ref';
is reftype($a), 'ARRAY',    'Cursing an array ref results in an array ref';

my $b = 1;
my $s = bless \$b;
ok !blessed(curse($s)),     'Can curse scalar ref';
is reftype($s), 'SCALAR',   'Cursing a scalar ref results in a scalar ref';

my $c = bless sub {1};
ok !blessed(curse($c)),     'Can curse code ref';
is reftype($c), 'CODE',     'Cursing a code ref results in a code ref';



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