late in on this one but you can treat the clipboard as a filehandle if you pipe to pbpaste and pbcopy :


open (FROM_CLIPBOARD, "pbpaste|"); open (TO_CLIPBOARD, "|pbcopy");


you can then do as you normally would for moving data to and from fle handles. See the typically useful-in-a-real-world-situation example script below below which uses this technique - copy a word to the clipboard, run the script and it will place a backewards version on the clipboard to be pasted where ever.


#!/usr/bin/perl -w

use strict;
my($data,$word);
my(@letters);

open (FROM_CLIPBOARD, "pbpaste|");
open (TO_CLIPBOARD, "|pbcopy");


$data=<FROM_CLIPBOARD>;


if ($data){ $word=$data ;}
else { $word = "forwards"; }

@letters=split(//,$word);

print TO_CLIPBOARD reverse(@letters),"\n";

close (FROM_CLIPBOARD);
close (TO_CLIPBOARD);



On Tuesday, November 25, 2003, at 09:25 am, Jay Young wrote:

Is it possible to get the contents from the clipboard with Perl? Looking in a book I see - Win32::Clipboard

but is it possible to get it on the Mac in OS 10.3?

Thanks.

Jay




Reply via email to