main->_print_pod_unix("/usr/local/lib/perl5/5.8.8/pod/perl.pod"); sub _print_pod_unix { my($w, $path) = @_; if (is_in_path("pod2man") && is_in_path("groff")) { my $pod2ps_pipe = "pod2man $path | groff -man -Tps"; if ($^O eq 'darwin') { my $cmd = "$pod2ps_pipe | /usr/bin/open -a Preview -f"; system($cmd) == 0 or $w->_die_dialog("Error while executing <$cmd>. Status code is $?"); return 1; } # XXX maybe determine user's environment (GNOME vs. KDE vs. plain X11)? my $gv = is_in_path("gv") || is_in_path("ghostview") || is_in_path("ggv") # newer versions seem to work || is_in_path("kghostview"); if ($gv) { # $w->_need_File_Temp; use File::Temp; my($fh,$fname) = File::Temp::tempfile(SUFFIX => ".ps"); system("$pod2ps_pipe > $fname"); push @tempfiles, $fname; my $pid = fork; if (!defined $pid) { die "Can't fork: $!"; } if ($pid == 0) { exec($gv, $fname); warn "Exec of $gv $fname failed: $!"; CORE::exit(1); } push @gv_pids, $pid; return 1; } } return 0; } sub is_in_path { my($prog) = @_; require Config; my $sep = $Config::Config{'path_sep'} || ':'; foreach (split(/$sep/o, $ENV{PATH})) { if ($^O eq 'MSWin32') { return "$_\\$prog" if (-x "$_\\$prog.bat" || -x "$_\\$prog.com" || -x "$_\\$prog.exe" || -x "$_\\$prog.cmd" ); } else { return "$_/$prog" if (-x "$_/$prog" && !-d "$_/$prog"); } } undef; }