File: MSWin.pm

package info (click to toggle)
libnet-openssh-perl 0.84-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 448 kB
  • sloc: perl: 3,410; makefile: 2
file content (53 lines) | stat: -rw-r--r-- 1,114 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package Net::OpenSSH::ShellQuoter::MSWin;

use strict;
use warnings;
use Carp;

sub new { shift() }

sub quote {
    shift;
    my $arg = shift;
    if ($arg eq '') {
        return '""';
    }
    if ($arg =~ /[ \t\n\x0b"]/) {
        $arg =~ s{(\\+)(?="|\z)}{$1$1}g;
        $arg =~ s{"}{\\"}g;
        return qq("$arg");
    }
    return $arg;
}

*quote_glob = \&quote;

sub shell_fragments { wantarray ? () : '' }

1;

__END__

=head1 NAME

Net::OpenSSH::ShellQuoter::MSWin - Quoter for Win32::CreateProcess

=head1 DESCRIPTION

This quoter is intended for interaction with SSH servers running on
Windows which use the C<Win32::CreateProcess> system call to launch the
requested command.

Because of C<Win32::CreateProcess> not doing wildcard expansion, glob
quoting just quotes everything.

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2008-2014 by Salvador FandiE<ntilde>o
(sfandino@yahoo.com)

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.10.0 or,
at your option, any later version of Perl 5 you may have available.

=cut