Skip to content

Instantly share code, notes, and snippets.

@rsimoes
Created November 18, 2011 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsimoes/1375890 to your computer and use it in GitHub Desktop.
Save rsimoes/1375890 to your computer and use it in GitHub Desktop.
Misusing autobox to manually box non-refs
#!/usr/bin/env perl
use strict;
use warnings;
use autobox;
package A;
sub call { print "A!\n" }
package B;
sub call { print "B!\n" }
package main;
bless \ my @arr, 'A';
@arr->call; # "A!"
bless \@arr, 'B';
@arr->call; # "B!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment