perl

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2026 License: Artistic-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidBinaryVersion      = "501" // Invalid version format for binary download
	ErrBinaryDownloadFailed      = "502" // Failed to download binary archive
	ErrBinaryChecksumFailed      = "503" // Binary checksum validation failed
	ErrBinaryCacheFailed         = "504" // Failed to cache downloaded binary
	ErrBinaryNotAvailable        = "505" // Binary not available for platform
	ErrBinaryPlatformUnsupported = "506" // Platform not supported for binaries
)

Binary download error codes

View Source
const (
	DefaultBinaryRepo         = "https://github.com/perigrin/pvm/releases/download"
	BinaryMaxRetries          = 3
	BinaryRetryDelay          = 2 * time.Second
	DefaultChunkSize          = 8 * 1024 * 1024  // 8MB chunks for parallel downloads
	ParallelDownloadThreshold = 50 * 1024 * 1024 // 50MB minimum for parallel downloads
	DefaultMaxBandwidth       = 0                // 0 means unlimited
	ProgressReportInterval    = 100 * time.Millisecond
	ChecksumBufferSize        = 64 * 1024 // 64KB buffer for streaming checksum
)

Binary download constants

View Source
const (
	ErrCacheInitFailed   = "601" // Failed to initialize cache
	ErrCacheOperFailed   = "602" // Cache operation failed
	ErrCacheCorrupted    = "603" // Cache is corrupted
	ErrCacheEntryInvalid = "604" // Cache entry is invalid
)

Cache error codes

View Source
const (
	DefaultCacheMaxAge  = 30 * 24 * time.Hour    // 30 days
	DefaultCacheMaxSize = 5 * 1024 * 1024 * 1024 // 5GB
	MetadataFileName    = "metadata.json"
)

Default cache configuration

View Source
const (
	ErrExtractionFailed    = "501" // Failed to extract source archive
	ErrBuildDirFailed      = "502" // Failed to create build directory
	ErrConfigureFailed     = "503" // Configure script failed
	ErrCompilationFailed   = "504" // Compilation failed
	ErrTestFailed          = "505" // Tests failed
	ErrInstallFailed       = "506" // Installation failed
	ErrCleanupFailed       = "507" // Cleanup failed
	ErrInvalidBuildOptions = "508" // Invalid build options
	ErrBuildCancelled      = "509" // Build process was cancelled
)

Build error codes

View Source
const (
	ErrInvalidDownloadVersion = "401" // Invalid version format for download
	ErrDownloadFailed         = "402" // Failed to download source archive
	ErrChecksumMismatch       = "403" // Checksum validation failed
	ErrCacheFailed            = "404" // Failed to cache downloaded file
	ErrInvalidMirror          = "405" // Invalid or unreachable mirror
	ErrInvalidDestination     = "406" // Invalid destination path
)

Download error codes

View Source
const (
	DefaultMirror = "https://www.cpan.org/src/5.0"
	MaxRetries    = 3
	RetryDelay    = 3 * time.Second
)

Default mirrors and other constants

View Source
const (
	ErrInvalidForkIdentifier = "201" // Invalid fork identifier format
	ErrReservedRemoteName    = "202" // Reserved remote name (e.g., "origin")
	ErrReservedForkName      = "203" // Reserved fork name (e.g., "perl")
)

Fork error codes

View Source
const (
	ErrBinaryInstallFailed    = "701" // Binary installation failed
	ErrBinaryExtractFailed    = "702" // Binary extraction failed
	ErrBinaryVerifyFailed     = "703" // Binary verification failed
	ErrBinaryPermissionFailed = "704" // Failed to set permissions
)

Binary installation error codes

View Source
const (
	ErrLegacyToolNotFound    = "201" // Legacy tool installation not found
	ErrLegacyVersionNotFound = "202" // Specific version not found in legacy tool
	ErrLegacyImportFailed    = "203" // Failed to import from legacy tool
)

Legacy tool error codes

View Source
const (
	MethodBinary  = "binary"
	MethodSource  = "source"
	MethodUnknown = "unknown"
)

Installation method constants

View Source
const (
	ErrMetricsStorageFailed   = "901" // Failed to store metrics data
	ErrMetricsRetrievalFailed = "902" // Failed to retrieve metrics data
	ErrMetricsCorrupted       = "903" // Metrics data is corrupted
	ErrMetricsCleanupFailed   = "904" // Failed to cleanup old metrics
)

Metrics error codes

View Source
const (
	DefaultMetricsRetentionDays = 30
	MetricsFilePrefix           = "metrics-"
	MetricsFileSuffix           = ".json"
	MaxMetricsFileSize          = 1024 * 1024 // 1MB per metrics file
)

Metrics configuration constants

View Source
const (
	ErrMirrorConfigInvalid   = "601" // Invalid mirror configuration
	ErrAllMirrorsFailed      = "602" // All mirrors failed to respond
	ErrMirrorHealthCheckFail = "603" // Mirror health check failed
	ErrMirrorNotAvailable    = "604" // Mirror temporarily unavailable
)

Mirror configuration error codes

View Source
const (
	MirrorTypeGitHubReleases = "github-releases"
	MirrorTypeJSDelivr       = "jsdelivr"
	MirrorTypeCloudflareR2   = "cloudflare-r2"
	MirrorTypeDirectURL      = "direct"
)

Mirror types

View Source
const (
	ErrPlenvNotAvailable  = "401" // plenv command not available
	ErrPlenvCommandFailed = "402" // plenv command execution failed
	ErrPlenvNoVersions    = "403" // no plenv versions available
)

plenv integration error codes

View Source
const (
	ErrRegistryIOFailed   = "601" // Failed to read/write registry file
	ErrVersionNotFound    = "602" // Requested version not found in registry
	ErrVersionExists      = "603" // Version already exists in registry
	ErrInvalidRegistry    = "604" // Invalid registry data format
	ErrUninstallFailed    = "605" // Failed to uninstall version
	ErrVersionInvalid     = "606" // Invalid version name
	ErrRegistryLockFailed = "607" // Failed to acquire registry lock
)

Registry error codes

View Source
const (
	ErrInvalidRemote  = "204" // Invalid remote configuration
	ErrRemoteExists   = "205" // Remote already exists
	ErrRemoteNotFound = "206" // Remote not found
	ErrReservedRemote = "207" // Reserved remote name
)

Remote error codes

View Source
const (
	ErrResolutionFailed    = "301" // Failed to resolve Perl version
	ErrUnsatisfiedVersion  = "302" // No available version satisfies constraints
	ErrNoVersionsAvailable = "303" // No Perl versions available
)

Version resolution error codes

View Source
const (
	ErrShellDetectionFailed   = "501" // Failed to detect user shell
	ErrShellInitFailed        = "502" // Failed to create shell initialization scripts
	ErrVersionSwitchFailed    = "503" // Failed to switch Perl version
	ErrPerlVersionFileFailed  = "504" // Failed to create .perl-version file
	ErrGlobalVersionSetFailed = "505" // Failed to set global Perl version
	ErrLocalVersionSetFailed  = "506" // Failed to set local Perl version
	ErrUseVersionFailed       = "507" // Failed to use specified Perl version
	ErrShellScriptFailed      = "508" // Failed to generate shell script
)

Shell-related error codes

View Source
const (
	ErrShimCreationFailed   = "401" // Failed to create shim
	ErrShimTemplateFailed   = "402" // Failed to process shim template
	ErrShimExecutableFailed = "403" // Failed to make shim executable
	ErrShimDirectoryFailed  = "404" // Failed to create shim directory
	ErrShimGenerationFailed = "405" // Failed to generate shims
)

Shim-related error codes

View Source
const (
	ErrNoSystemPerl                 = "001" // No system Perl found
	ErrVersionParseFail             = "002" // Failed to parse Perl version
	ErrPerlExecFail                 = "003" // Failed to execute Perl
	ErrSystemPerlRegistrationFailed = "004" // Failed to register system Perl
)

System Perl detection error codes

View Source
const (
	ErrInstallationFailed  = "004" // Perl installation failed
	ErrUnsupportedPlatform = "005" // Platform not supported for installation
	ErrInstallationTimeout = "006" // Installation timeout
	ErrDependencyMissing   = "007" // Required dependency missing
)

System Perl installation error codes

View Source
const (
	ErrBinaryValidationFailed  = "801" // Binary validation failed
	ErrBinaryExecutionFailed   = "802" // Binary execution test failed
	ErrBinaryVersionMismatch   = "803" // Binary version doesn't match expected
	ErrBinaryIncompleteInstall = "804" // Binary installation is incomplete
)

Binary validation error codes

View Source
const (
	ErrInvalidVersion      = "101" // Invalid version string format
	ErrInvalidConstraint   = "102" // Invalid constraint string format
	ErrUnsatisfiable       = "103" // Unsatisfiable constraint
	ErrInvalidVersionAlias = "104" // Invalid version alias
)

Version error codes

View Source
const (
	ErrInvalidManifest = "208" // Invalid or incomplete fork manifest
)

Fork manifest error codes

Variables

View Source
var (
	DefaultMirrors = []MirrorConfig{
		{
			Name:        "GitHub Releases (Primary)",
			Type:        MirrorTypeGitHubReleases,
			BaseURL:     "https://github.com/example/pvm/releases/download",
			Priority:    1,
			Enabled:     true,
			Timeout:     30 * time.Second,
			MaxRetries:  3,
			HealthCheck: "/perl-5.38.0/perl-5.38.0-linux-amd64.tar.gz",
		},
		{
			Name:        "jsDelivr CDN",
			Type:        MirrorTypeJSDelivr,
			BaseURL:     "https://cdn.jsdelivr.net/gh/example/pvm@releases",
			Priority:    2,
			Enabled:     true,
			Timeout:     15 * time.Second,
			MaxRetries:  2,
			HealthCheck: "/perl-5.38.0/perl-5.38.0-linux-amd64.tar.gz",
		},
		{
			Name:        "Cloudflare R2 CDN",
			Type:        MirrorTypeCloudflareR2,
			BaseURL:     "https://pvm-binaries.example.com",
			Priority:    3,
			Enabled:     false,
			Timeout:     20 * time.Second,
			MaxRetries:  2,
			HealthCheck: "/perl-5.38.0/perl-5.38.0-linux-amd64.tar.gz",
		},
	}
)

Default mirror configurations

View Source
var DetectSystemPerl = detectSystemPerlFunc

DetectSystemPerl is a variable that points to detectSystemPerlFunc, allowing it to be replaced in tests

View Source
var DownloadPerlBinaryFunc = doDownloadPerlBinary

DownloadPerlBinaryFunc holds the current implementation of DownloadPerlBinary It can be replaced with a mock for testing

View Source
var DownloadPerlSourceFunc = doDownloadPerlSource

DownloadPerlSourceFunc holds the current implementation of DownloadPerlSource It can be replaced with a mock for testing

View Source
var EnableEnhancedBuild = false

EnableEnhancedBuild enables the enhanced build system globally

View Source
var FindByDisplayName = findByDisplayNameFunc

FindByDisplayName is a variable that points to findByDisplayNameFunc, allowing it to be replaced in tests

View Source
var FindDotPerlVersionFiles = findDotPerlVersionFilesFunc

FindDotPerlVersionFiles is a variable that points to findDotPerlVersionFilesFunc, allowing it to be replaced in tests

View Source
var GenerateShimsFunc = GenerateShims

GenerateShimsFunc is a variable pointing to GenerateShims for easier mocking in tests

View Source
var GetInstalledVersions = getInstalledVersionsFunc

GetInstalledVersions is a variable that points to getInstalledVersionsFunc, allowing it to be replaced in tests

View Source
var GetVersionInfo = getVersionInfoFunc

GetVersionInfo is a variable that points to getVersionInfoFunc, allowing it to be replaced in tests

View Source
var IsVersionAvailable = isVersionAvailableFunc

IsVersionAvailable is a variable that points to isVersionAvailableFunc, allowing it to be replaced in tests

View Source
var IsVersionInstalled = isVersionInstalledFunc

IsVersionInstalled is a variable that points to isVersionInstalledFunc, allowing it to be replaced in tests

View Source
var LoadRegistry = loadRegistryFunc

LoadRegistry is a variable that points to loadRegistryFunc, allowing it to be replaced in tests

View Source
var OnVersionResolved func(version *ResolvedVersion)

OnVersionResolved is a callback that will be called when a version is resolved This can be used for logging or other purposes

View Source
var ParseVersion = parseVersionFunc

ParseVersion is a variable that points to parseVersionFunc, allowing it to be replaced in tests

View Source
var ReadPerlVersionFile = readPerlVersionFileFunc

ReadPerlVersionFile is a variable that points to readPerlVersionFileFunc, allowing it to be replaced in tests

View Source
var SaveRegistry = saveRegistryFunc

SaveRegistry is a variable that points to saveRegistryFunc, allowing it to be replaced in tests

View Source
var UninstallVersion = uninstallVersionFunc

UninstallVersion is a variable that points to uninstallVersionFunc, allowing it to be replaced in tests

View Source
var UninstallVersionByDisplayName = uninstallVersionByDisplayNameFunc

UninstallVersionByDisplayName is a variable that points to uninstallVersionByDisplayNameFunc, allowing it to be replaced in tests

View Source
var ValidateLibraryEnvironment = validateLibraryEnvironmentImpl

ValidateLibraryEnvironment is a variable pointing to validateLibraryEnvironmentImpl for easier mocking in tests

View Source
var ValidateVersion = validateVersionImpl

ValidateVersion is a variable pointing to validateVersionImpl for easier mocking in tests

Functions

func ApplyPatchPerlSafely

func ApplyPatchPerlSafely(sourceDir, perlVersion string, verbose bool) error

ApplyPatchPerlSafely is a convenience function that applies PatchPerl with error recovery

func AutoImportSystemPerl

func AutoImportSystemPerl() error

AutoImportSystemPerl automatically imports system Perl into the registry This is used during first-run scenarios when no Perl versions are available

func CheckBinaryAvailability

func CheckBinaryAvailability(version, platform string) (bool, error)

CheckBinaryAvailability checks if a binary is available for the specified version and platform

func CheckBinaryAvailabilityWithMirrors

func CheckBinaryAvailabilityWithMirrors(mirrors []string, version, platform string) (bool, error)

CheckBinaryAvailabilityWithMirrors checks binary availability using configured mirrors with failover

func CheckBinaryAvailabilityWithRepo

func CheckBinaryAvailabilityWithRepo(repoURL, version, platformTriple string) (bool, error)

CheckBinaryAvailabilityWithRepo checks binary availability with custom repo

func CheckBuildRequirements

func CheckBuildRequirements(version string) error

CheckBuildRequirements performs pre-build checks

func CheckGitAvailable

func CheckGitAvailable() error

CheckGitAvailable returns nil if git is present in PATH, or a descriptive error otherwise.

func CheckPath

func CheckPath() (bool, string, error)

Provides a way to check if the PATH is properly set up to use PVM shims

func CheckShellInit

func CheckShellInit(shellType ShellType) (bool, string, error)

CheckShellInit checks if the shell is properly initialized with PVM

func CompareBuilds

func CompareBuilds(standard, enhanced *BuildResult) map[string]interface{}

CompareBuilds compares two build results for debugging

func CreateShellInitScripts

func CreateShellInitScripts() error

CreateShellInitScripts generates shell initialization scripts for all supported shells

func DeduplicateRegistry

func DeduplicateRegistry() (int, error)

DeduplicateRegistry loads the registry, removes duplicate entries, and saves it if any were removed. Returns the number of duplicates removed. Used by `pvm self doctor` to clean up registries that accumulated duplicates before RegisterVersion became idempotent (#471).

func FindBestMatch

func FindBestMatch(constraint string, availableVersions []string) (string, error)

FindBestMatch finds the best version that satisfies the constraints Returns the highest matching version from the available versions

func FindStrawberryRelease

func FindStrawberryRelease(perlVersion string) (string, error)

FindStrawberryRelease queries the GitHub releases API for the StrawberryPerl repository and returns the download URL of the 64-bit portable zip for the given 3-part Perl version (e.g. "5.38.2").

func GenerateBinaryURL

func GenerateBinaryURL(version, platform string) (string, error)

GenerateBinaryURL generates the URL for a Perl binary archive

func GenerateBinaryURLWithRepo

func GenerateBinaryURLWithRepo(repoURL, version, platformTriple string) (string, error)

GenerateBinaryURLWithRepo generates the URL for a Perl binary archive with custom repo

func GenerateShellScript

func GenerateShellScript(shellType ShellType, data ShellScriptData) (string, error)

GenerateShellScript creates initialization script for a specific shell

func GenerateShellUse

func GenerateShellUse(version string, library string) error

GenerateShellUse outputs shell commands to set up the environment for a specific Perl version and optional library. When version is "system", PVM_PERL_VERSION (and PVM_PERL_LIBRARY when no library is given) are unset so the resolver falls back to the system Perl.

The output is eval'd by the shell integration templates. Callers are responsible for refreshing PATH afterward (the templates call _pvm_update_perl_path) — this function does not touch PATH.

func GenerateShims

func GenerateShims() error

GenerateShims creates shims for all standard Perl commands This includes perl itself and standard utilities like cpan, prove, etc.

func GenerateSourceURL

func GenerateSourceURL(mirror, version string) (string, error)

GenerateSourceURL generates the URL for a Perl source archive

func GetAvailableBinaryPlatforms

func GetAvailableBinaryPlatforms(version string) ([]string, error)

GetAvailableBinaryPlatforms returns a list of available platforms for a given version

func GetAvailableBinaryPlatformsWithRepo

func GetAvailableBinaryPlatformsWithRepo(repoURL, version string) ([]string, error)

GetAvailableBinaryPlatformsWithRepo returns available platforms with custom repo

func GetAvailableVersions

func GetAvailableVersions() ([]string, error)

GetAvailableVersions returns a list of all available versions This includes installed versions and potentially downloadable versions

func GetCurrentPerlPath

func GetCurrentPerlPath() (string, error)

GetCurrentPerlPath returns the path to the current Perl executable

func GetCurrentShellScript

func GetCurrentShellScript(shellType ShellType) (string, error)

GetCurrentShellScript generates shell script to be evaluated for the command: eval "$(pvm shell)"

func GetPatchPerlInfo

func GetPatchPerlInfo() (string, error)

GetPatchPerlInfo returns information about the available PatchPerl installation

func GetPathConfigCommand

func GetPathConfigCommand() (string, error)

GetPathConfigCommand returns a shell command to add the shim directory to PATH

func GetPerlbrewAliases

func GetPerlbrewAliases() (map[string]string, error)

GetPerlbrewAliases returns a map of perlbrew aliases

func GetPlatformSpecificNotes

func GetPlatformSpecificNotes() string

GetPlatformSpecificNotes returns platform-specific build notes

func GetShellCompletionCommand

func GetShellCompletionCommand(shellType ShellType) (string, error)

GetShellCompletionCommand returns a command to enable shell completion for PVM

func GetShellInitCommand

func GetShellInitCommand(shellType ShellType) (string, error)

GetShellInitCommand returns a command to initialize PVM in the current shell

func GetShellInitInstructions

func GetShellInitInstructions(shellType ShellType) string

GetShellInitInstructions returns instructions for initializing PVM in the given shell

func GetShimCommand

func GetShimCommand(shimName string, args []string) (*exec.Cmd, error)

GetShimCommand returns the actual command that should be executed This is used by the shim itself to execute the correct Perl version

func GetSystemPerlVersion

func GetSystemPerlVersion(perlPath string) (string, error)

GetSystemPerlVersion executes a Perl command and returns its version

func GetSystemVersionString

func GetSystemVersionString() (string, error)

GetSystemVersionString returns the version of the system Perl as a string

func ImportSystemPerl

func ImportSystemPerl() error

ImportSystemPerl imports the system Perl into the registry

func InstallPatchPerl

func InstallPatchPerl(verbose bool) error

InstallPatchPerl installs Devel::PatchPerl using the configured module installer

func IsPatchPerlAvailable

func IsPatchPerlAvailable() bool

IsPatchPerlAvailable checks if Devel::PatchPerl is available via system perl

func IsShimDirectory

func IsShimDirectory(dir string) (bool, error)

IsShimDirectory checks if a given directory is the PVM shim directory

func PrintAutoImportResults

func PrintAutoImportResults(results *AutoImportResults)

PrintAutoImportResults prints the results of auto-import to stderr This ensures the output doesn't interfere with shell eval

func RebuildRegistry

func RebuildRegistry() error

RebuildRegistry scans the versions directory and rebuilds the registry from existing installations

func RegisterVersion

func RegisterVersion(versionInfo VersionInfo) error

RegisterVersion adds a new Perl version to the registry

func RegisterVersionAfterBuild

func RegisterVersionAfterBuild(buildResult *BuildResult, source string) error

RegisterVersionAfterBuild registers a version after successful build

func Rehash

func Rehash() error

Rehash rebuilds all shim executables This should be called after installing or uninstalling Perl versions

func RemoveAllShims

func RemoveAllShims() error

RemoveAllShims removes all shim files from the shim directory

func ResolveLatestDevVersion

func ResolveLatestDevVersion() (string, error)

ResolveLatestDevVersion returns the latest development Perl version

func ResolveLatestStableVersion

func ResolveLatestStableVersion() (string, error)

ResolveLatestStableVersion returns the latest stable Perl version Fetches from MetaCPAN API dynamically

func ResolveLatestVersion

func ResolveLatestVersion() (string, error)

ResolveLatestVersion returns the latest Perl version (stable or dev)

func ResolveVersionAlias

func ResolveVersionAlias(alias string, aliases map[string]string) (string, error)

ResolveVersionAlias resolves a version alias to an actual version Uses the provided map of aliases (from configuration) Accepts aliases with or without the "@" prefix (e.g. "latest" or "@latest")

func SetGlobalVersion

func SetGlobalVersion(version string) error

SetGlobalVersion sets the global default Perl version

func SetLocalVersion

func SetLocalVersion(version string) error

SetLocalVersion sets the local Perl version for a project

func SetModuleInstaller

func SetModuleInstaller(installer ModuleInstaller)

SetModuleInstaller allows other packages to provide module installation functionality

func ShouldAutoImport

func ShouldAutoImport() bool

ShouldAutoImport checks if auto-import should be performed Returns true if this is the first time pvm init is being run

func ShouldUsePatchPerl

func ShouldUsePatchPerl(perlVersion string) bool

ShouldUsePatchPerl determines if PatchPerl should be used for a given Perl version

func SwitchVersion

func SwitchVersion(version string, scope string) error

SwitchVersion sets the Perl version for the given scope

func UnsetGlobalVersion

func UnsetGlobalVersion() error

UnsetGlobalVersion sets the global version to "system" to fall back to system Perl

func UnsetLocalVersion

func UnsetLocalVersion() error

UnsetLocalVersion removes the local Perl version for the current directory

func UseVersion

func UseVersion(version string) error

UseVersion sets the Perl version for the current shell session

func ValidateBinaryInstallation

func ValidateBinaryInstallation(installPath string) (bool, []string, error)

ValidateBinaryInstallation validates a binary Perl installation

func ValidateDirectoryStructure

func ValidateDirectoryStructure(installPath string) (float64, []string)

ValidateDirectoryStructure checks if the installation has the expected directory structure

func ValidateExpectedVersion

func ValidateExpectedVersion(installPath, expectedVersion string) error

ValidateExpectedVersion checks if the installed version matches the expected version

func ValidatePatchPerlEnvironment

func ValidatePatchPerlEnvironment() error

ValidatePatchPerlEnvironment checks if the environment is suitable for PatchPerl

func VerifyMirror

func VerifyMirror(mirror string) error

VerifyMirror checks if a mirror is accessible

Types

type ArchiveExtractor

type ArchiveExtractor struct {
	// contains filtered or unexported fields
}

ArchiveExtractor handles archive extraction with progress

func NewArchiveExtractor

func NewArchiveExtractor(logger *log.Logger) *ArchiveExtractor

NewArchiveExtractor creates a new archive extractor

func (*ArchiveExtractor) ExtractWithProgress

func (ae *ArchiveExtractor) ExtractWithProgress(
	archivePath string,
	destDir string,
	ctx context.Context,
	progressCb func(current, total int64),
) (string, error)

ExtractWithProgress extracts an archive with progress reporting

type AutoImportResults

type AutoImportResults struct {
	// Plenv imports
	PlenvImports []ImportResult

	// Perlbrew imports
	PerlbrewImports []ImportResult

	// Total number of versions imported
	TotalImported int

	// Default version that was set (if any)
	DefaultVersion string
}

AutoImportResults represents the results of automatic import during init

func AutoImportLegacyVersions

func AutoImportLegacyVersions() (*AutoImportResults, error)

AutoImportLegacyVersions automatically detects and imports legacy tool installations This is designed to be called during `pvm init` to provide seamless migration

type BinaryBenchmarkResults

type BinaryBenchmarkResults struct {
	// Time to start Perl and print version
	StartupTime time.Duration

	// Time to execute a simple script
	SimpleScriptTime time.Duration

	// Time to load a common module
	ModuleLoadTime time.Duration
}

BinaryBenchmarkResults contains performance benchmark data

type BinaryCache

type BinaryCache struct {
	// contains filtered or unexported fields
}

BinaryCache manages local caching of Perl binaries

func NewBinaryCache

func NewBinaryCache() (*BinaryCache, error)

NewBinaryCache creates a new binary cache instance

func (*BinaryCache) Clean

func (bc *BinaryCache) Clean(maxAge time.Duration, maxSize int64) (int, int, error)

Clean performs both age-based and size-based cleanup

func (*BinaryCache) CleanByAge

func (bc *BinaryCache) CleanByAge(maxAge time.Duration) (int, error)

CleanByAge removes cache entries older than the specified duration

func (*BinaryCache) CleanBySize

func (bc *BinaryCache) CleanBySize(maxSize int64) (int, error)

CleanBySize removes oldest entries to keep total cache size under the limit

func (*BinaryCache) Get

func (bc *BinaryCache) Get(version, platform string) (*BinaryCacheResult, error)

Get retrieves a binary from the cache if it exists

func (*BinaryCache) List

func (bc *BinaryCache) List() ([]*BinaryCacheEntry, error)

List returns all cached binary entries

func (*BinaryCache) Put

func (bc *BinaryCache) Put(sourcePath string, entry *BinaryCacheEntry) (string, error)

Put stores a binary in the cache

func (*BinaryCache) Validate

func (bc *BinaryCache) Validate(binaryPath, expectedChecksum string) (bool, error)

Validate checks if a cached binary file matches its expected checksum

type BinaryCacheEntry

type BinaryCacheEntry struct {
	// Version of the Perl binary
	Version string `json:"version"`

	// Platform triple (e.g., "linux-amd64")
	Platform string `json:"platform"`

	// SHA-256 checksum of the binary file
	Checksum string `json:"checksum"`

	// Size of the binary file in bytes
	Size int64 `json:"size"`

	// Original download URL
	DownloadURL string `json:"download_url"`

	// When the binary was cached
	CachedAt time.Time `json:"cached_at"`

	// Last access time (for LRU cleanup)
	LastAccessed time.Time `json:"last_accessed"`
}

BinaryCacheEntry represents metadata for a cached binary

type BinaryCacheResult

type BinaryCacheResult struct {
	// Path to the cached binary file
	Path string

	// Cache entry metadata
	Entry *BinaryCacheEntry
}

BinaryCacheResult represents a cache hit result

type BinaryDownloadOptions

type BinaryDownloadOptions struct {
	// Version to download
	Version string

	// Platform triple (e.g., "linux-amd64", "darwin-arm64")
	Platform string

	// Progress callback function (legacy)
	ProgressCallback ProgressCallback

	// Enhanced progress callback function
	EnhancedProgressCallback EnhancedProgressCallback

	// Maximum number of retries for failed downloads
	MaxRetries int

	// Skip checksum validation
	SkipChecksum bool

	// Skip using cache
	SkipCache bool

	// Context for cancellation
	Context context.Context

	// Custom repository URL (defaults to GitHub Releases)
	RepoURL string

	// Enable resumable downloads
	EnableResume bool

	// Enable parallel chunk downloads for large files
	EnableParallel bool

	// Chunk size for parallel downloads (bytes)
	ChunkSize int64

	// Maximum download bandwidth (bytes per second, 0 = unlimited)
	MaxBandwidth int64

	// Verify checksum during transfer (streaming validation)
	StreamingChecksum bool

	// DirectURL overrides URL generation and downloads from this exact URL.
	// When set, RepoURL and Platform are not used for URL construction.
	DirectURL string
}

BinaryDownloadOptions contains options for downloading Perl binaries

type BinaryDownloadResult

type BinaryDownloadResult struct {
	// Path to the downloaded binary archive
	Path string

	// Version of the downloaded Perl binary
	Version string

	// Platform triple
	Platform string

	// Size of the downloaded file in bytes
	Size int64

	// Checksum of the downloaded file
	Checksum string

	// Whether the file was loaded from cache
	FromCache bool

	// Time taken to download
	Duration time.Duration

	// Whether download was resumed
	Resumed bool

	// Number of bytes already downloaded when resuming
	ResumedBytes int64

	// Whether parallel downloading was used
	ParallelDownload bool

	// Number of chunks used for parallel download
	ChunkCount int

	// Average download speed in bytes per second
	AverageSpeed int64

	// Whether streaming checksum validation was used
	StreamingChecksumUsed bool
}

BinaryDownloadResult contains information about the downloaded binary

func DownloadPerlBinary

func DownloadPerlBinary(options *BinaryDownloadOptions) (*BinaryDownloadResult, error)

DownloadPerlBinary downloads a Perl binary archive for the specified version and platform

type BinaryInstallOptions

type BinaryInstallOptions struct {
	// Version to install
	Version string

	// Platform triple (e.g., "linux-amd64", "darwin-arm64")
	Platform string

	// Installation directory (if empty, uses default)
	InstallDir string

	// Progress callback function
	ProgressCallback ProgressCallback

	// Context for cancellation
	Context context.Context

	// Skip checksum validation
	SkipChecksum bool

	// Custom repository URL
	RepoURL string

	// Metrics collector for tracking installation performance (optional)
	MetricsCollector *MetricsCollector

	// StrawberryURL is the download URL for Strawberry Perl portable zip.
	// When set, download from this URL instead of the PVM binary mirror.
	// Only used on Windows.
	StrawberryURL string
}

BinaryInstallOptions contains options for binary installation

type BinaryInstallResult

type BinaryInstallResult struct {
	// Version that was installed
	Version string

	// Platform that was installed
	Platform string

	// Installation path
	InstallPath string

	// Size of the installed files in bytes
	Size int64

	// Time taken to install
	Duration time.Duration

	// Whether installation was from cache
	FromCache bool
}

BinaryInstallResult contains information about the binary installation

func InstallFromBinary

func InstallFromBinary(options *BinaryInstallOptions) (*BinaryInstallResult, error)

InstallFromBinary installs Perl from a pre-compiled binary

type BinaryValidationResult

type BinaryValidationResult struct {
	// Whether the installation is valid
	Valid bool

	// List of validation warnings (non-fatal issues)
	Warnings []string

	// Detected Perl version
	DetectedVersion string

	// Path to the Perl executable
	PerlExecutable string

	// Installation completeness score (0.0 to 1.0)
	CompletenessScore float64

	// Performance benchmark results (if requested)
	BenchmarkResults *BinaryBenchmarkResults
}

BinaryValidationResult contains the results of binary installation validation

func ValidateBinaryInstallationDetailed

func ValidateBinaryInstallationDetailed(installPath string, includeBenchmarks bool) (*BinaryValidationResult, error)

ValidateBinaryInstallationDetailed performs comprehensive validation of a binary installation

type BuildArtifactCache

type BuildArtifactCache struct {
	// contains filtered or unexported fields
}

BuildArtifactCache manages compiled object files for incremental builds

func NewBuildArtifactCache

func NewBuildArtifactCache(baseDir string) (*BuildArtifactCache, error)

NewBuildArtifactCache creates a new artifact cache

func (*BuildArtifactCache) GetArtifact

func (bac *BuildArtifactCache) GetArtifact(relPath string) ([]byte, error)

GetArtifact retrieves a build artifact

func (*BuildArtifactCache) HasArtifact

func (bac *BuildArtifactCache) HasArtifact(relPath string) bool

HasArtifact checks if an artifact exists

func (*BuildArtifactCache) SaveArtifact

func (bac *BuildArtifactCache) SaveArtifact(relPath string, data []byte) error

SaveArtifact saves a build artifact

type BuildCache

type BuildCache struct {
	// contains filtered or unexported fields
}

BuildCache manages cached build information

func NewBuildCache

func NewBuildCache() (*BuildCache, error)

NewBuildCache creates a new build cache

func (*BuildCache) CleanOldEntries

func (bc *BuildCache) CleanOldEntries(maxAge time.Duration) error

CleanOldEntries removes cache entries older than specified duration

func (*BuildCache) GetCachedBuild

func (bc *BuildCache) GetCachedBuild(version string, options *BuildOptions) (*BuildResult, bool)

GetCachedBuild retrieves a cached build if available

func (*BuildCache) GetConfigCache

func (bc *BuildCache) GetConfigCache(version string) (map[string]string, bool)

GetConfigCache retrieves cached configure results

func (*BuildCache) SaveBuild

func (bc *BuildCache) SaveBuild(version string, options *BuildOptions, result *BuildResult, configCache map[string]string) error

SaveBuild saves a build to the cache

type BuildContext

type BuildContext struct {
	Options        *BuildOptions
	StartTime      time.Time
	SourceFile     string
	BuildDir       string
	SourceDir      string
	InstallDir     string
	SystemDeps     *DependencyInfo
	ConfigCache    map[string]string
	BuildArtifacts []string
	Logger         *log.Logger
}

BuildContext holds the context for a build operation

func (*BuildContext) Cleanup

func (ctx *BuildContext) Cleanup()

Cleanup cleans up the build context

func (*BuildContext) ToBuildResult

func (ctx *BuildContext) ToBuildResult() *BuildResult

ToBuildResult converts context to build result

type BuildManager

type BuildManager struct {
	// contains filtered or unexported fields
}

BuildManager manages the enhanced build process

func NewBuildManager

func NewBuildManager(logger *log.Logger) (*BuildManager, error)

NewBuildManager creates a new enhanced build manager

func (*BuildManager) BuildEnhanced

func (bm *BuildManager) BuildEnhanced(options *BuildOptions) (*BuildResult, error)

BuildEnhanced performs an enhanced build with all improvements

type BuildOptions

type BuildOptions struct {
	// Version to build (used to identify source archive)
	Version string

	// SourceFile is the path to the source archive
	// If empty, the archive will be located or downloaded
	SourceFile string

	// InstallDir is the directory where Perl will be installed
	// If empty, a default location will be used
	InstallDir string

	// BuildJobs is the number of parallel jobs to use during compilation
	// If 0, a default value based on CPU count will be used
	BuildJobs int

	// RunTests indicates whether to run the test suite
	RunTests bool

	// BuildDir is the directory for temporary build files
	// If empty, a default location will be used
	BuildDir string

	// ConfigureOptions contains additional options to pass to the Configure script
	ConfigureOptions []string

	// CleanupBuildDir indicates whether to clean up the build directory after installation
	CleanupBuildDir bool

	// BuildOnly indicates whether to build without installing (creates relocatable build)
	BuildOnly bool

	// ReleaseBuild indicates this is a release/--upload build where any
	// failure to make binaries relocatable is fatal. Local builds where
	// build prefix equals install prefix work fine with the baked-in
	// RPATH; release tarballs ship to other machines and must not.
	ReleaseBuild bool

	// ProgressCallback is called to report progress
	ProgressCallback BuildProgressCallback `json:"-"`

	// Context for cancellation
	Context context.Context `json:"-"`

	// TestTimeout is the timeout for running tests
	TestTimeout time.Duration

	// AllowTestFailures allows build to continue even if tests fail
	AllowTestFailures bool

	// ForceRebuild forces a rebuild even if cached
	ForceRebuild bool

	// MaxRetries is the maximum number of retries for build steps
	MaxRetries int

	// SkipChecksum indicates whether to skip checksum validation during download
	SkipChecksum bool

	// Mirror is the mirror URL to use for downloading (optional)
	Mirror string

	// SkipCache indicates whether to skip using cached downloads
	SkipCache bool

	// Verbose enables verbose output
	Verbose bool

	// NoPatchPerl disables automatic Devel::PatchPerl patching
	NoPatchPerl bool

	// SourceDir is a local directory containing perl source (from git clone); skips download when set
	SourceDir string
}

BuildOptions contains options for building Perl

func MigrateToEnhancedBuild

func MigrateToEnhancedBuild(options *BuildOptions) *BuildOptions

MigrateToEnhancedBuild migrates existing build configurations to enhanced format

func OptimizeBuildOptions

func OptimizeBuildOptions(options *BuildOptions) *BuildOptions

OptimizeBuildOptions optimizes build options based on system capabilities

type BuildProgressCalculator

type BuildProgressCalculator struct {
	// contains filtered or unexported fields
}

BuildProgressCalculator handles progress calculation across build stages

func NewBuildProgressCalculator

func NewBuildProgressCalculator() *BuildProgressCalculator

NewBuildProgressCalculator creates a new progress calculator

func (*BuildProgressCalculator) GetOverallProgress

func (calc *BuildProgressCalculator) GetOverallProgress() float64

GetOverallProgress calculates the overall progress across all stages

func (*BuildProgressCalculator) ParseMakeProgress

func (calc *BuildProgressCalculator) ParseMakeProgress(line string) bool

ParseMakeProgress attempts to parse progress from make output

func (*BuildProgressCalculator) SetStage

func (calc *BuildProgressCalculator) SetStage(stage BuildProgressStage)

SetStage sets the current stage and resets stage progress

func (*BuildProgressCalculator) UpdateLineBasedProgress

func (calc *BuildProgressCalculator) UpdateLineBasedProgress()

UpdateLineBasedProgress updates progress based on line count

func (*BuildProgressCalculator) UpdateStageProgress

func (calc *BuildProgressCalculator) UpdateStageProgress(progress float64)

UpdateStageProgress updates progress within the current stage

func (*BuildProgressCalculator) UpdateTimeBasedProgress

func (calc *BuildProgressCalculator) UpdateTimeBasedProgress()

UpdateTimeBasedProgress updates progress based on elapsed time

type BuildProgressCallback

type BuildProgressCallback func(stage BuildProgressStage, details string, progress float64)

BuildProgressCallback is called to report progress during the build process

type BuildProgressStage

type BuildProgressStage int

BuildProgressStage represents a stage in the build process

const (
	// Build stages
	StageExtract BuildProgressStage = iota
	StageConfigure
	StageCompile
	StageTest
	StageInstall
	StageCleanup
	StageDone
)
const (
	StageDownload BuildProgressStage = iota - 1 // Before extract
)

Additional build stages

func (BuildProgressStage) String

func (s BuildProgressStage) String() string

String returns a string representation of the build stage

type BuildReport

type BuildReport struct {
	Result          *BuildResult
	SystemInfo      SystemInfo
	Dependencies    *DependencyInfo
	ConfigureOutput string
	TestResults     TestSummary
	Warnings        []string
	Errors          []error
}

BuildReport generates a detailed build report

func GenerateBuildReport

func GenerateBuildReport(ctx *BuildContext, result *BuildResult) *BuildReport

GenerateBuildReport creates a detailed report of the build process

type BuildResult

type BuildResult struct {
	// Version that was built
	Version string

	// InstallPath is the path where Perl was installed
	InstallPath string

	// BuildPath is the path where Perl was built
	BuildPath string

	// Duration is the total time taken to build
	Duration time.Duration

	// Stages contains timing information for each stage
	Stages map[BuildProgressStage]time.Duration

	// Timestamp is when the build started
	Timestamp time.Time
}

BuildResult contains information about the build

func BuildPerl

func BuildPerl(options *BuildOptions) (*BuildResult, error)

BuildPerl builds and installs Perl from source

func BuildPerlEnhanced

func BuildPerlEnhanced(options *BuildOptions) (*BuildResult, error)

BuildPerlEnhanced is the main entry point for the enhanced build system It provides a compatible interface with the existing BuildPerl function

func BuildPerlWithFallback

func BuildPerlWithFallback(options *BuildOptions) (*BuildResult, error)

BuildPerlWithFallback attempts enhanced build with fallback to original

type CacheEntry

type CacheEntry struct {
	Version        string            `json:"version"`
	BuildHash      string            `json:"build_hash"`
	ConfigureFlags []string          `json:"configure_flags"`
	SystemInfo     SystemInfo        `json:"system_info"`
	BuildResult    *BuildResult      `json:"build_result"`
	Timestamp      time.Time         `json:"timestamp"`
	ConfigCache    map[string]string `json:"config_cache"`
}

CacheEntry represents a cached build

type ChecksumDatabase

type ChecksumDatabase struct {
	// contains filtered or unexported fields
}

ChecksumDatabase stores known checksums for Perl releases

func NewChecksumDatabase

func NewChecksumDatabase() (*ChecksumDatabase, error)

NewChecksumDatabase creates a new checksum database

func (*ChecksumDatabase) AddChecksum

func (db *ChecksumDatabase) AddChecksum(version, checksum string)

AddChecksum adds a checksum for a version

func (*ChecksumDatabase) GetChecksum

func (db *ChecksumDatabase) GetChecksum(version string) (string, error)

GetChecksum returns the checksum for a version First checks embedded checksums, then falls back to CPAN lookup

func (*ChecksumDatabase) UpdateChecksums

func (db *ChecksumDatabase) UpdateChecksums() error

UpdateChecksums updates the checksum database from CPAN

type CloneCache

type CloneCache struct {
	// contains filtered or unexported fields
}

CloneCache manages cached bare git clones for fork remote repositories. Each remote gets its own bare clone under <cacheDir>/remotes/<remote_name>/.

func NewCloneCache

func NewCloneCache(cacheDir string) *CloneCache

NewCloneCache creates a CloneCache rooted at cacheDir. The caller is responsible for ensuring cacheDir is the PVM cache directory (e.g. $XDG_CACHE_HOME/pvm).

func (*CloneCache) CheckoutTag

func (cc *CloneCache) CheckoutTag(remoteName, tag, destDir string) error

CheckoutTag checks out a specific tag from the cached bare clone into destDir. destDir must already exist (or will be created). The result is a working tree containing the files from that tag's commit.

func (*CloneCache) EnsureClone

func (cc *CloneCache) EnsureClone(remote Remote) (string, error)

EnsureClone guarantees a cached bare clone exists for the remote. On the first call it runs "git clone --bare --no-single-branch <url> <dir>". On subsequent calls (cache already present) it runs "git fetch --tags". Returns the path to the bare clone directory.

func (*CloneCache) ListTags

func (cc *CloneCache) ListTags(remoteName string) ([]string, error)

ListTags returns all tag names from the cached bare clone for the named remote. The cache must already exist (call EnsureClone first).

func (*CloneCache) RemoveCache

func (cc *CloneCache) RemoveCache(remoteName string) error

RemoveCache deletes the cached bare clone for the named remote. Returns an error if the cache directory does not exist.

type CommandRunner

type CommandRunner struct {
	// contains filtered or unexported fields
}

CommandRunner runs commands with enhanced error handling and output capture

func NewCommandRunner

func NewCommandRunner(logger *log.Logger) *CommandRunner

NewCommandRunner creates a new command runner

func (*CommandRunner) Run

func (cr *CommandRunner) Run(
	dir string,
	command string,
	args []string,
	ctx context.Context,
) (string, error)

Run executes a command and returns output

func (*CommandRunner) RunWithProgress

func (cr *CommandRunner) RunWithProgress(
	dir string,
	command string,
	args []string,
	ctx context.Context,
	progressCb func(line string, isError bool),
) (string, error)

RunWithProgress executes a command with line-by-line progress updates

type Constraint

type Constraint struct {
	Operator string // >, <, >=, <=, ==, =, ~>
	Version  PerlVersion
}

Constraint represents a version constraint with an operator and version

func ParseConstraint

func ParseConstraint(constraint string) (Constraint, error)

ParseConstraint parses a constraint string (e.g., ">=5.32.0")

func (Constraint) Satisfies

func (c Constraint) Satisfies(version PerlVersion) bool

Satisfies checks if a version satisfies a constraint

func (Constraint) String

func (c Constraint) String() string

String returns the string representation of the constraint

type ConstraintSet

type ConstraintSet []Constraint

ConstraintSet is a collection of constraints that must all be satisfied

func ParseConstraintSet

func ParseConstraintSet(constraints string) (ConstraintSet, error)

ParseConstraintSet parses a comma-separated set of constraints

func (ConstraintSet) Satisfies

func (cs ConstraintSet) Satisfies(version PerlVersion) bool

Satisfies checks if a version satisfies all constraints in the set

func (ConstraintSet) String

func (cs ConstraintSet) String() string

String returns the string representation of the constraint set

type DefaultModuleInstaller

type DefaultModuleInstaller struct{}

Default module installer that provides user guidance

func (*DefaultModuleInstaller) InstallModule

func (d *DefaultModuleInstaller) InstallModule(moduleName string, verbose bool) error

type DependencyChecker

type DependencyChecker struct {
	// contains filtered or unexported fields
}

DependencyChecker checks for system dependencies

func NewDependencyChecker

func NewDependencyChecker() (*DependencyChecker, error)

NewDependencyChecker creates a new dependency checker

func (*DependencyChecker) CheckBuildDependencies

func (dc *DependencyChecker) CheckBuildDependencies() (*DependencyInfo, error)

CheckBuildDependencies checks for required build dependencies

func (*DependencyChecker) CheckModuleDependencies

func (dc *DependencyChecker) CheckModuleDependencies(modules []string) (*ModuleDependencyInfo, error)

CheckModuleDependencies checks for Perl module dependencies

type DependencyInfo

type DependencyInfo struct {
	Required    []string          // Required dependencies that are present
	Missing     []string          // Required dependencies that are missing
	Optional    []string          // Optional dependencies that are missing
	InstallHint map[string]string // Platform-specific install hints
}

DependencyInfo contains information about system dependencies

type DiscoveredVersion

type DiscoveredVersion struct {
	// Tag is the raw git tag string.
	Tag string
	// Version is the parsed PerlVersion extracted from the tag.
	Version PerlVersion
	// ForkName is the fork name prefix found in the tag (e.g. "myfork" from "myfork-5.40.2").
	// Empty for standard tags like "v5.40.2".
	ForkName string
}

DiscoveredVersion represents a perl version found by scanning git tags on a remote.

func ListRemoteVersions

func ListRemoteVersions(remote Remote, cacheDir string) ([]DiscoveredVersion, error)

ListRemoteVersions fetches (or refreshes) the cached bare clone for remote and returns all tags that match a Perl version pattern. Non-version tags are silently ignored.

type DownloadOptions

type DownloadOptions struct {
	// Mirror URL to use
	Mirror string

	// Version to download
	Version string

	// Progress callback function
	ProgressCallback ProgressCallback

	// Maximum number of retries for failed downloads
	MaxRetries int

	// Skip checksum validation
	SkipChecksum bool

	// Skip using cache
	SkipCache bool

	// Context for cancellation
	Context context.Context
}

DownloadOptions contains options for downloading Perl source

type DownloadProgress

type DownloadProgress struct {
	// Total size in bytes
	Total int64
	// Bytes transferred so far
	Transferred int64
	// Current download speed in bytes per second
	Speed int64
	// Estimated time to completion
	ETA time.Duration
	// Whether download is complete
	Done bool
	// Number of active chunks (for parallel downloads)
	ActiveChunks int
	// Current chunk being downloaded (for parallel downloads)
	CurrentChunk int
}

DownloadProgress contains detailed progress information

type DownloadResult

type DownloadResult struct {
	// Path to the downloaded file
	Path string

	// Version of the downloaded Perl source
	Version string

	// Size of the downloaded file in bytes
	Size int64

	// Checksum of the downloaded file
	Checksum string

	// Whether the file was loaded from cache
	FromCache bool

	// Time taken to download
	Duration time.Duration
}

DownloadResult contains information about the downloaded source

func DownloadPerlSource

func DownloadPerlSource(options *DownloadOptions) (*DownloadResult, error)

DownloadPerlSource downloads a Perl source archive for the specified version

type EnhancedProgressCallback

type EnhancedProgressCallback func(progress DownloadProgress)

EnhancedProgressCallback is a function that reports enhanced download progress

type FileHasher

type FileHasher struct {
	// contains filtered or unexported fields
}

FileHasher computes file hashes for verification

func (*FileHasher) HashDirectory

func (fh *FileHasher) HashDirectory(dir string) (string, error)

HashDirectory computes hash of directory contents

func (*FileHasher) HashFile

func (fh *FileHasher) HashFile(path string) (string, error)

HashFile computes SHA256 hash of a file

type ForkIdentifier

type ForkIdentifier struct {
	Remote      string // Remote name (e.g., "mycompany"), defaults to "origin"
	ForkName    string // Fork name (e.g., "myfork"), may be empty
	BaseVersion string // Base Perl version (e.g., "5.40.2")
}

ForkIdentifier represents a parsed fork identifier with remote, fork name, and version

func ParseForkIdentifier

func ParseForkIdentifier(input string) (*ForkIdentifier, error)

ParseForkIdentifier parses a fork identifier string into its components. Supported forms:

  • "remote/fork@version" -> Remote=remote, ForkName=fork, BaseVersion=version
  • "remote/version" -> Remote=remote, ForkName="", BaseVersion=version
  • "version" -> Remote="origin", ForkName="", BaseVersion=version

func (*ForkIdentifier) DisplayName

func (f *ForkIdentifier) DisplayName() string

DisplayName returns the human-readable display name for this fork identifier. Uses "-" as separator between fork name and version (input uses "@").

func (*ForkIdentifier) InstallPath

func (f *ForkIdentifier) InstallPath() string

InstallPath returns the path segment used for installing this fork.

func (*ForkIdentifier) IsFork

func (f *ForkIdentifier) IsFork() bool

IsFork returns true if this identifier refers to a non-origin fork.

type ForkManifest

type ForkManifest struct {
	Name           string   // Fork product name (required, cannot be "perl")
	Description    string   // Human-readable description
	BaseVersion    string   // Upstream perl version this derives from (required)
	License        string   // License identifier
	ConfigureFlags []string // Additional Configure flags for building
}

ForkManifest holds metadata parsed from a .pvm-fork.toml file in a fork repo

func ParseForkManifest

func ParseForkManifest(dir string) (*ForkManifest, error)

ParseForkManifest reads and validates a .pvm-fork.toml file from the given directory. Returns nil without error if the manifest file does not exist.

type ImportResult

type ImportResult struct {
	// Version that was imported
	Version string

	// Source tool (plenv or perlbrew)
	Source LegacyToolType

	// Path to the original installation
	OriginalPath string

	// Path to the symlink created by PVM
	SymlinkPath string

	// Whether this was set as default
	WasDefault bool
}

ImportResult represents the result of an import operation

type InstallationMetrics

type InstallationMetrics struct {
	// Timestamp when installation started
	Timestamp time.Time `json:"timestamp"`

	// Installation method (binary or source)
	Method string `json:"method"`

	// Perl version being installed
	Version string `json:"version"`

	// Platform triple (e.g., "linux-amd64")
	Platform string `json:"platform"`

	// Whether installation succeeded
	Success bool `json:"success"`

	// Generic error type (no sensitive details)
	ErrorType string `json:"error_type,omitempty"`

	// Non-sensitive error message for analytics
	ErrorMessage string `json:"-"` // Not serialized to maintain privacy

	// Timing information
	InstallStartTime time.Time     `json:"install_start_time"`
	TotalTime        TimedDuration `json:"total_time"`
	DownloadTime     TimedDuration `json:"download_time"`

	// Download metrics
	DownloadSize    int64 `json:"download_size"`
	DownloadSuccess bool  `json:"download_success"`

	// Performance metadata (no sensitive information)
	CacheHit         bool `json:"cache_hit"`
	ParallelDownload bool `json:"parallel_download"`
	ResumedDownload  bool `json:"resumed_download"`
}

InstallationMetrics contains comprehensive metrics for a single installation

func NewInstallationMetrics

func NewInstallationMetrics() *InstallationMetrics

NewInstallationMetrics creates a new installation metrics instance

func (*InstallationMetrics) Complete

func (m *InstallationMetrics) Complete(success bool, errorMsg *string)

Complete finalizes the installation metrics

func (*InstallationMetrics) RecordDownloadPhase

func (m *InstallationMetrics) RecordDownloadPhase(size int64, success bool)

RecordDownloadPhase records download timing and metrics

func (*InstallationMetrics) StartDownloadPhase

func (m *InstallationMetrics) StartDownloadPhase()

StartDownloadPhase marks the beginning of the download phase

func (*InstallationMetrics) ToMap

func (m *InstallationMetrics) ToMap() map[string]interface{}

ToMap converts metrics to a map for serialization (privacy-safe)

type LegacyPerl

type LegacyPerl struct {
	// Path to the Perl installation
	Path string

	// Version string
	Version string

	// Source tool (plenv or perlbrew)
	Source LegacyToolType

	// Is this the tool's current/default version?
	IsDefault bool

	// InstallTime is when the version was installed (derived from directory mtime)
	InstallTime time.Time
}

LegacyPerl represents a Perl installation from a legacy tool

func DetectPerlbrew

func DetectPerlbrew() ([]LegacyPerl, error)

DetectPerlbrew checks for perlbrew installations and returns their paths

func DetectPlenv

func DetectPlenv() ([]LegacyPerl, error)

DetectPlenv checks for plenv installations and returns their paths

func ImportFromLegacyTool

func ImportFromLegacyTool(toolType LegacyToolType) ([]LegacyPerl, error)

ImportFromLegacyTool imports Perl installations from a legacy tool

type LegacyToolType

type LegacyToolType string

LegacyToolType represents the type of legacy Perl version manager

const (
	Plenv    LegacyToolType = "plenv"
	Perlbrew LegacyToolType = "perlbrew"
)

type MetricsCollector

type MetricsCollector struct {
	// contains filtered or unexported fields
}

MetricsCollector handles collection and storage of installation metrics

func NewMetricsCollector

func NewMetricsCollector(storageDir string, enabled bool) *MetricsCollector

NewMetricsCollector creates a new metrics collector

func (*MetricsCollector) CleanupOldMetrics

func (mc *MetricsCollector) CleanupOldMetrics() error

CleanupOldMetrics removes metrics files older than retention period

func (*MetricsCollector) GetPerformanceComparison

func (mc *MetricsCollector) GetPerformanceComparison() (*PerformanceComparison, error)

GetPerformanceComparison generates binary vs source performance comparison

func (*MetricsCollector) GetSummary

func (mc *MetricsCollector) GetSummary() (*MetricsSummary, error)

GetSummary generates an aggregated summary of all metrics

func (*MetricsCollector) RecordInstallation

func (mc *MetricsCollector) RecordInstallation(metrics *InstallationMetrics) error

RecordInstallation records an installation's metrics

type MetricsSummary

type MetricsSummary struct {
	// Total counts
	TotalInstallations  int `json:"total_installations"`
	BinaryInstallations int `json:"binary_installations"`
	SourceInstallations int `json:"source_installations"`

	// Success rates
	OverallSuccessRate float64 `json:"overall_success_rate"`
	BinarySuccessRate  float64 `json:"binary_success_rate"`
	SourceSuccessRate  float64 `json:"source_success_rate"`

	// Average timing
	AverageBinaryTime time.Duration `json:"average_binary_time"`
	AverageSourceTime time.Duration `json:"average_source_time"`

	// Data period
	FromDate time.Time `json:"from_date"`
	ToDate   time.Time `json:"to_date"`
}

MetricsSummary provides aggregated metrics across installations

type MirrorAuth

type MirrorAuth struct {
	// Authentication type (none, basic, bearer, api-key, oauth2)
	Type string

	// Basic authentication
	Username string
	Password string

	// Bearer token authentication
	Token string

	// API key authentication
	APIKey       string
	APIKeyHeader string

	// OAuth2 authentication (placeholder for future implementation)
	OAuth2ClientID     string
	OAuth2ClientSecret string
	OAuth2TokenURL     string
	OAuth2Scopes       []string
}

MirrorAuth represents authentication configuration for mirrors

type MirrorConfig

type MirrorConfig struct {
	// Human-readable name for the mirror
	Name string `json:"name" yaml:"name"`

	// Mirror type (github-releases, jsdelivr, cloudflare-r2, direct)
	Type string `json:"type" yaml:"type"`

	// Base URL for the mirror
	BaseURL string `json:"base_url" yaml:"base_url"`

	// Priority (lower numbers = higher priority)
	Priority int `json:"priority" yaml:"priority"`

	// Whether this mirror is enabled
	Enabled bool `json:"enabled" yaml:"enabled"`

	// Request timeout for this mirror
	Timeout time.Duration `json:"timeout" yaml:"timeout"`

	// Maximum number of retries for this mirror
	MaxRetries int `json:"max_retries" yaml:"max_retries"`

	// Health check path (relative to BaseURL)
	HealthCheck string `json:"health_check" yaml:"health_check"`

	// Custom headers to send with requests
	Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`

	// URL template for custom URL patterns
	URLTemplate string `json:"url_template,omitempty" yaml:"url_template,omitempty"`

	// Version mapping for custom version names
	VersionMapping map[string]string `json:"version_mapping,omitempty" yaml:"version_mapping,omitempty"`

	// Authentication configuration
	Auth *MirrorAuth `json:"auth,omitempty" yaml:"auth,omitempty"`
}

MirrorConfig represents a single mirror configuration

func ConvertConfigToMirrors

func ConvertConfigToMirrors(cfg *config.Config) []MirrorConfig

ConvertConfigToMirrors converts PVM configuration to internal mirror format

type MirrorHealth

type MirrorHealth struct {
	// Mirror configuration
	Config MirrorConfig

	// Whether the mirror is currently healthy
	Healthy bool

	// Response time for the last health check
	ResponseTime time.Duration

	// Last health check timestamp
	LastCheck time.Time

	// Last error encountered (if any)
	LastError error

	// Number of consecutive failures
	ConsecutiveFailures int
}

MirrorHealth contains health status for a mirror

type MirrorManager

type MirrorManager struct {
	// contains filtered or unexported fields
}

MirrorManager handles mirror selection and failover

func NewMirrorManager

func NewMirrorManager() *MirrorManager

NewMirrorManager creates a new mirror manager with default configuration

func NewMirrorManagerFromConfig

func NewMirrorManagerFromConfig(cfg *config.Config) *MirrorManager

NewMirrorManagerFromConfig creates a mirror manager from PVM configuration

func NewMirrorManagerWithConfig

func NewMirrorManagerWithConfig(mirrors []MirrorConfig) *MirrorManager

NewMirrorManagerWithConfig creates a mirror manager with custom configuration

func (*MirrorManager) CheckMirrorHealth

func (mm *MirrorManager) CheckMirrorHealth(mirror MirrorConfig) *MirrorHealth

CheckMirrorHealth performs a health check on a specific mirror

func (*MirrorManager) Close

func (mm *MirrorManager) Close()

Close stops the background health checking

func (*MirrorManager) DownloadWithMirrorFailover

func (mm *MirrorManager) DownloadWithMirrorFailover(version, platform string, options *BinaryDownloadOptions) (*BinaryDownloadResult, error)

DownloadWithMirrorFailover attempts to download using the mirror chain with automatic failover

func (*MirrorManager) GenerateMirrorURL

func (mm *MirrorManager) GenerateMirrorURL(mirror MirrorConfig, version, platform string) (string, error)

GenerateMirrorURL generates a URL for a specific mirror

func (*MirrorManager) GetBestMirror

func (mm *MirrorManager) GetBestMirror() (*MirrorConfig, error)

GetBestMirror returns the best available mirror based on health and performance

func (*MirrorManager) GetMirrorChain

func (mm *MirrorManager) GetMirrorChain() []MirrorConfig

GetMirrorChain returns a prioritized list of mirrors for failover

func (*MirrorManager) GetMirrorHealth

func (mm *MirrorManager) GetMirrorHealth() map[string]*MirrorHealth

GetMirrorHealth returns the health status for all mirrors

func (*MirrorManager) GetMirrors

func (mm *MirrorManager) GetMirrors() []MirrorConfig

GetMirrors returns the current mirror configuration

func (*MirrorManager) SetMirrors

func (mm *MirrorManager) SetMirrors(mirrors []MirrorConfig)

SetMirrors updates the mirror configuration

func (*MirrorManager) UpdateMirrorHealth

func (mm *MirrorManager) UpdateMirrorHealth(name string, healthy bool, responseTime time.Duration, err error)

UpdateMirrorHealth updates the health status for a mirror

type ModuleDependencyInfo

type ModuleDependencyInfo struct {
	Installed []string
	Missing   []string
	Outdated  []string
}

ModuleDependencyInfo contains information about Perl module dependencies

type ModuleInstaller

type ModuleInstaller interface {
	InstallModule(moduleName string, verbose bool) error
}

ModuleInstaller is an interface for installing Perl modules This allows us to inject the PM functionality without creating import cycles

type ParallelExecutor

type ParallelExecutor struct {
	// contains filtered or unexported fields
}

ParallelExecutor executes tasks in parallel with error handling

func NewParallelExecutor

func NewParallelExecutor(maxWorkers int, logger *log.Logger) *ParallelExecutor

NewParallelExecutor creates a new parallel executor

func (*ParallelExecutor) Execute

func (pe *ParallelExecutor) Execute(ctx context.Context, tasks []Task) error

Execute runs tasks in parallel

type PatchPerlOptions

type PatchPerlOptions struct {
	// SourceDir is the Perl source directory to patch
	SourceDir string

	// PerlVersion is the Perl version being built
	PerlVersion string

	// Verbose enables verbose patchperl output
	Verbose bool

	// Context for command execution
	Context context.Context

	// Timeout for patchperl execution (default: 5 minutes)
	Timeout time.Duration
}

PatchPerlOptions configures patchperl behavior

type PatchPerlResult

type PatchPerlResult struct {
	// Applied indicates whether patches were applied
	Applied bool

	// PatchCount is the number of patches applied
	PatchCount int

	// Output contains the patchperl command output
	Output string

	// Duration is how long patching took
	Duration time.Duration
}

PatchPerlResult contains information about the patching process

func ApplyPatchPerl

func ApplyPatchPerl(options *PatchPerlOptions) (*PatchPerlResult, error)

ApplyPatchPerl applies Devel::PatchPerl patches to Perl source

func ApplyPatchPerlWithAutoInstall

func ApplyPatchPerlWithAutoInstall(options *PatchPerlOptions) (*PatchPerlResult, error)

ApplyPatchPerlWithAutoInstall applies patches, installing Devel::PatchPerl if needed

type PerformanceComparison

type PerformanceComparison struct {
	// Speed comparison
	BinarySpeedupFactor float64 `json:"binary_speedup_factor"`

	// Success rate comparison
	BinarySuccessRate float64 `json:"binary_success_rate"`
	SourceSuccessRate float64 `json:"source_success_rate"`

	// Download metrics
	AverageBinaryDownloadSize int64         `json:"average_binary_download_size"`
	AverageBinaryDownloadTime time.Duration `json:"average_binary_download_time"`

	// Cache effectiveness
	BinaryCacheHitRate float64 `json:"binary_cache_hit_rate"`

	// Sample sizes
	BinarySampleSize int `json:"binary_sample_size"`
	SourceSampleSize int `json:"source_sample_size"`
}

PerformanceComparison provides binary vs source performance analysis

type PerlDistribution

type PerlDistribution int

PerlDistribution represents different Perl distributions

const (
	DistributionSystem PerlDistribution = iota
	DistributionStrawberry
	DistributionActivePerl
	DistributionHomebrew
	DistributionApt
	DistributionYum
	DistributionDnf
	DistributionPacman
	DistributionZypper
	DistributionPerlBrew
	DistributionPlenv
)

func (PerlDistribution) String

func (d PerlDistribution) String() string

String returns the string representation of a PerlDistribution

type PerlVersion

type PerlVersion struct {
	Major int
	Minor int
	Patch int
	Dev   bool // True for development versions (e.g., 5.39.0)
}

PerlVersion represents a parsed Perl version (major.minor.patch)

func (PerlVersion) Compare

func (v PerlVersion) Compare(other PerlVersion) int

Compare compares this version with another version Returns: -1 if v < other, 0 if v == other, 1 if v > other

func (PerlVersion) IsStable

func (v PerlVersion) IsStable() bool

IsStable returns true if the version is a stable release

func (PerlVersion) String

func (v PerlVersion) String() string

String returns the string representation of the version

type PlenvVersion

type PlenvVersion struct {
	// Version string (e.g., "5.40.2" or "system")
	Version string

	// Path to the Perl executable for this version
	Path string

	// Is this the currently active version?
	IsActive bool

	// Is this the system Perl?
	IsSystem bool
}

PlenvVersion represents a Perl version managed by plenv

type Progress

type Progress struct {
	// contains filtered or unexported fields
}

Progress represents build progress tracking

func (*Progress) DownloadCallback

func (p *Progress) DownloadCallback() ProgressCallback

DownloadCallback returns a callback for download progress

func (*Progress) Update

func (p *Progress) Update(stage BuildProgressStage, details string, progress float64)

Update updates the progress

type ProgressCallback

type ProgressCallback func(total, transferred int64, done bool)

ProgressCallback is a function that reports download progress

type ProgressPool

type ProgressPool struct {
	// contains filtered or unexported fields
}

ProgressPool manages progress trackers

func NewProgressPool

func NewProgressPool() *ProgressPool

NewProgressPool creates a new progress pool

func (*ProgressPool) Get

func (pp *ProgressPool) Get(callback BuildProgressCallback) *Progress

Get gets a progress tracker from the pool

func (*ProgressPool) Put

func (pp *ProgressPool) Put(p *Progress)

Put returns a progress tracker to the pool

type Remote

type Remote struct {
	Name string `toml:"name" json:"name"`
	URL  string `toml:"url" json:"url"`
	Type string `toml:"type" json:"type"`
}

Remote represents a configured fork source

func (*Remote) Validate

func (r *Remote) Validate() error

Validate checks that the remote configuration is valid

type RemoteList

type RemoteList struct {
	// contains filtered or unexported fields
}

RemoteList manages a collection of remotes

func MergeRemoteLists

func MergeRemoteLists(base, override *RemoteList) *RemoteList

MergeRemoteLists merges two remote lists. Remotes from the override list take precedence over remotes with the same name in the base list.

func NewRemoteList

func NewRemoteList() *RemoteList

NewRemoteList creates an empty RemoteList

func (*RemoteList) Add

func (rl *RemoteList) Add(r Remote) error

Add adds a remote to the list after validation

func (*RemoteList) All

func (rl *RemoteList) All() []Remote

All returns a copy of all remotes

func (*RemoteList) Find

func (rl *RemoteList) Find(name string) (Remote, bool)

Find looks up a remote by name

func (*RemoteList) Remove

func (rl *RemoteList) Remove(name string) error

Remove removes a remote by name

type ResolutionOptions

type ResolutionOptions struct {
	// Explicit version to use (highest precedence)
	ExplicitVersion string

	// Script path to analyze for version requirements
	ScriptPath string

	// Project directory to check (defaults to current directory)
	ProjectDir string

	// Configuration to use (if nil, will be loaded)
	Config *config.Config

	// Available versions (if empty, will be detected)
	AvailableVersions []string

	// Skip specific resolution methods
	SkipLocal           bool // Skip project-local resolution
	SkipEnvVars         bool // Skip environment variables
	SkipUserConfig      bool // Skip user configuration
	SkipSystemPerl      bool // Skip system Perl detection
	SkipVersionResolved bool // Skip calling OnVersionResolved
	SkipScriptAnalysis  bool // Skip script version requirement analysis
	SkipNetworkFetch    bool // Skip fetching MetaCPAN downloadable versions list

	// Debug callback function called at each step of the resolution process
	DebugCallback func(step string, details interface{})
}

ResolutionOptions contains options for version resolution

type ResolutionSource

type ResolutionSource string

ResolutionSource represents the source of a resolved version

const (
	// Resolution sources in order of precedence (highest to lowest)
	ExplicitVersion     ResolutionSource = "explicit"       // Explicitly specified version
	ProjectVersionFile  ResolutionSource = "project_file"   // Project .perl-version file
	ProjectConfig       ResolutionSource = "project_config" // Project .pvm/pvm.toml
	EnvironmentVariable ResolutionSource = "env_var"        // Environment variable (PVM_PERL_VERSION, PLENV_VERSION, PERLBREW_PERL)
	UserConfig          ResolutionSource = "user_config"    // User configuration
	SystemPerlSource    ResolutionSource = "system_perl"    // System Perl installation
)

type ResolvedVersion

type ResolvedVersion struct {
	// The resolved version string
	Version string

	// The library environment name (if any)
	Library string

	// The source of the resolved version
	Source ResolutionSource

	// The path to the Perl binary executable
	Path string

	// The path to the configuration source (e.g., .perl-version file, pvm.toml)
	SourcePath string
}

ResolvedVersion represents a resolved Perl version with metadata

func ResolveVersion

func ResolveVersion(options *ResolutionOptions) (*ResolvedVersion, error)

ResolveVersion determines which Perl version to use based on the resolution algorithm The precedence order (highest to lowest) is: 1. Explicitly specified version 2. Environment variables (PVM_PERL_VERSION, PLENV_VERSION, PERLBREW_PERL) 3. Project-local .perl-version file 4. Project-local .pvm/pvm.toml 5. Script version requirements (use v5.xx) 6. User-level configuration 7. System Perl

type ShellScriptData

type ShellScriptData struct {
	// The PVM executable path
	PVMPath string

	// Shims directory
	ShimsDir string

	// User configuration directory
	ConfigDir string

	// Function prefix, used to avoid naming collisions
	FunctionPrefix string

	// Whether the shell supports advanced features
	SupportsAdvanced bool

	// Conflict warnings for other version managers
	ConflictWarnings string

	// Fortune quote for initialization Easter egg
	FortuneQuote string
}

ShellScriptData contains data for shell script templates

func (ShellScriptData) IsWindows

func (s ShellScriptData) IsWindows() bool

Returns whether the script is for a Windows shell

type ShellType

type ShellType string

ShellType represents the type of shell

const (
	// Supported shell types
	ShellBash       ShellType = "bash"
	ShellZsh        ShellType = "zsh"
	ShellFish       ShellType = "fish"
	ShellPowerShell ShellType = "powershell"
	ShellCmd        ShellType = "cmd"
	ShellUnknown    ShellType = "unknown"
)

func DetectShell

func DetectShell() (ShellType, error)

DetectShell attempts to detect the user's shell type using environment-first logic. PSModulePath is checked first on any OS (PowerShell 7 runs on Linux/macOS too), then SHELL is checked, with an OS-based fallback last.

type ShimInfo

type ShimInfo struct {
	// Name of the shim (e.g., "perl", "cpan", "prove")
	Name string

	// Type of the shim (perl or script)
	Type ShimType

	// Path to the original executable/script (optional, used for system scripts)
	OriginalPath string
}

ShimInfo contains information about a shim executable

func DiscoverAvailableShims

func DiscoverAvailableShims() ([]ShimInfo, error)

DiscoverAvailableShims lists all commands available in installed Perl versions This is used to determine which shims should be created during rehash

type ShimTemplate

type ShimTemplate struct {
	// Name of the shim executable
	Name string

	// Type of the shim
	Type string

	// Full path to the PVM binary
	PVMPath string

	// Whether this is a Windows shim
	IsWindows bool

	// Whether this is a script (as opposed to the perl executable)
	IsScript bool
}

ShimTemplate contains the data for the shim template

type ShimType

type ShimType string

ShimType represents the type of a shim

const (
	// ShimPerl represents the main perl executable
	ShimPerl ShimType = "perl"

	// ShimScript represents perl scripts like cpan, prove, etc.
	ShimScript ShimType = "script"
)

type SystemInfo

type SystemInfo struct {
	OS          string `json:"os"`
	Arch        string `json:"arch"`
	Compiler    string `json:"compiler"`
	CompilerVer string `json:"compiler_version"`
	CPUCount    int    `json:"cpu_count"`
}

SystemInfo contains system-specific information

type SystemPerl

type SystemPerl struct {
	// Path to the Perl executable
	Path string

	// Version string (e.g., "5.34.0")
	Version string

	// Full version string including additional info
	FullVersion string

	// Architecture (e.g., "x86_64")
	Architecture string

	// Is this the primary system Perl?
	IsPrimary bool
}

SystemPerl represents information about a system-installed Perl

func DetectAllSystemPerls

func DetectAllSystemPerls() ([]*SystemPerl, error)

DetectAllSystemPerls detects all Perl installations on the system

func DiscoverAllPerlsWithPlenv

func DiscoverAllPerlsWithPlenv() ([]*SystemPerl, error)

DiscoverAllPerlsWithPlenv discovers all available Perl installations using plenv

func FindPerlByVersion

func FindPerlByVersion(version string) (*SystemPerl, error)

FindPerlByVersion finds a system Perl with the specified version

type SystemPerlManager

type SystemPerlManager struct {
	// contains filtered or unexported fields
}

SystemPerlManager manages system Perl installations

func NewSystemPerlManager

func NewSystemPerlManager() *SystemPerlManager

NewSystemPerlManager creates a new SystemPerlManager

func (*SystemPerlManager) CheckForUpdates

func (m *SystemPerlManager) CheckForUpdates() (bool, error)

CheckForUpdates checks if there are updates available for system Perl

func (*SystemPerlManager) DetectOrInstallPerl

func (m *SystemPerlManager) DetectOrInstallPerl() (*SystemPerl, error)

DetectOrInstallPerl detects system Perl or installs it if not available

func (*SystemPerlManager) GetAvailableDistributions

func (m *SystemPerlManager) GetAvailableDistributions() []PerlDistribution

GetAvailableDistributions returns the list of available distributions

func (*SystemPerlManager) GetPreferredDistributions

func (m *SystemPerlManager) GetPreferredDistributions() []PerlDistribution

GetPreferredDistributions returns the preferred distribution order

func (*SystemPerlManager) InstallSystemPerl

func (m *SystemPerlManager) InstallSystemPerl() (*SystemPerl, error)

InstallSystemPerl installs Perl using the best available method

func (*SystemPerlManager) ValidateInstallation

func (m *SystemPerlManager) ValidateInstallation(perl *SystemPerl) error

ValidateInstallation validates that a Perl installation is working

type Task

type Task struct {
	Name string
	Fn   func() error
}

Task represents a parallel task

type TestSummary

type TestSummary struct {
	TotalTests   int
	PassedTests  int
	FailedTests  int
	SkippedTests int
	Duration     time.Duration
}

TestSummary contains test execution summary

type TimedDuration

type TimedDuration struct {
	StartTime time.Time     `json:"start_time"`
	EndTime   time.Time     `json:"end_time,omitempty"`
	Duration  time.Duration `json:"duration"`
}

TimedDuration represents a duration with start and end times

type VersionInfo

type VersionInfo struct {
	// Version string in normalized format (X.Y.Z)
	Version string `json:"version"`

	// InstallPath is the absolute path to the installation directory
	InstallPath string `json:"install_path"`

	// InstallTime is when the version was installed
	InstallTime time.Time `json:"install_time"`

	// Source is where the version came from: "pvm", "plenv", "perlbrew", "system"
	Source string `json:"source"`

	// BuildOptions contains the options used to build this version (if built by pvm)
	BuildOptions *BuildOptions `json:"build_options,omitempty"`

	// Remote is the fork remote name (e.g. "mycompany"); empty for stock origin installs
	Remote string `json:"remote,omitempty"`

	// ForkName is the name of the fork (e.g. "myfork"); empty when not a named fork
	ForkName string `json:"fork_name,omitempty"`

	// BaseVersion is the upstream Perl version the fork is based on; empty for stock installs
	BaseVersion string `json:"base_version,omitempty"`
}

VersionInfo contains metadata about an installed Perl version

func (VersionInfo) DisplayName

func (v VersionInfo) DisplayName() string

DisplayName returns the human-readable name for this version. For fork installs it returns "<remote>/<forkname>-<version>" or "<remote>/<version>". For stock (origin) installs it returns the bare version string.

type VersionRegistry

type VersionRegistry struct {
	// Map of UUID -> VersionInfo
	Versions map[string]VersionInfo `json:"versions"`
}

VersionRegistry holds information about all installed Perl versions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL