sub new {
my ($class, $self) = @_;
+ if($self->{xvnc}) {
+ $ENV{DISPLAY} = $self->{xvnc};
+ my $xvnc_pid = fork();
+ if(!defined $xvnc_pid) {
+ die "couldn't fork xvnc: $!";
+ }
+ elsif($xvnc_pid) {
+ $self->{xvnc_pid} = $xvnc_pid;
+ }
+ else {
+ exec("Xvnc", $self->{xvnc});
+ }
+ }
bless $self, $class;
}
return \@rows;
}
+sub DESTROY {
+ my($self) = @_;
+ if(exists $self->{xvnc_pid}) {
+ kill("KILL", $self->{xvnc_pid});
+ }
+}
+
1;