HI,
I am struggleing to add a perl variable into a command that sould run in bash.
perl code:
listen
{
foreach my $event ( @_ )
{
#print( Data::Dumper( $_ )."\n" );
if ( $event->house_code() eq ZM_X10_HOUSE_CODE )
{
my $unit_code = $event->unit_code();
my $device = $device_hash{$unit_code};
if ( !$device )
{
$device = $device_hash{$unit_code} = { appliance=>$x10->Appliance( unit_code=>$unit_code ), status=>'unknown' };
}
next if ( $event->func() !~ /(?:ON|OFF)/ );
$device->{status} = $event->func();
my $task_list = $device->{$event->func()."_list"};
if ( $task_list )
{
foreach my $task ( @$task_list )
{
processTask( $task );
}
}
}
Info( "Got event - ".$event->as_string()."\n" );
Info( " got - ".$event->house_code().$event->unit_code().$event->func()."\n");
my $x10_device = .$event->house_code().$event->unit_code().$event->func().;
system("/bin/echo $x10_device");
}
code not working:
my $x10_device = .$event->house_code().$event->unit_code().$event->func().;
system("/bin/echo $x10_device");
$x10_device has the value of A1ON
thus on bash should look like
dvr@dvr:~$ echo A1ON
A1ON
currently in bash it outputs :
.X10::Event=HASH(0x96a9f58)->house_code().X10::Event=HASH(0x96a9f58)->unit_code().X10::Event=HASH(0x96a9f58)->func().
Thanks
Dude
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.