NAME
PowerShell::Cmdlet - Wraps a generic cmdlet
VERSION
version 1.00
SYNOPSIS
use PowerShell::Cmdlet;
# Minimally
my $command = PowerShell::Cmdlet->new('Mount-DiskImage')
->parameter('Image', 'C:\\tmp\\foo.iso')
->parameter('StorageType', 'ISO');
# Then add it to a pipeline
$pipeline->add($command);
# Or pipe a powershell pipeline to it
$powershell->pipe_to($command);
# Or just print it out
print('running [', $command->command(), "]\n");
DESCRIPTION
Represents a generic cmdlet. Can be used as is for most situations, or can be extended to provide a cmdlet specific interface.
CONSTRUCTORS
new($name)
Creates a new cmdlet for $name
.
METHODS
command()
Returns a string form of the command.
parameter([$name], $value)
Adds a parameter to the cmdlet. If name is supplied, it will be a named parameter. For example:
PowerShell::Cmdlet('Mount-DiskImage')
->parameter('Image' => 'C:\\tmp\\foo.iso');
would result in:
Mount-DiskImage -Image 'C:\tmp\foo.iso'
If $name
is not supplied, the value will be added by itself:
PowerShell::Cmdlet('Get-Volume')
->parameter('E');
would result in:
Get-Volume 'E'
AUTHOR
Lucas Theisen <lucastheisen@pastdev.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Lucas Theisen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
SEE ALSO
Please see those modules/websites for more information related to this module.