File: RunTime.pm

package info (click to toggle)
swish-e 2.4.3-7
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 7,308 kB
  • ctags: 7,642
  • sloc: ansic: 47,402; sh: 8,508; perl: 5,281; makefile: 723; xml: 9
file content (67 lines) | stat: -rw-r--r-- 1,318 bytes parent folder | download | duplicates (2)
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
package Pod::HtmlPsPdf::RunTime;

use strict;

%Pod::HtmlPsPdf::RunTime::options = ();

# check whether we have a Storable avalable
eval {require Storable;};
my $Storable_exists = $@ ? 0 : 1;

########################
sub set_runtime_options{
  %Pod::HtmlPsPdf::RunTime::options = %{+shift};
} # end of sub set_runtime_options

# returns 1 if true, 0 -- otherwise
#######################
sub has_storable_module{

  # ps2html is bundled, so we can create PS
  return $Storable_exists;

} # end of sub has_storable_module

# returns 1 if true, 0 -- otherwise
#################
sub can_create_ps{

  # ps2html is bundled, so we can always create PS
  return 1;

  # if you unbundle it make sure you write here a code similar to
  # can_create_pdf()

} # end of sub can_create_ps

# returns 1 if true, 0 -- otherwise
#################
sub can_create_pdf{

    # check whether ps2pdf exists
  my $ps2pdf_exists = which( 'ps2pdf' );

  print(qq{It seems that you do not have ps2pdf installed! You have
	   to install it if you want to generate the PDF file
	  }),
	    return 0 
	      unless $ps2pdf_exists;
  return 1;

}  # end of sub can_create_pdf

sub which {
    my $cmd = shift;
    
    foreach my $dir (split( ':', $ENV{PATH})) {
        return "$dir/$cmd" if -x "$dir/$cmd";
    }

	return;
}

    


1;
__END__