NAME

Chandra - Perl bindings to webview-c for creating cross-platform GUIs

SYNOPSIS

use Chandra;

# Simple one-liner
Chandra->new(
    title  => 'My App',
    url    => 'https://example.com',
    width  => 800,
    height => 600,
)->run;

# Advanced usage with event loop control
my $app = Chandra->new(
    title    => 'My App',
    url      => 'data:text/html,<h1>Hello from Perl!</h1>',
    debug    => 1,
    callback => sub {
        my ($arg) = @_;
        print "JS called: $arg\n";
    },
);

$app->init;

while ($app->loop(1) == 0) {
    # Event loop
}

$app->exit;

DESCRIPTION

Chandra provides Perl bindings to the webview-c library, allowing you to create cross-platform GUI applications using web technologies (HTML, CSS, JS).

It supports: - macOS (WebKit) - Linux (WebKitGTK) - Windows (MSHTML/Edge)

METHODS

new(%args)

Create a new Chandra instance.

Options: - title: Window title (default: 'Chandra') - url: Initial URL or data URI (default: 'about:blank') - width: Window width (default: 800) - height: Window height (default: 600) - resizable: Allow resizing (default: 1) - debug: Enable developer tools (default: 0) - callback: Perl sub called when JS invokes window.external.invoke()

run()

Simple blocking run - shows window and blocks until closed.

init()

Initialize the webview for manual event loop control.

loop($blocking)

Process one event. Returns non-zero when window should close.

eval_js($javascript)

Execute JavaScript in the webview.

set_title($title)

Change the window title.

terminate()

Signal the event loop to stop.

exit()

Clean up and close the webview.

AUTHOR

Prototype

LICENSE

MIT