# WithPackage

- Module: [CommunityToolkit.Aspire.Hosting.Perl](/reference/api/go/communitytoolkit.aspire.hosting.perl.md)
- Version: `13.6.1`
- Kind: `method`
- Defined on: [`PerlAppResource`](/reference/api/go/communitytoolkit.aspire.hosting.perl/perlappresource.md)
- Source: [GitHub](https://github.com/CommunityToolkit/Aspire/tree/d9c2addac6f527ef2e33712d290b84574b455a3b)

Adds a Perl package (module) to be installed before the application starts. Uses the configured package manager: cpan by default, or cpanm if `WithCpanMinus` was called.

## Remarks

A child installer resource is created that runs before the main application starts.
If the module is already installed (verified via `perl -MModuleName -e 1`),
installation is skipped. The installer uses the active package manager -- 
`cpan` by default, or `cpanm` if `WithCpanMinus`
was called.

## Definition

```go
func (PerlAppResource) WithPackage(
    packageName string,
    options ...*WithPackageOptions,
) PerlAppResource
```

## Parameters

- `packageName` (`string`) -- The name of the Perl module to install (e.g., "Mojolicious", "DBI").
- `options` (`...*WithPackageOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithPackageOptions` argument.

- `Force` (`*bool`) -- If `true`, force installation even if the module is already installed or tests fail.
- `SkipTest` (`*bool`) -- If `true`, skip running tests during installation.

## Returns

[`PerlAppResource`](/reference/api/go/communitytoolkit.aspire.hosting.perl/perlappresource.md) -- A reference to the `IResourceBuilder`.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`PerlAppResource`](/reference/api/go/communitytoolkit.aspire.hosting.perl/perlappresource.md)
