summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2017-10-01 16:19:31 +0200
committerDaniel Friesel <derf@finalrewind.org>2017-10-01 16:19:31 +0200
commitc9463cb260f1851bb3f5a4b60acb913ec96807df (patch)
tree3244e4f9f297c8ad98f51e0f25f70692c13252fc
parentee9b0f5cfc4eecb9c68880d5a6b4ea2e981f0df1 (diff)
Run perltidy
-rwxr-xr-xbin/mqtt-multipub18
1 files changed, 10 insertions, 8 deletions
diff --git a/bin/mqtt-multipub b/bin/mqtt-multipub
index c079d6f..8cbcefd 100755
--- a/bin/mqtt-multipub
+++ b/bin/mqtt-multipub
@@ -9,13 +9,13 @@ our $VERSION = '0.00';
use File::Slurp qw(read_file);
use Net::MQTT::Simple;
-my $mqtt = Net::MQTT::Simple->new( '172.23.225.193' );
+my $mqtt = Net::MQTT::Simple->new('172.23.225.193');
sub parse_content_string {
my ($raw_content) = @_;
- if ($raw_content =~ m{ ^ / [^/] }x) {
- my $content = read_file($raw_content, { err_mode => 'carp' });
- if (defined $content) {
+ if ( $raw_content =~ m{ ^ / [^/] }x ) {
+ my $content = read_file( $raw_content, { err_mode => 'carp' } );
+ if ( defined $content ) {
chomp $content;
}
return $content;
@@ -24,12 +24,14 @@ sub parse_content_string {
}
for my $arg (@ARGV) {
- if ($arg =~ m{ ^ (?<topic> [^=]+) = (?<msgtype> . ) = (?<content> .*) $ }x) {
- my $content = parse_content_string($+{content});
- if ($+{msgtype} eq 'm') {
+ if (
+ $arg =~ m{ ^ (?<topic> [^=]+) = (?<msgtype> . ) = (?<content> .*) $ }x )
+ {
+ my $content = parse_content_string( $+{content} );
+ if ( $+{msgtype} eq 'm' ) {
$mqtt->publish( $+{topic}, $content );
}
- elsif ($+{msgtype} eq 'r') {
+ elsif ( $+{msgtype} eq 'r' ) {
$mqtt->retain( $+{topic}, $content );
}
else {