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

[MacPerl] Novice trouble with StandardFile



<x-flowed>I'm just starting to make use of Mac-ish stuff in MacPerl (heck, I'm 
just starting with Perl, really) and I got this error message from a 
simple (I thought) attempt to open and process a file:

# "" is not exported by the Mac::StandardFile module.
File '...MacPerl Ä:lib:Exporter.pm'; Line 111
# "" is not exported by the Mac::StandardFile module.
File '...MacPerl Ä:lib:Exporter.pm'; Line 111
# Can't continue after import errors
File 'Dev:Pseudo'; Line 3
# BEGIN failed--compilation aborted.
File '...:John's Fontsize cleaner'; Line 3

MacPerl also opened the Exporter.pm file to these lines:

...
elsif ($sym !~ s/^&// || !$exports{$sym}) {
	warn qq["$sym" is not exported by the $pkg module];
	$oops++;
}
...

This is beyond my deciphering. Here's my Perl (John's Fontsize cleaner):

use Mac::StandardFile
# John's fontsize cleaner
my ($file, @lines, $long_line);

$file = StandardGetFile(); # Ask user for a file

if ($file->sfGood()) {

	# Open the file and join the lines into $long_line
	open (HTMLFILE, $file) or die "What happened?!\n" ;
	@lines = <HTMLFILE>;
	close(HTMLFILE);
	$long_line = join("", @lines);

	$long_line =~ s/<fontsize="+1">(*)<\/font>/$1/gio # This does it

	print $long_line;
} else {
	print "User chose no file.";
}

$file = StandardPutFile(); # Ask user where to save file

if ($file->sfGood()) {
	# Open the file and save it
	open (HTMLFILE, $file) or die "What happened?!\n" ;
	print HTMLFILE $long_line;
	close (HTMLFILE);
} else {
	print "User chose no file.";
}

When I use -w the "my" line generates even more errors, but this 
seems enough to start with.

Thanks,
__John

p.s. If I comment out line 3:
my ($file, @lines, $long_line);

...then I get this error:

# Undefined subroutine &main::StandardGetFile called.
File '...:John's Fontsize cleaner'; Line 5
# BEGIN failed--compilation aborted.
File '...p:John's Fontsize cleaner'; Line 5
--
 All you  /\/\ John Abbe, Cat Herder johnca      "Imagination is more
     need \  /                       @ourpla.net  important than knowledge."
     is... \/  http://www.ourpla.net/john/                 --Einstein

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

</x-flowed>