annotate Lib/IMPL/Test/Straps/ShellExecutor.pm @ 47:a9b70d836b28

Web::Application development (request controller) Security development
author Sergey
date Tue, 23 Feb 2010 22:57:16 +0300
parents 03e58a454b20
children 16ada169ca75
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
1 package IMPL::Test::Straps::ShellExecutor;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
2 use strict;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
3 use warnings;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
4
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
5 use base qw(IMPL::Object IMPL::Object::Serializable);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
6
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
7 if ($^O =~ /win32/i) {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
8 require Win32::Console;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
9 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
10
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
11 sub Execute {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
12 my ($this,$file) = @_;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
13
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
14 my $h;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
15
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
16 if ($^O =~ /win32/i) {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
17 Win32::Console::OutputCP(65001);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
18 unless ( open $h,'-|',$file ) {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
19 return undef;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
20 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
21 binmode $h,':encoding(utf-8)';
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
22 } else {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
23 unless ( open $h,'-|',$file ) {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
24 return undef;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
25 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
26 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
27
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
28 return $h;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
29 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
30
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
31
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
32 1;