pm

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: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRequiredModulesForScript

func GetRequiredModulesForScript(scriptPath string) ([]string, error)

GetRequiredModulesForScript analyzes a Perl script to determine required modules using AST parsing This is a helper function for PVX to determine what modules might be needed

func NewCommand

func NewCommand() *cobra.Command

NewCommand creates a new PVI command

Types

type BackupManager

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

BackupManager handles cpanfile backup operations

func NewBackupManager

func NewBackupManager(backupConfig *config.PMBackupConfig, logger *log.Logger) (*BackupManager, error)

NewBackupManager creates a new backup manager with configuration

func (*BackupManager) BackupCpanfile

func (bm *BackupManager) BackupCpanfile(cpanfilePath string) error

BackupCpanfile creates a backup of the cpanfile if backup mode is enabled

func (*BackupManager) GetBackupMode

func (bm *BackupManager) GetBackupMode() string

GetBackupMode returns the current backup mode

func (*BackupManager) SetBackupMode

func (bm *BackupManager) SetBackupMode(mode string) error

SetBackupMode temporarily overrides the backup mode (for CLI flag support)

type CpanfileManager

type CpanfileManager struct {
	Path string
	// contains filtered or unexported fields
}

CpanfileManager handles cpanfile operations

func NewCpanfileManager

func NewCpanfileManager(path string) *CpanfileManager

NewCpanfileManager creates a new cpanfile manager for the given path

func NewCpanfileManagerWithConfig

func NewCpanfileManagerWithConfig(path string, backupConfig *config.PMBackupConfig, logger *log.Logger) (*CpanfileManager, error)

NewCpanfileManagerWithConfig creates a new cpanfile manager with backup configuration

func (*CpanfileManager) AddDependency

func (cm *CpanfileManager) AddDependency(moduleName, versionConstraint string, isDev, isTest bool) error

AddDependency adds a new dependency to the cpanfile

func (*CpanfileManager) GenerateSnapshot

func (cm *CpanfileManager) GenerateSnapshot() (*Snapshot, error)

GenerateSnapshot creates a cpanfile.snapshot from currently installed modules

func (*CpanfileManager) GetBackupMode

func (cm *CpanfileManager) GetBackupMode() string

GetBackupMode returns the current backup mode

func (*CpanfileManager) ListDependencies

func (cm *CpanfileManager) ListDependencies() (*cpan.CPANFile, error)

ListDependencies returns all dependencies from the cpanfile

func (*CpanfileManager) ReadSnapshot

func (cm *CpanfileManager) ReadSnapshot() (*Snapshot, error)

ReadSnapshot reads a cpanfile.snapshot file

func (*CpanfileManager) RemoveDependency

func (cm *CpanfileManager) RemoveDependency(moduleName string) error

RemoveDependency removes a dependency from the cpanfile

func (*CpanfileManager) SetBackupMode

func (cm *CpanfileManager) SetBackupMode(mode string) error

SetBackupMode temporarily overrides the backup mode (for CLI flag support)

func (*CpanfileManager) WriteSnapshot

func (cm *CpanfileManager) WriteSnapshot(snapshot *Snapshot) error

WriteSnapshot writes a snapshot to cpanfile.snapshot

type ModuleAnalyzer

type ModuleAnalyzer struct{}

ModuleAnalyzer is a stub for the real module analyzer

func NewModuleAnalyzer

func NewModuleAnalyzer() (*ModuleAnalyzer, error)

NewModuleAnalyzer creates a stub module analyzer

func (*ModuleAnalyzer) AnalyzeModule

func (ma *ModuleAnalyzer) AnalyzeModule(modulePath string) (interface{}, error)

AnalyzeModule is a stub that returns an error indicating the analyzer is not yet available

type ModuleAvailabilityResult

type ModuleAvailabilityResult struct {
	// AvailableModules contains modules that are available for installation
	AvailableModules []string

	// UnavailableModules contains modules that are not available
	UnavailableModules []string

	// Errors contains any errors encountered during availability checking
	Errors []error
}

ModuleAvailabilityResult contains the result of module availability checking

func CheckModuleAvailability

func CheckModuleAvailability(modules []string, perlVersion string) (*ModuleAvailabilityResult, error)

CheckModuleAvailability checks if modules are available for installation

type ModuleEnvironmentResult

type ModuleEnvironmentResult struct {
	// EnvironmentDir is the directory where modules were installed
	EnvironmentDir string

	// InstalledModules contains successfully installed modules
	InstalledModules []string

	// Errors contains any errors encountered
	Errors []error
}

ModuleEnvironmentResult contains the result of creating a module environment

func CreateModuleEnvironment

func CreateModuleEnvironment(perlVersion string, modules []string, targetDir string) (*ModuleEnvironmentResult, error)

CreateModuleEnvironment creates an environment with the required modules installed This is used by PVX to set up isolated environments with specific modules

type PMModuleInstaller

type PMModuleInstaller struct{}

PMModuleInstaller implements perl.ModuleInstaller using PM's internal functionality

func (*PMModuleInstaller) InstallModule

func (p *PMModuleInstaller) InstallModule(moduleName string, verbose bool) error

InstallModule installs a module using PM's internal module installation

type PVXIntegrationOptions

type PVXIntegrationOptions struct {
	// PerlVersion specifies which Perl version to install modules for
	PerlVersion string

	// RequiredModules is the list of modules to install
	RequiredModules []string

	// InstallDir is the directory to install modules to (optional)
	InstallDir string

	// Verbose enables verbose output
	Verbose bool

	// MaxRetries is the maximum number of retry attempts for failed installations
	MaxRetries int

	// SkipTests whether to skip running tests during installation
	SkipTests bool

	// Output writer for status messages (optional, defaults to discarding output)
	OutputWriter io.Writer
}

PVXIntegrationOptions contains options for automatic module installation

type PVXIntegrationResult

type PVXIntegrationResult struct {
	// InstalledModules contains successfully installed modules
	InstalledModules []string

	// FailedModules contains modules that failed to install
	FailedModules []string

	// SkippedModules contains modules that were already installed
	SkippedModules []string

	// Errors contains any errors encountered during installation
	Errors []error
}

PVXIntegrationResult contains the result of automatic module installation

func InstallModulesForPVX

func InstallModulesForPVX(options *PVXIntegrationOptions) (*PVXIntegrationResult, error)

InstallModulesForPVX automatically installs required modules for PVX execution

type ProviderBuilder

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

ProviderBuilder provides a fluent interface for creating CPAN providers

func NewProviderBuilder

func NewProviderBuilder() *ProviderBuilder

NewProviderBuilder creates a new provider builder

func (*ProviderBuilder) AddOption

func (pb *ProviderBuilder) AddOption(option cpan.ProviderOption) *ProviderBuilder

AddOption adds a custom provider option

func (*ProviderBuilder) Build

Build creates the configured provider (and optionally resolver)

func (*ProviderBuilder) BuildProvider

func (pb *ProviderBuilder) BuildProvider() (cpan.Provider, error)

BuildProvider creates just the provider (convenience method)

func (*ProviderBuilder) WithConfig

func (pb *ProviderBuilder) WithConfig(cfg *config.Config) *ProviderBuilder

WithConfig sets the configuration to use for provider setup

func (*ProviderBuilder) WithNoCache

func (pb *ProviderBuilder) WithNoCache(noCache bool) *ProviderBuilder

WithNoCache disables caching for the provider

func (*ProviderBuilder) WithResolver

func (pb *ProviderBuilder) WithResolver() *ProviderBuilder

WithResolver includes dependency resolver creation

func (*ProviderBuilder) WithSource

func (pb *ProviderBuilder) WithSource(source string) *ProviderBuilder

WithSource sets the metadata source (metacpan, cpan, custom)

type ProviderBuilderResult

type ProviderBuilderResult struct {
	Provider cpan.Provider
	Resolver deps.DependencyResolver
}

ProviderBuilderResult contains both provider and resolver

type Snapshot

type Snapshot struct {
	Version       string                   `json:"version"`
	Distributions map[string]SnapshotEntry `json:"distributions"`
	GeneratedAt   time.Time                `json:"generated_at"`
	PerlVersion   string                   `json:"perl_version"`
}

Snapshot represents the complete cpanfile.snapshot structure

type SnapshotEntry

type SnapshotEntry struct {
	Distribution string            `json:"distribution"`
	Pathname     string            `json:"pathname"`
	Provides     map[string]string `json:"provides"`
	Requirements map[string]string `json:"requirements"`
	Checksum     string            `json:"checksum,omitempty"`
}

SnapshotEntry represents a single entry in the cpanfile.snapshot

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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