URI-duri
view release on metacpan or search on metacpan
lib/URI/_duri_tdb.pm view on Meta::CPAN
{ goto \&_new_from_string }
elsif (reftype $param eq 'HASH')
{ goto \&_new_from_hashref }
croak "cannot construct URI::duri object";
}
sub _new_from_string
{
my ($class, $str) = @_;
my $self = bless \$str => $class;
$self->_deconstruct;
return $self;
}
sub _new_from_hashref
{
my ($class, $hashref) = @_;
my $str = $class->_preferred_scheme . ':2001:urn:example:1';
my $self = bless \$str => $class;
if ($hashref->{datetime_string})
{ $self->datetime_string($self->{datetime_string}) }
elsif ($hashref->{datetime})
{ $self->datetime($self->{datetime}) }
else
{ $self->datetime(DateTime->now) }
exists $hashref->{embedded_uri}
or croak "need embedded_uri hash key";
( run in 0.251 second using v1.01-cache-2.11-cpan-65fba6d93b7 )