NAME

Chandra::Clipboard - System clipboard access for Chandra applications

SYNOPSIS

use Chandra::Clipboard;

# Text
Chandra::Clipboard->set_text('Hello, World!');
my $text = Chandra::Clipboard->get_text;

# HTML
Chandra::Clipboard->set_html('<b>Bold</b>');
my $html = Chandra::Clipboard->get_html;

# Image (PNG bytes)
Chandra::Clipboard->set_image('/path/to/image.png');
my $png = Chandra::Clipboard->get_image;

# Query
print "has text\n"  if Chandra::Clipboard->has_text;
print "has html\n"  if Chandra::Clipboard->has_html;
print "has image\n" if Chandra::Clipboard->has_image;

# Clear
Chandra::Clipboard->clear;

DESCRIPTION

Chandra::Clipboard provides cross-platform system clipboard access. All methods are class methods — no object instantiation needed.

Platform Support

macOS — NSPasteboard (Cocoa)
Linux — GTK clipboard (gtk_clipboard_*)
Windows — stub (not yet implemented)

METHODS

get_text()

Returns the current clipboard text, or undef if unavailable.

set_text($string)

Sets the clipboard to the given text. Returns 1 on success.

has_text()

Returns true if the clipboard contains text.

get_html()

Returns clipboard HTML content, or undef.

set_html($html)

Sets the clipboard to the given HTML. Returns 1 on success.

has_html()

Returns true if the clipboard contains HTML.

get_image()

Returns raw PNG bytes from the clipboard, or undef.

set_image($path)

Loads an image file and places it on the clipboard. Returns 1 on success.

has_image()

Returns true if the clipboard contains an image.

clear()

Clears all clipboard contents.

SEE ALSO

Chandra, Chandra::App

1 POD Error

The following errors were encountered while parsing the POD:

Around line 45:

Non-ASCII character seen before =encoding in '—'. Assuming UTF-8