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

Re: [MacPerl] is this a bug?



webmaster@mycoinfo.com (Brian McNett) wrote:
>Jim--
>
>The following is perfectly valid Perl syntax
>
>if ($^O eq 'MacOS') {
>	if ($#ARGV < 0) {
>		require Mac::StandardFile;
>		import  Mac::StandardFile;
>		$file = StandardGetFile('', 'TEXT');
>		if ($file->sfGood()) {
>			push(@ARGV, $file->sfFile());
>		} else {
>		  exit(1);
>		}
>	}
>}
>
>but in BBEdit (5.1), the word "import" should highlight in color (blue is 
>the default), and doesn't.  Is this a bug.  Has it been fixed in the 
>latest update?  Yes, I know, I'm slighlty behind. I'll go get a copy of 
>the update and get back to you. :)

I don't think "import" should be highlighted.  It's not a Perl builtin
function, it's just a subroutine.  Your line is equivalent to:

      'Mac::StandardFile'->import;

The only qualification I'll make is that the import() subroutine just happens
to be one that Perl knows about, like DESTROY or whatever.  I suppose DESTROY()
and friends are in blue, but import() seems to have a different flavor.  I
suppose I don't have strong feelings, though.

>FYT: I'm using the require/import pair, because "use" is evaluated at 
>compile time, and this messes up folks on Unix systems who might(!) not 
>have Mac::StandardFile.

You can just do
   eval "use Mac::StandardFile";
if you don't want to do the require/import combo.

  -------------------                            -------------------
  Ken Williams                             Last Bastion of Euclidity
  ken@forum.swarthmore.edu                            The Math Forum



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