Created
May 22, 2009 10:51
-
-
Save pmakholm/116060 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# | |
# An evil form of perl DESTROY-method | |
use strict; | |
use warnings; | |
{ | |
package Evil; | |
our @DESTROYED; | |
sub new { | |
my $class = shift; | |
return bless {}, $class; | |
} | |
sub DESTROY { | |
warn "Destroy $_[0]"; | |
push @DESTROYED, $_[0]; | |
} | |
} | |
my $evilobj = Evil->new(); | |
$evilobj = undef; | |
shift @Evil::DESTROYED; | |
shift @Evil::DESTROYED; | |
shift @Evil::DESTROYED; | |
shift @Evil::DESTROYED; | |
shift @Evil::DESTROYED; | |
shift @Evil::DESTROYED; | |
shift @Evil::DESTROYED; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment