1 package Pod::Perldoc::BaseTo;
8 use Carp qw(croak carp);
9 use Config qw(%Config);
10 use File::Spec::Functions qw(catfile);
12 sub is_pageable { '' }
13 sub write_with_binmode { 1 }
15 sub output_extension { 'txt' } # override in subclass!
17 # sub new { my $self = shift; ... }
18 # sub parse_from_file( my($class, $in, $out) = ...; ... }
20 #sub new { return bless {}, ref($_[0]) || $_[0] }
22 # this is also in Perldoc.pm, but why look there when you're a
28 *is_vms = $^O eq 'VMS' ? \&TRUE : \&FALSE unless defined &is_vms;
29 *is_mswin32 = $^O eq 'MSWin32' ? \&TRUE : \&FALSE unless defined &is_mswin32;
30 *is_dos = $^O eq 'dos' ? \&TRUE : \&FALSE unless defined &is_dos;
31 *is_os2 = $^O eq 'os2' ? \&TRUE : \&FALSE unless defined &is_os2;
32 *is_cygwin = $^O eq 'cygwin' ? \&TRUE : \&FALSE unless defined &is_cygwin;
33 *is_linux = $^O eq 'linux' ? \&TRUE : \&FALSE unless defined &is_linux;
34 *is_hpux = $^O =~ m/hpux/ ? \&TRUE : \&FALSE unless defined &is_hpux;
35 *is_openbsd = $^O =~ m/openbsd/ ? \&TRUE : \&FALSE unless defined &is_openbsd;
36 *is_bitrig = $^O =~ m/bitrig/ ? \&TRUE : \&FALSE unless defined &is_bitrig;
40 my($self, $name) = splice @_,0,2;
42 $self->{$name} = $_[0];
49 my( $self, @messages ) = @_;
51 ( defined(&Pod::Perldoc::DEBUG) and &Pod::Perldoc::DEBUG() )
55 my( $self, @messages ) = @_;
56 return unless $self->debugging;
57 print STDERR map { "DEBUG $_" } @messages;
61 my( $self, @messages ) = @_;
62 carp join "\n", @messages, '';
66 my( $self, @messages ) = @_;
67 croak join "\n", @messages, '';
70 sub _get_path_components {
73 my @paths = split /\Q$Config{path_sep}/, $ENV{PATH};
78 sub _find_executable_in_path {
79 my( $self, $program ) = @_;
82 foreach my $dir ( $self->_get_path_components ) {
83 my $binary = catfile( $dir, $program );
84 $self->debug( "Looking for $binary\n" );
85 next unless -e $binary;
86 unless( -x $binary ) {
87 $self->warn( "Found $binary but it's not executable. Skipping.\n" );
90 $self->debug( "Found $binary\n" );
103 Pod::Perldoc::BaseTo - Base for Pod::Perldoc formatters
107 package Pod::Perldoc::ToMyFormat;
109 use base qw( Pod::Perldoc::BaseTo );
114 This package is meant as a base of Pod::Perldoc formatters,
115 like L<Pod::Perldoc::ToText>, L<Pod::Perldoc::ToMan>, etc.
117 It provides default implementations for the methods
124 The concrete formatter must implement
133 =head1 COPYRIGHT AND DISCLAIMERS
135 Copyright (c) 2002-2007 Sean M. Burke.
137 This library is free software; you can redistribute it and/or modify it
138 under the same terms as Perl itself.
140 This program is distributed in the hope that it will be useful, but
141 without any warranty; without even the implied warranty of
142 merchantability or fitness for a particular purpose.
146 Current maintainer: Mark Allen C<< <mallen@cpan.org> >>
148 Past contributions from:
149 brian d foy C<< <bdfoy@cpan.org> >>
150 Adriano R. Ferreira C<< <ferreira@cpan.org> >>,
151 Sean M. Burke C<< <sburke@cpan.org> >>