Skip to content

Instantly share code, notes, and snippets.

@tokubass
Created August 25, 2012 21:03
Show Gist options
  • Save tokubass/3470970 to your computer and use it in GitHub Desktop.
Save tokubass/3470970 to your computer and use it in GitHub Desktop.
Perl Beginners #4
#!/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