Thread Perl mit Kommandozeilenprogramm kommunizieren (Windows) (79 answers)
Opened by bianca at 2013-09-10 13:07

bianca
 2013-09-13 19:58
#170193 #170193
User since
2009-09-13
6977 Artikel
BenutzerIn

user image
Wenn ich das hier mache:
Code (perl): (dl )
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
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
use IPC::Cmd qw[can_run run run_forked QUOTE];
use Data::Dumper;

my %conf = (
    exe     => 'gpg2.exe',
);

my $full_path = can_run($conf{exe});
if (defined $full_path) {
    print "verwende Pfad '$full_path'\n";
    my $cmd = $full_path
        .''
    ;
    my @return = run(
        command => $cmd,
#       verbose => 0,
        buffer  =>\my $buffer,
        timeout => 20,
    );
    print Dumper(\@return);
    if (defined $buffer) {
        print "\n\nErgebnis:\n".Dumper(\$buffer);
    }
    else {
        print "Programmstart gescheitert\n";
    }
}
else {
    print "Nicht installiert oder nicht im path\n";
}

Dann kommt:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
verwende Pfad 'C:\Program Files\GNU\GnuPG\pub\gpg2.exe'
$VAR1 = [
undef,
'file not found: C:\\Program at C:/strawberry/perl/lib/IPC/Cmd.pm line 1166.
',
[],
[],
[]
];
Programmstart gescheitert

Und daraus schloß ich ursprünglich, dass das Teil keine Pfade mit Blanks in Namen verträgt.
Last edited: 2013-09-13 20:00:32 +0200 (CEST)
10 print "Hallo"
20 goto 10

View full thread Perl mit Kommandozeilenprogramm kommunizieren (Windows)