GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  ACME::DAMN (3)

.ds Aq ’

NAME

Acme::Damn - ’Unbless’ Perl objects.

CONTENTS

SYNOPSIS



  use Acme::Damn;

  my $ref = ... some reference ...
  my $obj = bless $ref , Some::Class;
 
  ... do something with your object ...

     $ref = damn $obj;   # recover the original reference (unblessed)

  ... neither $ref nor $obj are Some::Class objects ...



DESCRIPTION

<B>Acme::DamnB> provides a single routine, <B>B>damn()<B>B>, which takes a blessed reference (a Perl object), and unblesses it, to return the original reference.

    EXPORT

By default, <B>Acme::DamnB> exports the method <B>B>damn()<B>B> into the current namespace. Aliases for <B>B>damn()<B>B> (see below) may be imported upon request.

    Methods

<B>damnB> object <B>B>damn()<B>B> accepts a single blessed reference as its argument, and returns that reference unblessed. If object is not a blessed reference, then <B>B>damn()<B>B> will die with an error.
<B>blessB> reference
<B>blessB> reference [ , package ]
<B>blessB> reference [ , undef ] Optionally, <B>Acme::DamnB> will modify the behaviour of bless to allow the passing of an explicit undef as the target package to invoke <B>B>damn()<B>B>:



    use Acme::Damn  qw( bless );

    my  $obj = ... some blessed reference ...;

    # the following statements are equivalent
    my  $ref = bless $obj , undef;
    my  $ref = damn $obj;



<B>NOTE:B> The modification of bless is lexically scoped to the current package, and is not global.

    Method Aliases

Not everyone likes to damn the same way or in the same language, so <B>Acme::DamnB> offers the ability to specify any alias on import, provided that alias is a valid Perl subroutine name (i.e. all characters match \w).



  use Acme::Damn qw( unbless );
  use Acme::Damn qw( foo );
  use Acme::Damn qw( unblessthyself );
  use Acme::Damn qw( recant );



Version 0.02 supported a defined list of aliases, and this has been replaced in v0.03 by the ability to import any alias for damn().

WARNING

Just as bless doesn’t call an object’s initialisation code, damn doesn’t invoke an object’s DESTROY method. For objects that need to be DESTROYed, either don’t damn them, or call DESTROY before judgement is passed.

ACKNOWLEDGEMENTS

Thanks to Claes Jacobsson <claes@surfar.nu> for suggesting the use of aliases, and Bo Lindbergh <blgl@cpan.org> for the suggested modification of bless.

SEE ALSO

bless, perlboot, perltoot, perltooc, perlbot, perlobj.

AUTHOR

Ian Brayshaw, <ian@onemore.org>

COPYRIGHT AND LICENSE

Copyright 2003-2012 Ian Brayshaw

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DAMN (3) 2014-10-26

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.