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

Re: [MacPerl] use module in cwd




On Sat, 22 Jan 2000, Paul Schinder wrote:

> You've got a null string in @INC, maybe?  Try printing @INC out with 
> | around each entry.
> 
> My iBook uses HFS+ as well, so that's probably not it.  You might try 
> running Disk First Aid or equivalent and see if anything turns up.

Disk First Aid gave the drive a clean bill of health.

Okay, here's the latest iteration:  I print the name from a readdir, I
open it and print a line from it, and still get the "No such file or
directory" message.

How is this possible?  I wondered if the require was somehow setting the
cwd to something weird, so I added an END sub to print it out
again...here's the output:

-------------------------------------
  Cwd:
Annex:PowerWorld:Slurpie

  INC between bars:
|Annex:Development:MacPerl :site_perl:MacPPC:|
|Annex:Development:MacPerl :site_perl:|
|Annex:Development:MacPerl :ext:|
|Annex:Development:MacPerl :lib:MacPPC:|
|Annex:Development:MacPerl :lib:|
|Annex:Development:MacPerl :site_perl:MacPPC:|
|Annex:Development:MacPerl :site_perl:|
|:|
|Dev:Pseudo:|

  Filenames in local dir with ParseCountry:
ParseCountryList.pm

  First line of ParseCountryList.pm
package ParseCountryList;

# No such file or directory.
File ':ParseCountryList.pm'; Line 23
  Cwd again.
Annex:PowerWorld:Slurpie
----------------------------------------


And here's the code:


#!/usr/bin/perl -w
   
sub BEGIN
{
    use Cwd;
    
    my $cwd = cwd();
    
    print "  Cwd:\n";
    print "$cwd\n\n";
    chdir( $cwd) or die "Can't change to cwd: $!\n";
    
    print "  INC between bars:\n|";
    print (join "|\n|", @INC);
    print "|\n\n";

    print "  Filenames in local dir with ParseCountry:\n";
    opendir CWDD, ":";
    @filez = grep /ParseCountry/, readdir CWDD;
    print (join "\n", @filez);
    print "\n\n";
    
}

print "  First line of ParseCountryList.pm\n";
 open TRY, "< ParseCountryList.pm" or die "Open file failed: $!\n";
  while (<TRY>) {  print; last;  }
 close TRY;
print "\n";

require ParseCountryList;
   
    open OUTPUT, "> clist.out";
 
    my $p;
    
    ParseCountryList->parse("country.html", $p);

    print OUTPUT "Now for the data...\n";
        
    foreach $elem ( @{$p} )
    {
    	print OUTPUT "Name:  $elem->{'name'}, URL:  $elem->{'url'}, Abbr:
$elem->{'abbr'}\n";
    }

    close OUTPUT;


sub END
{
    my $cwd = cwd();
    print "  Cwd again.\n$cwd\n";
}


__END__


Maybe I should find a different occupation.  Truck-driving, maybe.


--
MattLangford 


# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org