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

Re: [MacPerl] droplet to run email code examples and programs



>>I use the following code as a shortcut to test the Perl examples I receive
>>on this list without having to save them first.
>>


>I extracted your message and syntax checked it under perl, got this error
>report:
>
># Unmatched right bracket, at end of line
>
>Any suggestions of what my next step in debugging would be?
>
>-


Ooops! Sorry. My effort to clean up my code before I sent it to the list
backfired.

Try this one which includes Chris Nandor's suggested change to the text
clipping routine...

--------------

#!perl

use Mac::Resources;
use Mac::Memory;
package Dartmouth;

&MacPerl::LoadExternals("clipboard.XFCN"); # XCMD for clipboard processing
package main;

if (MacPerl::GetFileInfo($ARGV[0]) eq 'clpt') {
	$fileref = FSpOpenResFile(@ARGV, 1);
	if (defined($fileref)) {
		$reshand = Get1Resource('TEXT', 256);
		if ($reshand) { $code = $reshand->get() } # get text clipping
	}
	CloseResFile $fileref;
} elsif ($ARGV[0]) {
	do $ARGV[0];         # execute a dropped, previously saved program file
} else { $code = &Dartmouth::Clipboard() } # get clipboard contents


if ($code) {
	print "$code\n\n-------------------------\n\n";
	eval($code);
} else {
	print "\a";
	&MacPerl::Quit(0); # don't quit after ending the script
}



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch