-switch ($ENV{ANSW_MSG}) {
- case /^!help$/ { print qx{ grep -o 'case /[^\$/]*' "$0" | grep -o '!.*' | tr '\n' ',' }; }
- case /^!ping$/ { print "PONG"; }
- case /^!whoami$/ { print "You are: $ENV{ANSW_FROM}"; }
- case /^!status$/ { print "[$ENV{ANSW_STATUS}] $ENV{ANSW_STATUS_MSG}"; }
- case /^!(reboot|reset|restart|halt)$/ { print "Broadcast message: The system is going down for reboot NOW !!"; }
- case /^!google/ { print "UTFG Yourself: http://google.com/"; }
- case /^!uptime$/ { print qx{uptime}; }
- case /^!date$/ { print qx{date}; }
- case /^!dmesg$/ { print qx{ dmesg | tail -n 5 | tr '\n' '\t' } }
+given ($ENV{ANSW_MSG}) {
+ when (/^!help$/) { print qx{ grep -o 'when \(/[^\$/]*' "$0" | grep -o '!.*' | tr '\n' ',' }; }
+ when (/^!ping$/) { print "PONG"; }
+ when (/^!whoami$/) { print "You are: $ENV{ANSW_FROM}"; }
+ when (/^!whoareyou$/) { print "Hello, my name is $ENV{ANSW_LOCAL_NAME} ;-)"; }
+ when (/^!version$/) { print "$ENV{ANSW_AGENT} $ENV{ANSW_AGENT_VERSION}"; }
+ when (/^!status$/) { print "[$ENV{ANSW_STATUS}] $ENV{ANSW_STATUS_MSG}"; }
+ when (/^!(reboot|reset|restart|halt)$/) { print "Broadcast message: The system is going down for reboot NOW !!"; }
+ when (/^!google/) { print "UTFG Yourself: http://google.com/"; }
+ when (/^!uptime$/) { print qx{uptime}; }
+ when (/^!date$/) { print qx{date}; }
+ when (/^!dmesg$/) { print qx{ dmesg | tail -n 5 | tr '\n' '\t' } }