Commits

Toby Inkster committed e1a4572

Kinda working now.

Comments (0)

Files changed (6)

lib/RDF/Shortcuts.pm

 	$RDF::Shortcuts::VERSION   = '0.001';
 }
 
-use Exporter;
+use base qw[Exporter];
 use RDF::Trine;
 use Scalar::Util qw[blessed refaddr];
 
 		};
 }
 
-my @modules = qw(Parse Serialise Query Node Statement Pattern);
 our (@EXPORT, @EXPORT_OK, %EXPORT_TAGS, %GOT);
 
 BEGIN
 {
+	my @modules = qw(Parse Serialise Query Node Statement Pattern);
+
 	foreach my $module (@modules)
 	{
 		my $class = join '::', __PACKAGE__, $module;
-		next unless eval "use RDF::Shortcuts::$module; 1;";
+		unless (eval "use RDF::Shortcuts::$module; 1;")
+		{
+			warn $@;
+			next;
+		}
+		
 		$GOT{$module} = TRUE;
-		push @EXPORT, eval "@${class}::EXPORT";
-		push @EXPORT_OK, eval "@${class}::EXPORT_OK";
-		my %tags = eval "%${class}::EXPORT_TAGS";
+		push @EXPORT, eval "\@${class}::EXPORT";
+		push @EXPORT_OK, eval "\@${class}::EXPORT_OK";
+		my %tags = eval "\%${class}::EXPORT_TAGS";
 		while (my ($tag, $names) = each %tags)
 		{
 			push @{ $EXPORT_TAGS{$tag} }, @$names
 				if ref $names eq 'ARRAY';
 		}
-		$EXPORT_TAGS{lc "$class\_all"} = [ eval "@${class}::EXPORT_OK" ];
-		$EXPORT_TAGS{lc "$class"} = [ eval "@${class}::EXPORT" ];
-		$class->import("@${class}::EXPORT_OK");
+		$EXPORT_TAGS{lc "$module\_all"} = [ eval "\@${class}::EXPORT_OK" ];
+		$EXPORT_TAGS{lc "$module"} = [ eval "\@${class}::EXPORT" ];
+		
+		$class->import( eval "\@${class}::EXPORT_OK" );
 	}
 	$EXPORT_TAGS{'all'}      = \@EXPORT_OK;
 	$EXPORT_TAGS{'standard'} = \@EXPORT;

lib/RDF/Shortcuts/Node.pm

 
 use base qw[Exporter];
 use Scalar::Util qw[blessed];
+use Sub::Name qw[subname];
 
 our (@EXPORT, @EXPORT_OK, %EXPORT_TAGS, %GOT);
 BEGIN

lib/RDF/Shortcuts/Parse.pm

+1;

lib/RDF/Shortcuts/Parser.pm

-1;

lib/RDF/Shortcuts/Pattern.pm

 
 use base qw[Exporter];
 use Scalar::Util qw[blessed];
+use Sub::Name qw[subname];
 
 our (@EXPORT, @EXPORT_OK, %EXPORT_TAGS);
 BEGIN
 {
 	@EXPORT    = qw[];
 	@EXPORT_OK = qw[pattern rdf_pattern];
+	
+	foreach my $f (@EXPORT_OK)
+	{
+		no strict 'refs';
+		*{"RDF::Shortcuts::$f"} = subname "RDF::Shortcuts::$f" => \&$f;
+	}
 }
 
 use RDF::Shortcuts::Statement qw(statement);

lib/RDF/Shortcuts/Statement.pm

 
 use base qw[Exporter];
 use Scalar::Util qw[blessed];
+use Sub::Name qw[subname];
 
 our (@EXPORT, @EXPORT_OK, %EXPORT_TAGS);
 BEGIN
 {
 	@EXPORT    = qw[];
 	@EXPORT_OK = qw[statement quad triple rdf_statement rdf_quad rdf_triple];
+
+	foreach my $f (@EXPORT_OK)
+	{
+		no strict 'refs';
+		*{"RDF::Shortcuts::$f"} = subname "RDF::Shortcuts::$f" => \&$f;
+	}
 }
 
 use RDF::Shortcuts::Node   qw(node);
-use RDF::Shortcuts::Parser qw(rdf_parse);
+use RDF::Shortcuts::Parse  qw(rdf_parse);
 
 sub statement
 {
 	$s = (ref $s eq 'ARRAY') ? node(@$s) : node($s);
 	$p = (ref $p eq 'ARRAY') ? node(@$p) : node($p);
 	$o = (ref $o eq 'ARRAY') ? node(@$o) : node($o);
-	$g = (ref $g eq 'ARRAY') ? node(@$g) : node($g);
+	$g = (ref $g eq 'ARRAY') ? node(@$g) : node($g, passthrough_undef=>1);
+
+	use Data::Dumper;
+	print Dumper([$s, $p, $o, $g]);
 
 	return defined $g
-		? RDF::Trine::Statement->new($s, $p, $o, $g)
+		? RDF::Trine::Statement::Quad->new($s, $p, $o, $g)
 		: RDF::Trine::Statement->new($s, $p, $o);
 }