Skip to content
Docs Try Aspire
Docs Try

PerlAppResource

Class net10.0
📦 CommunityToolkit.Aspire.Hosting.Perl v13.4.0
Represents a Perl application resource.
namespace Aspire.Hosting.ApplicationModel;
public class PerlAppResource
: Aspire.Hosting.ApplicationModel.ExecutableResource,
Aspire.Hosting.ApplicationModel.IResource,
Aspire.Hosting.ApplicationModel.IResourceWithEndpoints,
Aspire.Hosting.IResourceWithServiceDiscovery
{
// ...
}
ExecutableResourceIResourceIResourceWithEndpointsIResourceWithServiceDiscovery

This resource allows Perl applications (scripts, web servers, APIs, background services) to run as part of a distributed application. The resource manages the Perl executable, working directory, and lifecycle of the Perl application.

Perl applications can expose HTTP endpoints, communicate with other services, and participate in service discovery like other Aspire resources. They support automatic OpenTelemetry instrumentation for observability when configured with the appropriate Perl packages.

This resource supports various Perl execution environments including:

  • System Perl installations
  • User specified Perl environments
  • Local::Lib environments

Add a Perl web application using Mojolicious or Dancer2:

var builder = DistributedApplication.CreateBuilder(args);
var perl = builder.AddPerlApi("api", "../perl-api", "app.pl")
.WithHttpEndpoint(port: 5000)
.WithArgs("--host", "0.0.0.0");
builder.AddProject<Projects.Frontend>("frontend")
.WithReference(perl);
builder.Build().Run();