On Wed, 11 Aug 1999, Ed Curtis wrote:
> The findConfig.pl program didn't come with your message.
Doh! Here are findConfig.pl and debugTest.pl both.
David
_________________________________________________________________________
David Coppit - Graduate Student [EMAIL PROTECTED]
The University of Virginia http://coppit.org/
"Yes," said Piglet, "Rabbit has Brain." There was a long silence.
"I suppose," said Pooh, "that that's why he never understands anything."
require 5.004;
use strict;
use vars qw( $home );
# ------------------------------------------------------------------------------
sub LoadConfig
{
$" = "\n";
print "\nStarting \@INC:\n@INC\n";
# Make sure the system-wide configuration directory is on INC, if one is
# specified.
unshift @INC,$ENV{'NEWSCLIPPER'}
if exists $ENV{'NEWSCLIPPER'} && ($^O ne 'MSWin32') && ($^O ne 'dos');
print "\n\$ENV{NEWSCLIPPER} is: $ENV{NEWSCLIPPER}\n";
# Make sure both the system-wide and user-specific configuration directory
# are on INC
unshift @INC,"$home/.NewsClipper";
print "\n\@INC, after adding \$ENV{NEWSCLIPPER} and \$home/.NewsClipper:\n@INC\n";
print "\n\%INC, before loading NewsClipper.cfg:\n";
foreach my $key (sort keys %INC)
{
print "$key => $INC{$key}\n";
}
require 'NewsClipper.cfg';
# No error message means we found it
if (!$@)
{
print "\nNewsClipper.cfg found in $INC{'NewsClipper.cfg'}\n";
}
else
{
print "\nError while loading NewsClipper.cfg\n";
}
# If there's an error...
if ($@)
{
# Die if we didn't find the config file.
if ($@ =~ /^Can't locate /)
{
print "\nCouldn't find NewsClipper.cfg\n";
}
else
{
print "\nNewsClipper.cfg was found\n";
print " but could not be loaded because of the following error:\n\n$@";
}
}
print "\n\%INC, after loading NewsClipper.cfg:\n";
foreach my $key (sort keys %INC)
{
print "$key => $INC{$key}\n";
}
# Take off the system and user directories now that configuration is loaded
shift @INC
if exists $ENV{'NEWSCLIPPER'} && ($^O ne 'MSWin32') && ($^O ne 'dos');
shift @INC;
print "\n\@INC, after removing \$ENV{NEWSCLIPPER} and \$home/.NewsClipper:\n@INC\n";
}
# ------------------------------------------------------------------------------
# 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.
$home = eval { (getpwuid($>))[7] } || GetWinInstallDir() || $ENV{HOME};
print "\$home is: $home\n";
LoadConfig();
require 'Config.pm';
print "\nPerl information:\n";
print `$Config::Config{perlpath} -v`;
print "\n";
for my $key (sort keys %Config::Config)
{
print "$key => $Config::Config{$key}\n";
}
use strict;
use Getopt::Std;
use vars qw(%opts);
BEGIN
{
getopt('ioc',\%opts);
}
use constant DEBUG => $opts{d} || 0;
sub dprint
{
return unless DEBUG;
print join '',@_;
return 1;
}
print "\nPerl information:\n";
require "Config.pm";
print `$Config::Config{perlpath} -v`;
print "\n";
print STDERR "blah\n";
for my $key (sort keys %Config::Config)
{
print "$key => $Config::Config{$key}\n";
}
# ------------------------------------------------------------------------------
package Test;
use constant DEBUG => main::DEBUG;
sub dprint;
*dprint = \&main::dprint;
dprint "This is a test.";