Minor correction below:  I forgot to press the enter key before "my
@users".

-----Original Message-----
From: Tim Johnson 
Sent: Tuesday, December 23, 2003 10:06 AM
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: win32:netsend


Looking at the documentation ("perldoc Win32:netsend"), it looks pretty
simple.  The module takes a hash as an argument with two keys: to and
message.  If you wanted to send to a list of users, you could do
something like this:

##############################################

use strict;
use warnings;
use Win32::NetSend;     #Capitalization is important even if windows 
                                #will sometimes let you get away with it

my @users = qw(jim bob jimbob); my $message = "Anyone with Jim or Bob in
their name needs to get off the network.\n"; my $send =
Win32::NetSend->new();

foreach(@users){
        #Notice that this function returns 0 on success
        !$send->Send( to => $_, message => $message ) || warn "Could not
send a message to $_\n"; }

##############################################

The one thing to watch out for is that the Send() function returns 0 on
success.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 23, 2003 3:33 AM
To: [EMAIL PROTECTED]
Subject: win32:netsend


How do I use win32::netsend to send a message to multiple users ?



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to