NewsClipper
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
print<<EOF;
Since you're doing a binary installation, I'm going to append your standard
Perl include path to modulepath in NewsClipper's configuration file,
which will allow News Clipper to see any additional modules you install in
your normal Perl module locations.
EOF
$module_path = "@INC";
}
else
{
print "\n","-"x78,"\n";
print<<EOF;
Since you're doing a single-user installation, I'm going to set modulepath in
NewsClipper's configuration file to point to \$INSTALLPRIVLIB (typically
something like $install_dir/lib/perl5/5.00502.)
This is so that you don't have to change your PERL5LIB variable, or run News
Clipper using "perl -I".
EOF
$module_path = '$(INSTALLPRIVLIB)';
}
}
else
{
$install_type = 'system';
require Config;
# There is no News Clipper module path for compiled versions. Instead
# we have to add @INC to modulepath
if (-d 'bin')
{
print "\n","-"x78,"\n";
print<<EOF;
Since you're doing a binary installation, I'm going to append your standard
Perl include path to modulepath in NewsClipper's configuration file,
which will allow News Clipper to see any additional modules you install in
your normal Perl module locations.
EOF
$module_path = "@INC";
}
else
{
$module_path = '';
}
}
return ($install_dir,$install_man_dir,$install_type,$module_path);
}
# --------------------------------------------------------------------------
# Figures out the user's home directory in Unix
sub Get_Home_Directory()
{
# Get the user's home directory. First try the password info, then the
# registry (if it's a Windows machine), then any HOME environment variable.
my $home = eval { (getpwuid($>))[7] } || $ENV{HOME};
die <<" EOF"
News Clipper could not determine your home directory. I tried to get your
home directory using both getpwuid and your HOME environment variable.
EOF
unless defined $home;
return $home;
}
# --------------------------------------------------------------------------
# Figures out the user's old installation directory, or returns undef
sub Get_Old_Install_Directory
{
# On Windows we look in the registry
if (($^O eq 'dos') || ($^O eq 'MSWin32'))
{
require Win32::TieRegistry;
Win32::TieRegistry->import();
my $ncKey = $Registry->{"LMachine\\SOFTWARE\\Spinnaker Software\\News Clipper\\"};
my @versions = sort { $a <=> $b } keys(%$ncKey);
my $latest_version = pop @versions;
my $install_dir = $ncKey->{$latest_version}{"InstallDir"};
require Win32;
return Win32::GetLongPathName($install_dir);
}
# On Unix we check the modulepath in the config file
else
{
my $home = Get_Home_Directory();
my $code;
if (defined $ENV{NEWSCLIPPER})
{
open CFG, "$ENV{NEWSCLIPPER}/NewsClipper.cfg";
$code = join '', <CFG>;
close CFG;
}
else
{
open CFG, "$home/.NewsClipper/NewsClipper.cfg";
$code = join '', <CFG>;
close CFG;
}
my ($install_dir) = $code =~ /modulepath' => '([^'\s]+)/s;
$install_dir =~ s/\/lib$//;
# Only return the directory if it looks like it came from a user install
# instead of a system install.
if ($install_dir =~ /$home/)
{
return $install_dir;
}
else
{
return undef;
}
}
( run in 2.733 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )