PowerShell::Cmdlet - Wraps a generic cmdlet
version 1.00
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");
Represents a generic cmdlet. Can be used as is for most situations, or can be extended to provide a cmdlet specific interface.
Creates a new cmdlet for $name.
$name
Returns a string form of the command.
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');
Get-Volume 'E'
Lucas Theisen <lucastheisen@pastdev.com>
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.
Please see those modules/websites for more information related to this module.
PowerShell
PowerShell::Pipeline
https://msdn.microsoft.com/en-us/powershell/scripting/powershell-scripting
To install PowerShell, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PowerShell
CPAN shell
perl -MCPAN -e shell install PowerShell
For more information on module installation, please visit the detailed CPAN module installation guide.