Re: Proposed Mac::Pasteboard

[email protected]
Newsgroups perl.macosx
Organization http://groups.google.com
Message-ID <23e4b5a9-68b1-44f7-9161-4d41d606ca93@z17g2000hsg.googlegroups.com>
On Jan 27, 10:49 am, [email protected] (Chas. Owens) wrote:
> On Jan 26, 2008 10:46 PM,  <[email protected]> wrote:
>
> > On Jan 22, 2:31 am, [email protected] (Brian D Foy) wrote:
> > > [[ This message was both posted and mailed: see
> > >    the "To," "Cc," and "Newsgroups" headers for details. ]]
>
> > > In article
> > > <012120080315.17779.47940E4B0005B0340000457322007507440B0B9A0300979D9D0E
>
> > > [email protected]>, <[email protected]> wrote:
> > > > Is there a module that will let one manipulate a Mac OS X pasteboard? There
> > > > does not seem to be anything on CPAN that strikes me as being for that
> > > > purpose.
>
> > > I'd like to have such a thing, although you should call it
> > > Mac::Clipboard :)
>
> > I dithered about this. The arguments as I see them are:
>
> > For Mac::Clipboard
>
> > 1) That's what most people call the thing.
>
> > For Mac::Pasteboard
>
> > 1) It's what the Apple documentation calls it.
>
> > 2) There's a lot more to it than (e.g.) Win32::Clipboard. For one
> > thing, there's more than one of them -- in fact, as many as you like.
> > Each can have multiple data items, with data in multiple flavors.
>
> snip
>
> Why choose?  Write Mac::Pasteboard with all of the bells and whistles
> and then write Mac::Clipboard using Mac::Pasteboard to expose only the
> clipboard.  In the SEE ALSO section you can reference Mac::Pasteboard
> and people who need the advanced functionality can find it.

Interesting thought. The straightforward implementation would be to
have Mac::Clipboard depend on Mac::Pasteboard (since there's no
simplified clipboard interface that I have found). But it seems un-
parsimonious to me to use namespace for maybe a dozen lines of Perl,
since right now the "clipboard" part is on the order of

my %pb_cache;

sub pbcopy {
    my $pb = $pb_cache{kPasteboardClipboard} ||= __PACKAGE__->new
(kPasteboardClipboard);
    $pb->copy (@_);
}

sub pbpaste {
    my $pb = $pb_cache{kPasteboardClipboard} ||= __PACKAGE__->new
(kPasteboardClipboard);
    $pb->paste (@_);
}

But thanks for the suggestion.

Tom Wyant
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.