Commit 0c1f4bcc authored by Michael Pyne's avatar Michael Pyne
Browse files

modularize: Move NullIPC to separate file (IPC::Null).

parent 635f24e9
......@@ -61,6 +61,7 @@ use ksb::Debug;
use ksb::Util;
use ksb::Version qw(scriptVersion);
use ksb::IPC::Pipe;
use ksb::IPC::Null;
use 5.010_000; # Require Perl 5.10.0
......@@ -88,46 +89,6 @@ my $run_mode = 'build'; # Determines if updating, building, installing, etc.
# }}}
# package NullIPC {{{
# Dummy IPC module in case SysVIPC doesn't work.
{
package NullIPC;
use ksb::IPC;
our @ISA = qw(ksb::IPC);
sub new
{
my $class = shift;
my $self = $class->SUPER::new;
$self->{'msgList'} = []; # List of messages.
return bless $self, $class; # OOP in Perl is so completely retarded
}
sub sendMessage
{
my $self = shift;
my $msg = shift;
push @{$self->{'msgList'}}, $msg;
return 1;
}
sub receiveMessage
{
my $self = shift;
return undef unless scalar @{$self->{'msgList'}} > 0;
return shift @{$self->{'msgList'}};
}
1;
}
# }}}
# package KDEXMLReader {{{
# kde_projects.xml module-handling code.
# The core of this was graciously contributed by Allen Winter, and then
......@@ -8038,7 +7999,7 @@ eval
if (!$ipc)
{
$ipc = new NullIPC;
$ipc = ksb::IPC::Null->new();
whisper ("Using no IPC mechanism\n");
$result = handle_updates ($ipc, $ctx);
......
package ksb::IPC::Null;
# Dummy IPC module in case SysVIPC doesn't work or async mode is not needed.
use strict;
use warnings;
use v5.10;
use ksb::IPC;
our @ISA = qw(ksb::IPC);
sub new
{
my $class = shift;
my $self = $class->SUPER::new;
$self->{'msgList'} = []; # List of messages.
return bless $self, $class; # OOP in Perl is so completely retarded
}
sub sendMessage
{
my $self = shift;
my $msg = shift;
push @{$self->{'msgList'}}, $msg;
return 1;
}
sub receiveMessage
{
my $self = shift;
return undef unless scalar @{$self->{'msgList'}} > 0;
return shift @{$self->{'msgList'}};
}
1;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment