File: test.psgi

package info (click to toggle)
libatteanx-store-ldf-perl 0.04-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 228 kB
  • sloc: perl: 346; makefile: 17; sh: 1
file content (72 lines) | stat: -rw-r--r-- 1,841 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env perl
 
use strict;
use warnings;
use Plack::App::RDF::LinkedData;
use RDF::LinkedData;
use Plack::Request;
use Plack::Builder;
use Config::JFDI;
use Carp qw(confess);
use Module::Load::Conditional qw[can_load];
 
=head1 NAME
 
linked_data.psgi - A simple Plack server for RDF as linked data
 
=head1 INSTRUCTIONS
 
See L<Plack::App::RDF::LinkedData> for instructions on how to use this.
 
=cut
 
 
my $config;
BEGIN {
        unless ($config = Config::JFDI->open(
                                        name => "RDF::LinkedData"
                                       )) {
                if ($ENV{'PERLRDF_STORE'}) {
                        $config->{store} = $ENV{'PERLRDF_STORE'};
                        $config->{base_uri} = 'http://localhost:5000';
                } else {
                        confess "Couldn't find config";
                }
        }
}
 
my $linkeddata = Plack::App::RDF::LinkedData->new();
 
$linkeddata->configure($config);
 
my $rdf_linkeddata = $linkeddata->to_app;
 
builder {
        enable "Head";
        enable "ContentLength";
        enable "ConditionalGET";
        if (defined($config->{expires}) && (can_load( modules => { 'Plack::Middleware::Expires' => 0 }))) {
                enable 'Expires',
                  content_type => qr//,
                  expires => $config->{expires}
          };
        if (can_load( modules => { 'Plack::Middleware::CrossOrigin' => 0 })) { enable 'CrossOrigin' => %{$config->{cors}}};
        $rdf_linkeddata;
};
 
 
__END__
 
 
=head1 AUTHOR
 
Kjetil Kjernsmo C<< <kjetilk@cpan.org> >>
 
=head1 COPYRIGHT
 
Copyright (c) 2010 ABC Startsiden AS and Gregory Todd Williams and
2010, 2011, 2012, 2013, 2014, 2015 Kjetil Kjernsmo. This program is
free software; you can redistribute it and/or modify it under the same
terms as Perl itself.
 
=cut