Operating System - Linux
1821244 Members
2978 Online
109632 Solutions
New Discussion

Send ConsoleMessage using Perl script.

 
Mike Murphy_7
Occasional Advisor

Send ConsoleMessage using Perl script.

Does anyone have the correct syntax for sending console message using PERL? I normally script in VB but I need to send a message from a PERL script on a UNIX machine I monitor.

I’m trying to send a ConsoleMessage using in a PERL script without using OPCMSG.EXE. In VB script I use the code snip below. Is something similar available in PERL?

Thanks,

Mike


VB Script Syntax:

Dim ConsoleMessage

Set ConsoleMessage = CreateObject("OVOAutomation.Opcmsg")
'Populate values and send message to sub agent

ConsoleMessage.MessageText = "Message Text"
ConsoleMessage.Object = "Object"
ConsoleMessage.Application = "TestApp"
ConsoleMessage.Severity = "Normal"
ConsoleMessage.Send

Perl Syntax:
$ConsoleMessage->MsgText("msgtext");
$ConsoleMessage->Object("object");
$ConsoleMessage->Application("application");
$ConsoleMessage->Severity("severity");
$ConsoleMessage->Send();
2 REPLIES 2
Steven E. Protter
Exalted Contributor

Re: Send ConsoleMessage using Perl script.

Shalom,

All you need to do is see that the output gets to /dev/console

system ( echo "message" > /dev/console);

Thats the simplest, but quite an effective way to get messages to the console.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
H.Merijn Brand (procura
Honored Contributor

Re: Send ConsoleMessage using Perl script.

open my $console, ">", "/dev/console" or die "Cannot write messages to console: $!";

:
:

print $console "Message\n";

:
:

print $console "Another message\n";

:
:

close $console;

Enjoy, Have FUN! H.Merijn [ why is M$Win always so overly complicated? ]
Enjoy, Have FUN! H.Merijn