Commits

Toby Inkster  committed 8fb0214

avoid method calls on bareword class names

  • Participants
  • Parent commits 3830559

Comments (0)

Files changed (7)

File lib/Web/ID.pm

 sub node
 {
 	my ($self) = @_;
-	RDF::Trine::Node::Resource->new($self->uri.'');
+	"RDF::Trine::Node::Resource"->new($self->uri.'');
 }
 
 sub get
 {
 	my $self = shift;
 	my @pred = map {
-		if (blessed $_ and $_->isa('RDF::Trine::Node'))   {   $_ }
+		if (blessed $_ and $_->isa("RDF::Trine::Node"))   {   $_ }
 		else                                              { u $_ }
 	} @_;
 	

File lib/Web/ID/Certificate.pm

 {
 	map  { ref($_) eq 'ARRAY' ? (@$_) : () }
 	part {
-		if ($_->isa('Web::ID::SAN::URI'))       { 0 }
-		elsif ($_->isa('Web::ID::SAN::Email'))  { 1 }
+		if ($_->isa("Web::ID::SAN::URI"))       { 0 }
+		elsif ($_->isa("Web::ID::SAN::Email"))  { 1 }
 		else                                    { 2 }
 	}
 	@_;
 
 has _x509 => (
 	is          => read_only,
-	isa         => 'Crypt::X509',
+	isa         => Type::Utils::class_type({ class => "Crypt::X509" }),
 	lazy_build  => true,
 );
 
 
 sub _build__x509
 {
-	return Crypt::X509->new(cert => shift->_der);
+	return "Crypt::X509"->new(cert => shift->_der);
 }
 
 sub _build_public_key
 {
 	my ($self) = @_;
-	Web::ID::RSAKey->new($self->_x509->pubkey_components);
+	Rsakey->new($self->_x509->pubkey_components);
 }
 
 sub _build_subject_alt_names
 			uniformResourceIdentifier  => 'Web::ID::SAN::URI',
 			rfc822Name                 => 'Web::ID::SAN::Email',
 		}->{ $args{type} }
-		// 'Web::ID::SAN';
+		// "Web::ID::SAN";
 	$class->new(%args);
 };
 
 sub timely
 {
 	my ($self, $now) = @_;
-	$now //= DateTime->now;
+	$now //= Datetime->class->now;
 	
 	return if $now > $self->not_after;
 	return if $now < $self->not_before;

File lib/Web/ID/Certificate/Generator.pm

 
 sub _openssl_path
 {
-	Path::Class::File->new(
+	"Path::Class::File"->new(
 		$^O eq 'Win32'
 			? 'c:\\openssl\\bin\\openssl.exe'
 			: '/usr/bin/openssl'
 	confess "unsupported options: ".(join q(, ), sort keys %options) if %options;
 	
 	my $days = $not_after
-		? $not_after->delta_days( DateTime->now )->days
+		? $not_after->delta_days( Datetime->class->now )->days
 		: 365;
 	
-	my $tempdir = Path::Class::Dir->new( File::Temp->newdir );
+	my $tempdir = "Path::Class::Dir"->new( File::Temp->newdir );
 	$tempdir->mkpath;
 	
 	my $config = $tempdir->file('openssl.cnf')->openw;
 	else
 	{
 		my $p12 = $tempdir->file('cert.p12')->slurp;
-		my $fh  = Path::Class::File->new($dest)->openw;
+		my $fh  = "Path::Class::File"->new($dest)->openw;
 		print $fh $p12;
 	}
 	
 	my ($on_triple, $on_done) = (sub {}, sub {});
 	if (ref $rdf_sink eq 'SCALAR')
 	{
-		$$rdf_sink = RDF::Trine::Model->new;
+		$$rdf_sink = Model->new;
 		$on_triple = sub { $$rdf_sink->add_statement(statement(@_)) };
 	}
 	elsif (blessed($rdf_sink) and $rdf_sink->isa('RDF::Trine::Model'))
 	}
 	else
 	{
-		my $model = RDF::Trine::Model->new;
-		my $fh    = Path::Class::File->new($rdf_sink)->openw;
+		my $model = Model->new;
+		my $fh    = "Path::Class::File"->new($rdf_sink)->openw;
 		$on_triple = sub { $model->add_statement(statement(@_)) };
-		$on_done   = sub { RDF::Trine::Serializer->new('RDFXML')->serialize_model_to_file($fh, $model) };
+		$on_done   = sub { "RDF::Trine::Serializer"->new('RDFXML')->serialize_model_to_file($fh, $model) };
 	}
 	
 	my $pem  = $tempdir->file('cert.pem')->slurp;

File lib/Web/ID/SAN.pm

 
 sub _build_model
 {
-	return RDF::Trine::Model->new;
+	return Model->new;
 }
 
 my $default_key_factory = sub
 	my (%args) = @_;
 	return unless $args{exponent};
 	return unless $args{modulus};
-	Web::ID::RSAKey->new(%args);
+	Rsakey->new(%args);
 };
 
 sub _build_key_factory
 sub uri_object
 {
 	my ($self) = @_;
-	return URI->new(sprintf 'urn:x-subject-alt-name:%s:%s', map {uri_escape $_} $self->type, $self->value);
+	return Uri->new(sprintf 'urn:x-subject-alt-name:%s:%s', map {uri_escape $_} $self->type, $self->value);
 }
 
 sub to_string

File lib/Web/ID/SAN/Email.pm

 
 use Moose;
 use namespace::sweep;
-extends 'Web::ID::SAN';
+extends "Web::ID::SAN";
 
 has '+type' => (default => 'rfc822Name');
 
 	{
 		if ($finger->endpoint)
 		{
-			my $store = RDF::Trine::Store::SPARQL->new($finger->endpoint);
-			return RDF::Trine::Model->new($store);
+			my $store = "RDF::Trine::Store::SPARQL"->new($finger->endpoint);
+			return Model->new($store);
 		}
 		return $finger->graph;
 	}

File lib/Web/ID/SAN/URI.pm

 override uri_object => sub
 {
 	my ($self) = @_;
-	return URI->new($self->value);
+	return Uri->new($self->value);
 };
 
 around _build_model => sub

File lib/Web/ID/Util.pm

 {
 	my ($uri, $model) = @_;
 	
-	$model //= RDF::Trine::Model->new;
+	$model //= "RDF::Trine::Model"->new;
 	eval {
-		RDF::Trine::Parser->parse_url_into_model($uri, $model);
+		"RDF::Trine::Parser"->parse_url_into_model($uri, $model);
 	};
 	
 	return $model;
 			if (match $_, $test_hex)
 			{
 				( my $hex = $node->literal_value ) =~ s/[^0-9A-F]//ig;
-				return Math::BigInt->from_hex("0x$hex");
+				return "Math::BigInt"->from_hex("0x$hex");
 			}
 			
 			if (match $_, $test_unsigned)
 			{
 				( my $dec = $node->literal_value ) =~ s/[^0-9]//ig;
-				return Math::BigInt->new("$dec");
+				return "Math::BigInt"->new("$dec");
 			}
 			
 			if (match $_, $test_signed)
 			{
 				( my $dec = $node->literal_value ) =~ s/[^0-9-]//ig;
-				return Math::BigInt->new("$dec");
+				return "Math::BigInt"->new("$dec");
 			}
 			
 			if (match $_, $test_decimal)
 					if defined $frac;
 				
 				$dec =~ s/[^0-9-]//ig;
-				return Math::BigInt->new("$dec");
+				return "Math::BigInt"->new("$dec");
 			}
 			
 			if (match $_, undef)
 		if ($opts{'fallback_type'} eq 'hex')
 		{
 			(my $hex = $node->literal_value) =~ s/[^0-9A-F]//ig;
-			return Math::BigInt->from_hex("0x$hex");
+			return "Math::BigInt"->from_hex("0x$hex");
 		}
 		else # dec
 		{
 				if defined $frac;
 				
 			$dec =~ s/[^0-9]//ig;
-			return Math::BigInt->new("$dec");
+			return "Math::BigInt"->new("$dec");
 		}
 	}