# PerlAppResource.WithLocalLib

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

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
type PerlAppResource interface {
    // ... omitted for brevity
    WithLocalLib(options ...*WithLocalLibOptions) PerlAppResource
}
```

## Signature

```go
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()`.

## Defined on

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