Aspire

Get started with the Perl hosting integration

⭐ Community Toolkit Perl Camel

The Aspire Community Toolkit Perl hosting integration runs Perl applications alongside the other resources in your AppHost. It models a Perl process as a first-class resource, manages its working directory and dependency installers, and supports local development and Dockerfile-based publishing.

The hosting package belongs in the AppHost. It creates an executable resource for your Perl application, while your project retains its scripts, modules, and dependency files.

AppHostPerl projectPerl hosting integrationPerl app resourcePerl runtimePerl application

Add CommunityToolkit.Aspire.Hosting.Perl to your AppHost. The Perl hosting reference includes package installation options.

Add a script resource and use a project-local module directory:

apphost.mts
import { createBuilder } from './.aspire/modules/aspire.mjs';
const builder = await createBuilder();
const worker = await builder.addPerlScript(
'worker',
'../perl-worker',
'worker.pl'
);
await worker.withLocalLib('local');
await builder.build().run();

The resource’s application directory is its working directory. Put a cpanfile there when you want Aspire to install project dependencies, and add an HTTP endpoint for a web API that listens on a port.

Set up Perl in the AppHost