CommunityToolkit.Aspire.Hosting.Perl 13.4.0

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package CommunityToolkit.Aspire.Hosting.Perl --version 13.4.0
                    
NuGet\Install-Package CommunityToolkit.Aspire.Hosting.Perl -Version 13.4.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Perl" Version="13.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CommunityToolkit.Aspire.Hosting.Perl" Version="13.4.0" />
                    
Directory.Packages.props
<PackageReference Include="CommunityToolkit.Aspire.Hosting.Perl" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CommunityToolkit.Aspire.Hosting.Perl --version 13.4.0
                    
#r "nuget: CommunityToolkit.Aspire.Hosting.Perl, 13.4.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CommunityToolkit.Aspire.Hosting.Perl@13.4.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CommunityToolkit.Aspire.Hosting.Perl&version=13.4.0
                    
Install as a Cake Addin
#tool nuget:?package=CommunityToolkit.Aspire.Hosting.Perl&version=13.4.0
                    
Install as a Cake Tool

CommunityToolkit.Aspire.Hosting.Perl library

Provides extensions methods and resource definitions for the Aspire AppHost to support running Perl.

Using the Perl Hosting Integration

A guide for developers using CommunityToolkit.Aspire.Hosting.Perl for the first time, or as a reference when revisiting the API. This document explains how key hosting API calls map to on-disk directory layout, environment variable configuration, and runtime behavior.

Quick Start

Install the package in your AppHost project:

dotnet add package CommunityToolkit.Aspire.Hosting.Perl

Add a Perl script resource in your AppHost.cs:

var builder = DistributedApplication.CreateBuilder(args);

builder.AddPerlScript("my-worker", "scripts", "Worker.pl")
    .WithCpanMinus()
    .WithPackage("Some::Module", skipTest: true)
    .WithLocalLib("local");

builder.Build().Run();

If there are things to install, it should warn you in the dashboard. You should see links to installation instructions.

See notes about the appDirectory parameter below.


Core Concepts

The integration provides two entry points for adding Perl resources:

Method Purpose
AddPerlScript(name, appDirectory, scriptName) Adds a Perl script (worker, CLI tool, etc.)
AddPerlApi(name, appDirectory, scriptName) Adds a Perl API server (e.g., Mojolicious daemon)

Both create a PerlAppResource that appears in the Aspire dashboard. All subsequent configuration methods (.WithCpanMinus(), .WithLocalLib(), etc.) chain off the resource builder.


The appDirectory Parameter

appDirectory is the anchor for all relative path resolution in the integration. It determines:

  • The resource's WorkingDirectory — where Perl runs
  • Where WithLocalLib("local") resolves to
  • Where cpanfile discovery happens (for WithProjectDependencies)
  • The base for the script path

appDirectory is resolved relative to the AppHost project directory (the folder containing the .csproj).

"." — AppHost-rooted

When appDirectory is ".", the working directory is the AppHost project folder itself. Files like cpanfile, cpanfile.snapshot, and the local/ directory all live alongside the .csproj:

MyApp.AppHost/
├── AppHost.cs
├── MyApp.AppHost.csproj
├── cpanfile              ← discovered here
├── cpanfile.snapshot
├── local/                ← WithLocalLib("local") resolves here
│   └── lib/perl5/...
└── Properties/
scripts/
└── API.pl                ← script path "../scripts/API.pl"

"../scripts" — sibling folder

When appDirectory is "../scripts", the working directory shifts to a sibling scripts/ folder. Everything resolves relative to that folder:

MyApp.AppHost/
├── AppHost.cs
├── MyApp.AppHost.csproj
└── Properties/
scripts/                   ← working directory
├── Worker.pl              ← script path "Worker.pl"
└── local/                 ← WithLocalLib("local") resolves here
    └── lib/perl5/...

Key insight: The script path in AddPerlScript / AddPerlApi is relative to AppHost.cs, and so is everything else — WithLocalLib, cpanfile discovery, and the process working directory.


WithLocalLib

.WithLocalLib("local")         // relative path — resolved against appDirectory
.WithLocalLib("/opt/lib")      // rooted Unix-style path — used as-is
.WithLocalLib("C:\\perl-lib") // rooted Windows path — used as-is

WithLocalLib configures local::lib-style module isolation. The path parameter is resolved relative to the resource's working directory (appDirectory), not relative to the AppHost project, unless the path is already rooted.

Implementation note: WithLocalLib path resolution uses Path.IsPathRooted(configuredPath). If true, the value is used directly. If false, it is combined with the resource working directory and converted to an absolute path.

Resolution examples

appDirectory WithLocalLib(...) Resolved absolute path
"." "local" <AppHost>/local
"../scripts" "local" <AppHost>/../scripts/local
"." "/opt/perl-libs" /opt/perl-libs (Linux/macOS)
"." "C:\\perl-libs" C:\\perl-libs (Windows)

Package Management

While I highly recommend you use cpanm or Carton, the integration aims to support three package managers and two installation strategies:

Package Manager Individual Packages Project Dependencies
cpan (default) .WithPackage("Module") ❌ Not supported (auto-switches to cpanm when calling .WithProjectDependencies())
cpanm (App::cpanminus) .WithCpanMinus().WithPackage("Module") .WithCpanMinus().WithProjectDependencies()
Carton ❌ Not supported .WithCarton().WithProjectDependencies()

The default package manager is cpan, but it is automatically switched to cpanm when WithProjectDependencies() is called, since cpan does not support --installdeps. WithLocalLib() will also currently swap to cpanm because it wasn't clear to me at time of release how to integrate it with cpan.


Additional Information

For more info visit https://aspire.dev/integrations/frameworks/perl/.

Roadmap

I'll place a roadmap in Issues to track going forward.

Additional Examples

I'll create a personal repo with a variety of samples shortly after the first release.

Feedback & contributing

Please see the main repo for contribution guidelines: https://github.com/CommunityToolkit/Aspire.

Credits

There are many people to thank, but the work of JJAtria in making the OpenTelemetry::SDK module is what makes this integration feel great in Aspire and without it, I don't know that I would have even attempted to create it.

Thanks also to the Aspire Discord community at large for all the assistance when I had questions about the internals of Aspire.

Referenced Libraries

This integration references or interacts with the following Perl ecosystem libraries and tools, while the libraries themselves are only installed by individual developers for their projects, I do use them as examples and want to give credit and note their licensing for posterity:

Resource Website / Repository License
Perl perl.org Artistic / GPL
Strawberry Perl strawberryperl.com Artistic / GPL
perlbrew perlbrew.pl MIT
Berrybrew GitHub License
App::cpanminus (cpanm) GitHub License
Carton GitHub License
local::lib metacpan License
Mojolicious mojolicious.org Artistic-2.0
OpenTelemetry::SDK GitHub License
IO::Socket::SSL metacpan License
LWP::UserAgent metacpan License
Google::ProtocolBuffers::Dynamic metacpan License
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
13.4.1-beta.706 32 8/6/2026
13.4.1-beta.704 35 8/5/2026
13.4.1-beta.701 34 8/4/2026
13.4.1-beta.700 47 8/2/2026
13.4.1-beta.696 50 8/1/2026
13.4.1-beta.687 51 7/27/2026
13.4.1-beta.686 49 7/16/2026
13.4.1-beta.685 68 7/9/2026
13.4.1-beta.683 57 7/9/2026
13.4.1-beta.680 57 7/7/2026
13.4.1-beta.676 59 7/7/2026
13.4.1-beta.675 52 7/6/2026
13.4.1-beta.674 53 7/6/2026
13.4.0 178 6/2/2026
13.4.0-beta.671 59 7/3/2026
13.4.0-beta.654 77 6/18/2026
13.4.0-beta.651 70 6/17/2026
13.3.0 144 5/15/2026