# WithLocalLib

- 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)

Configures the Perl application to use a local::lib directory for module isolation. Sets `PERL5LIB`, `PERL_LOCAL_LIB_ROOT`, `PERL_MM_OPT`, and `PERL_MB_OPT` environment variables so that modules are resolved from and installed into the local directory.

## Remarks

Sets the following environment variables:
-
-
-
-
These ensure modules are resolved from and installed into the local directory
without requiring system-level permissions.
If the active package manager is `cpan` (the default), it is automatically
switched to `cpanm` since `cpan` does not support the `--local-lib` flag.
While it is possible to use `cpan` with Local::Lib it is complicated to model in Aspire.

## Definition

```go
func (PerlAppResource) WithLocalLib(options ...*WithLocalLibOptions) PerlAppResource
```

## Parameters

- `options` (`...*WithLocalLibOptions`) -- optional settings, see [Options](#options)

## Options

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

- `Path` (`*string`) -- The path to the local::lib directory. Relative paths are resolved against the resource's working directory (`appDirectory`), not the AppHost project. Rooted paths (e.g., `/opt/perl-libs` or `C:\perl-libs`) are used as-is. Defaults to `"local"` (the Carton convention).

## 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)
