TVDB: better handling of first run
[nonametv.git] / lib / NonameTV / Path.pm
blob6b305f96aba603de12ce17d9997de215dd75d11b
1 package NonameTV::Path;
3 =head1 NAME
5 NonameTV::Path - Locate different parts of the NonameTV source.
7 =head1 SYNOPSIS
9 use NonameTV::Path;
11 print NonameTV::Path::Root();
13 =head1 DESCRIPTION
15 Locates the full path to the directory where NonameTV is located.
16 This is done based on the location of the NonameTV::Path module.
18 =cut
20 use Cwd qw/abs_path/;
22 my $root;
24 BEGIN {
25 my $pathfile = abs_path( $INC{"NonameTV/Path.pm"} );
26 ( $root ) = ( $pathfile =~ m%(.*)/lib/NonameTV/Path.pm% );
27 if( not -f "$root/lib/NonameTV/Path.pm" ) {
28 print STDERR "Failed to find NonameTV installation at $root.\n";
29 exit 1;
33 sub Root {
34 return $root;
37 sub Templates {
38 return "$root/templates";