4 $ENV{OBJECT_REMOTE_TEST_LOGGER} = 1;
6 use Object::Remote::Connector::Local;
8 use Object::Remote::ModuleSender;
10 $ENV{PERL5LIB} = join(
11 ':', ($ENV{PERL5LIB} ? $ENV{PERL5LIB} : ()), qw(lib)
14 my $mod_content = do {
15 open my $fh, '<', 't/lib/ORTestClass.pm'
16 or die "can't read ORTestClass.pm: $!";
21 'ORTestClass.pm' => $mod_content,
24 sub TestModuleProvider::INC {
25 my ($self, $module) = @_;
26 if (my $data = $self->{modules}{$module}) {
27 open my $fh, '<', \$data
28 or die "Unable to open in-memory file: $!";
37 if (my $data = $modules->{$_[1]}) {
38 open my $fh, '<', \$data
39 or die "Unable to open in-memory file: $!";
44 dynamic_array => [ [ sub {
46 if (my $data = $mods->{$_[1]}) {
47 open my $fh, '<', \$data
48 or die "Unable to open in-memory file: $!";
53 object => [ bless { modules => $modules }, 'TestModuleProvider' ],
55 if (my $data = $modules->{$_[1]}) {
56 my @lines = split /\n/, $data;
57 my $read = join("\n", 0..$#lines);
58 open my $fh, '<', \$read
62 my $ret = $_ != $#lines ? 1 : 0;
70 if (my $data = $modules->{$_[1]}) {
71 my @lines = split /(\n)/, $data;
74 return @lines ? 1 : 0;
81 for my $source (sort keys %sources) {
82 my $ms = Object::Remote::ModuleSender->new(
83 dir_list => $sources{$source},
85 my $connection = Object::Remote::Connector::Local->new(
89 my $counter = Object::Remote->new(
90 connection => $connection,
91 class => 'ORTestClass'
94 isnt($$, $counter->pid, "$source sender: Different pid on the other side");
96 is($counter->counter, 0, "$source sender: Counter at 0");
98 is($counter->increment, 1, "$source sender: Increment to 1");
100 is($counter->counter, 1, "$source sender: Counter at 1");