pub struct LaunchConfiguration {
pub program: PathBuf,
pub args: Vec<String>,
pub cwd: Option<PathBuf>,
pub env: HashMap<String, String>,
pub perl_path: Option<PathBuf>,
pub include_paths: Vec<PathBuf>,
}Expand description
Launch configuration for starting a new Perl debugging session
This configuration is used when starting a new Perl process for debugging. It includes the program path, arguments, environment variables, and Perl-specific settings like include paths.
Fields§
§program: PathBufPath to the Perl script to debug (required)
args: Vec<String>Command-line arguments to pass to the script
cwd: Option<PathBuf>Working directory for the debugged process
env: HashMap<String, String>Environment variables to set for the debugged process
perl_path: Option<PathBuf>Path to the perl binary (defaults to “perl” on PATH)
include_paths: Vec<PathBuf>Additional paths to add to @INC (Perl’s include path)
Implementations§
Source§impl LaunchConfiguration
impl LaunchConfiguration
Sourcepub fn resolve_paths(&mut self, workspace_root: &Path) -> Result<()>
pub fn resolve_paths(&mut self, workspace_root: &Path) -> Result<()>
Resolve workspace-relative paths to absolute paths
This method converts relative paths in the configuration to absolute paths based on the workspace root. It handles:
- Program path resolution
- Working directory resolution
- Include path resolution
§Arguments
workspace_root- The workspace root directory
§Errors
Returns an error if path resolution fails
§Examples
use perl_dap_config::LaunchConfiguration;
use std::path::PathBuf;
let mut config = LaunchConfiguration {
program: PathBuf::from("script.pl"),
args: vec![],
cwd: None,
env: std::collections::HashMap::new(),
perl_path: None,
include_paths: vec![PathBuf::from("lib")],
};
config.resolve_paths(&PathBuf::from("/workspace"))?;
assert!(config.program.is_absolute());Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate the configuration
This method checks that:
- Program path exists and is a file
- Working directory exists (if specified)
- Perl binary exists (if specified)
§Errors
Returns an error if validation fails
§Examples
use perl_dap_config::LaunchConfiguration;
use std::path::PathBuf;
let config = LaunchConfiguration {
program: PathBuf::from("/path/to/script.pl"),
args: vec![],
cwd: None,
env: std::collections::HashMap::new(),
perl_path: None,
include_paths: vec![],
};
config.validate()?;Trait Implementations§
Source§impl Clone for LaunchConfiguration
impl Clone for LaunchConfiguration
Source§fn clone(&self) -> LaunchConfiguration
fn clone(&self) -> LaunchConfiguration
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more