Source

p5-xml-grddl / lib / XML / GRDDL / External.pm

package XML::GRDDL::External;

use 5.008;
use strict;

use XML::GRDDL;

our $VERSION = '0.003';

sub new
{
	my ($class, $profile, $referer, $grddl_object) = @_;

	# certain profiles known not to be GRDDLable
	my $ignore;
	foreach my $ignorant ($class->ignore)
	{
		if (ref $ignorant eq 'Regexp' && $profile =~ $ignorant)
			{ $ignore++ && last; }
		elsif (ref $ignorant eq 'CODE' && $ignorant->($profile))
			{ $ignore++ && last; }
		elsif ((!ref $ignorant) && $ignorant eq $profile)
			{ $ignore++ && last; }
	}
	return __PACKAGE__->_new_ignored($profile, $referer, $grddl_object)
		if $ignore; # i.e. do not bless it as a child class.
	
	my $self = bless {
		'uri'     => $profile,
		'referer' => $referer,
		'grddl'   => $grddl_object,
		}, $class;
	return $self;
}

sub _new_ignored
{
	my ($class, $profile, $referer, $grddl_object) = @_;
	my $self = bless {
		'uri'     => $profile,
		'referer' => $referer,
		'grddl'   => $grddl_object,
		}, $class;
	return $self;
}

sub ignore
{
	return;
}

sub transformations
{
	return;
}

1;

__END__

=head1 NAME

XML::GRDDL::External - base class for externally loaded documents

=head1 DESCRIPTION

This is the superclass of L<XML::GRDDL::Transformation>, L<XML::GRDDL::Profile>,
and L<XML::GRDDL::Namespace>. Doesn't do much on its own.

=head1 SEE ALSO

L<XML::GRDDL>,
L<XML::GRDDL::Transformation>, L<XML::GRDDL::Profile>, L<XML::GRDDL::Namespace>.

=head1 AUTHOR

Toby Inkster E<lt>tobyink@cpan.orgE<gt>.

=head1 COPYRIGHT AND LICENCE

Copyright 2008-2012 Toby Inkster

This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

=head1 DISCLAIMER OF WARRANTIES

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.