Apache-TopicMaps
view release on metacpan or search on metacpan
lib/Apache/TopicMaps.pm view on Meta::CPAN
$tm->load_file( $path,$pm,$parse,$param ) || die("unable to load $path, " . $tm->get_error() );
}
else
{
$tm->load_file( $path,$pm,$parse ) || die("unable to load $path, " . $tm->get_error() );
}
}
elsif( $path =~ /^http/ )
{
my $request = HTTP::Request->new('GET', '$path');
#$request->authorization_basic("user","pass");
my $tm_id = time() .'-'.$$;
my $response = $ua->request($request, '/tmp/topicmap'.$tm_id);
$tm->load_file( '/tmp/topicmap'.$tm_id,$pm,$parse );
# FIXME: check loaded!
}
else
{
# FIXME
die("$path has unsopported protocol");
}
}
}
sub getTM
{
my ($tm,$uri) = @_;
my $request = HTTP::Request->new('GET', $uri);
$request->header( 'Accept' => 'application/xtm+xml' );
my $tm_id = $$ .'-'.$tmc ;
$tmc++;
my $response = $ua->request($request, '/tmp/topicmap_' . $tm_id);
print STDERR $response->status_line," ZZZZZ\n";
return unless( $response->is_success );
my $rval = $tm->load_file( '/tmp/topicmap_' . $tm_id, 'xtm_simple' , 'xml' , "" , $uri);
if(!defined $rval)
{
( run in 1.041 second using v1.01-cache-2.11-cpan-de7293f3b23 )