NAME

Chandra::Pack - Bundle Chandra apps into distributable packages

SYNOPSIS

use Chandra::Pack;

my $packer = Chandra::Pack->new(
    script     => 'app.pl',
    name       => 'My App',
    version    => '1.0.0',
    icon       => 'icon.png',
    assets     => 'assets/',
    output     => 'dist/',
    identifier => 'com.example.myapp',
);

# Scan dependencies
my @deps = $packer->scan_deps;

# Build package
$packer->build(sub {
    my ($result) = @_;
    print "Built: $result->{path}\n" if $result->{success};
});

# Or build for a specific platform
$packer->build_macos;
$packer->build_linux;
$packer->build_windows;

DESCRIPTION

Chandra::Pack bundles a Perl script and its dependencies into a distributable application package. It creates .app bundles on macOS, AppImage-style directories on Linux, and portable directories on Windows.

METHODS

new(%args)

my $packer = Chandra::Pack->new(
    script     => 'app.pl',       # required
    name       => 'My App',       # default: derived from script name
    version    => '1.0.0',        # default: 0.0.1
    icon       => 'icon.png',     # optional
    assets     => 'assets/',      # optional
    output     => 'dist/',        # default: .
    platform   => 'macos',        # default: current platform
    identifier => 'com.x.myapp',  # default: org.perl.<name>
    perl       => '/usr/bin/perl',# default: current perl
    include    => ['DBI'],        # extra modules to include
    exclude    => ['Test::More'], # modules to skip
);

scan_deps

Returns a list of hashrefs with module and file keys for all detected dependencies.

build($callback)

Build for the configured platform. Calls $callback with a result hashref containing success, path, platform, and size.

build_macos

Build a macOS .app bundle.

build_linux

Build a Linux AppImage-style directory.

build_windows

Build a Windows portable directory.

SEE ALSO

Chandra::App