Data-URIID
view release on metacpan or search on metacpan
lib/Data/URIID/Barcode.pm view on Meta::CPAN
# ABSTRACT: Extractor for identifiers from URIs
package Data::URIID::Barcode;
use v5.16;
use strict;
use warnings;
use Carp;
use Scalar::Util qw(weaken);
our $VERSION = v0.17;
use parent 'Data::URIID::Base';
use constant {map {$_ => []} qw(TYPE_UNKNOWN TYPE_OTHER TYPE_QRCODE TYPE_EAN13 TYPE_EAN8)};
my %_type_info = (
TYPE_UNKNOWN() => {
type => TYPE_UNKNOWN,
lib/Data/URIID/Barcode.pm view on Meta::CPAN
$opts{data} //= $from->as_string;
$opts{type} //= TYPE_QRCODE;
} else {
croak 'Unsupported/invalid from type';
}
}
croak 'No type given' unless defined $opts{type};
croak 'No data given' unless defined $opts{data};
weaken($opts{extractor});
$self = bless \%opts, $pkg;
return $self;
}
sub data {
my ($self, %opts) = @_;
delete $opts{default};
lib/Data/URIID/Colour.pm view on Meta::CPAN
# ABSTRACT: Extractor for identifiers from URIs
package Data::URIID::Colour;
use strict;
use warnings;
use overload '""' => \&rgb;
use Carp;
use Scalar::Util qw(weaken blessed);
our $VERSION = v0.17;
use parent qw(Data::URIID::Base Data::Identifier::Interface::Known);
my %_registered;
sub new {
lib/Data/URIID/Colour.pm view on Meta::CPAN
}
$opts{rgb} //= $_registered{$from};
}
croak 'No RGB value given' unless defined $opts{rgb};
$opts{rgb} = uc($opts{rgb});
$opts{rgb} =~ /^#[0-9A-F]{6}$/ or die 'Bad format';
weaken($opts{extractor});
$self = bless \%opts, $pkg;
if (delete $opts{register}) { # not (yet) part of public API
$_registered{$self->ise} //= $opts{rgb};
}
return $self;
}
lib/Data/URIID/Service.pm view on Meta::CPAN
use v5.10;
use strict;
use warnings;
use Carp;
use JSON;
use URI;
use URI::Escape;
use Encode;
use Scalar::Util qw(weaken);
use List::Util qw(all);
use DateTime::Format::ISO8601;
use Data::Identifier::Generate;
use Data::URIID::Result;
use Data::URIID::Colour;
our $VERSION = v0.17;
use parent 'Data::URIID::Base';
lib/Data/URIID/Service.pm view on Meta::CPAN
}
}
return $res = \%own_well_known;
}
# Private method:
sub new {
my ($pkg, %opts) = @_;
weaken($opts{extractor});
return bless \%opts, $pkg;
}
# Private helper:
sub _is_online {
my ($self) = @_;
return $self->online && $self->extractor->online;
}
# Private method:
( run in 0.255 second using v1.01-cache-2.11-cpan-65fba6d93b7 )