Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 13.59.188.23
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : Macro.pm

# Copyright (c) 1999-2017 Rob Fugina <robf@fugina.com>
# Distributed under the terms of the GNU Public License, Version 3.0

package X10::Macro;

use strict;

use X10::Event;


sub new
{
   my $type = shift;

   my $self = bless { @_ }, $type;

   return $self;
}


sub run
{
   my $self = shift;

   return undef unless $self->{controller};

   # send a list of events (specified by string)
   if (exists $self->{events})
   {
      $self->{controller}->send(
	map { new X10::Event($_) } @{$self->{events}}
	);
   }
   # send a list of events returned by a perl sub
   elsif (exists $self->{perleval})
   {
      $self->{controller}->send($self->{perleval}->());
   }
   # run a perl sub
   elsif (exists $self->{perlsub})
   {
      $self->{perlsub}->();
   }
   else
   {
      return undef;
   }

   return 1;
}

sub controller
{
   my $self = shift;

   if (@_)
   {
      $self->{controller} = shift;
   }

   return $self->{controller};
}

sub description
{
   my $self = shift;
   return $self->{description};
}



1;

© 2025 GrazzMean