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_freebsd = $^O =~ m/freebsd/ ? \&TRUE : \&FALSE unless defined &is_freebsd;
37 *is_bitrig = $^O =~ m/bitrig/ ? \&TRUE : \&FALSE unless defined &is_bitrig;
41 my($self, $name) = splice @_,0,2;
43 $self->{$name} = $_[0];
50 my( $self, @messages ) = @_;
52 ( defined(&Pod::Perldoc::DEBUG) and &Pod::Perldoc::DEBUG() )
56 my( $self, @messages ) = @_;
57 return unless $self->debugging;
58 print STDERR map { "DEBUG $_" } @messages;
62 my( $self, @messages ) = @_;
63 carp join "\n", @messages, '';
67 my( $self, @messages ) = @_;
68 croak join "\n", @messages, '';
71 sub _get_path_components {
74 my @paths = split /\Q$Config{path_sep}/, $ENV{PATH};
79 sub _find_executable_in_path {
80 my( $self, $program ) = @_;
83 foreach my $dir ( $self->_get_path_components ) {
84 my $binary = catfile( $dir, $program );
85 $self->debug( "Looking for $binary\n" );
86 next unless -e $binary;
87 unless( -x $binary ) {
88 $self->warn( "Found $binary but it's not executable. Skipping.\n" );
91 $self->debug( "Found $binary\n" );
104 Pod::Perldoc::BaseTo - Base for Pod::Perldoc formatters
108 package Pod::Perldoc::ToMyFormat;
110 use parent qw( Pod::Perldoc::BaseTo );
115 This package is meant as a base of Pod::Perldoc formatters,
116 like L<Pod::Perldoc::ToText>, L<Pod::Perldoc::ToMan>, etc.
118 It provides default implementations for the methods
125 The concrete formatter must implement
134 =head1 COPYRIGHT AND DISCLAIMERS
136 Copyright (c) 2002-2007 Sean M. Burke.
138 This library is free software; you can redistribute it and/or modify it
139 under the same terms as Perl itself.
141 This program is distributed in the hope that it will be useful, but
142 without any warranty; without even the implied warranty of
143 merchantability or fitness for a particular purpose.
147 Current maintainer: Mark Allen C<< <mallen@cpan.org> >>
149 Past contributions from:
150 brian d foy C<< <bdfoy@cpan.org> >>
151 Adriano R. Ferreira C<< <ferreira@cpan.org> >>,
152 Sean M. Burke C<< <sburke@cpan.org> >>