Created
August 25, 2012 21:03
-
-
Save tokubass/3470970 to your computer and use it in GitHub Desktop.
Perl Beginners #4
This file contains 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/env perl | |
use strict; | |
use Data::Dumper; | |
my $strobj = MyURI::http->new({ str => 'http://hoge/'}); | |
warn Dumper $strobj; | |
warn $strobj; | |
package MyURI { | |
use overload ( | |
'""' => sub { ${$_[0]} }, | |
); | |
sub new { | |
my $class = shift; | |
my $str = shift->{str}; | |
bless \$str => 'MyURI::http'; | |
} | |
}; | |
package MyURI::http { | |
use parent -norequire => 'MyURI'; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment