[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] perldoc on Mac



New version.  Finds stuff in "MacPerl Help" if not found elsewhere.

#!perl
# macperldoc
# requires IC setup to use Shuck for pod URLs
use Mac::InternetConfig;
use DB_File;
use strict;
my($what, $why, $where, $ic, %help, $evt);

$what = MacPerl::Ask('What do YOU want?');
eval("require $what");
if (!$@) {
  ($why = $what) =~ s|::|/|;
  $where = $INC{"$why.pm"};
} elsif (-e "$ENV{MACPERL}pod:$what.pod") {
    $where = "$ENV{MACPERL}pod:$what.pod";
} else {
  tie(%help, 'DB_File', "$ENV{MACPERL}MacPerl Help", O_RDONLY, 0) or die $!;
  if (defined($help{$what})) {
    ($where = $help{$what}) =~ s|^pod:|$ENV{MACPERL}|;
    $where =~ tr|/|:|;
  }
}

if (!$where) {
  MacPerl::Answer("Cannot find $what.");
  exit;
} else {
  $ic = ICStart();
  ICGeneralFindConfigFile($ic);
  ICLaunchURL($ic, 0, "pod:///$where");
  ICStop($ic);
}
__END__

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch