Newbie question on smtp...

2002-09-04 Thread Yuen, Alex

I am having problems with smtp. I am trying to do a simple test from the
documentation and can't figure out why it is not working. I get this error
message:

Can't call method "mail" on an undefined value at windowstest_07.pl
line 10.

Here is what I have.


*
#!/usr/local/bin/perl -w

use Net::SMTP;

# Section determines the domain name of smtp server.
# $smtp = Net::SMTP->new('mailhost');
# print $smtp->domain,"\n";
# $smtp->quit;

$smtp->mail('[EMAIL PROTECTED]');
$smtp->to('[EMAIL PROTECTED]');

$smtp->data();
$smtp->datasend("To: [EMAIL PROTECTED]\n");
$smtp->datasend("\n");
$smtp->datasend("A simple test message\n");
$smtp->datasend();

$smtp->quit;

*
This seems simple enough, but keep getting this error message.

Using ActivePerl version 5.6. 

Thanks.

Alex





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Newbie question on smtp...

2002-09-04 Thread Yuen, Alex

Never mind...figured it out.

Stupid error with the # sign.

Thanks though.

Alex


> --
> From:     Yuen, Alex
> Sent: Wednesday, September 04, 2002 10:11 AM
> To:   'Perl Beginners'
> Subject:  Newbie question on smtp...
> 
> I am having problems with smtp. I am trying to do a simple test from the
> documentation and can't figure out why it is not working. I get this error
> message:
> 
>   Can't call method "mail" on an undefined value at windowstest_07.pl
> line 10.
> 
> Here is what I have.
> 
> **
> ***
>   #!/usr/local/bin/perl -w
> 
>   use Net::SMTP;
> 
>   # Section determines the domain name of smtp server.
>   # $smtp = Net::SMTP->new('mailhost');
>   # print $smtp->domain,"\n";
>   # $smtp->quit;
> 
>   $smtp->mail('[EMAIL PROTECTED]');
>   $smtp->to('[EMAIL PROTECTED]');
> 
>   $smtp->data();
>   $smtp->datasend("To: [EMAIL PROTECTED]\n");
>   $smtp->datasend("\n");
>   $smtp->datasend("A simple test message\n");
>   $smtp->datasend();
> 
>   $smtp->quit;
> **
> ***
> This seems simple enough, but keep getting this error message.
> 
> Using ActivePerl version 5.6. 
> 
> Thanks.
> 
> Alex
> 
> 
> 
> 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Newbie question - Can smtp send attachments?

2002-09-04 Thread Yuen, Alex

Hi,

Is it possible to send attachments using NET::SMTP? 

Will I need to use a seperate module in my script? If so, which one and how?

Thanks.

Alex


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Newbie question - Can smtp send attachments?

2002-09-04 Thread Yuen, Alex

Hi, 

Having problems with just a simple test of MIME::Lite. Here is the output:


**
Global symbol "$msg" requires explicit package name at mimetest.pl
line 6.
Global symbol "$msg" requires explicit package name at mimetest.pl
line 13.
Execution of mimetest.pl aborted due to compilation errors.

**

And here is the script:


**
#!/usr/local/bin/perl -w

use MIME::Lite;
use strict;

$msg = MIME::Lite->new(
From=>'[EMAIL PROTECTED]',
To  =>'[EMAIL PROTECTED]',
Subject =>'Testing MIME::Lite Module.',
Data=>"Successfully sent message."
);

$msg->send;

**
So, what does the output message mean?

Thanks.

Alex


> --
> From: Bob Showalter[SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, September 04, 2002 11:33 AM
> To:   '[EMAIL PROTECTED]'
> Subject:  RE: Newbie question - Can smtp send attachments?
> 
> > -Original Message-
> > From: Yuen, Alex [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, September 04, 2002 11:17 AM
> > To: 'Perl Beginners'
> > Subject: Newbie question - Can smtp send attachments?
> > 
> > 
> > Hi,
> > 
> > Is it possible to send attachments using NET::SMTP? 
> 
> Well, yes. But SMTP doesn't really know or care about "attachments". The
> trick is to prepare a multipart MIME message that contains the attachments
> and then send that using SMTP.
> 
> > 
> > Will I need to use a seperate module in my script? If so, 
> > which one and how?
> 
> I like MIME::Lite. Download from CPAN and read the docs. Very simple to
> use.
> It can do the sending, or you can use Net::SMTP to send the message if you
> like.
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Newbie question - Can smtp send attachments?

2002-09-05 Thread Yuen, Alex

Thanks to everyone for there help. I manage to get it to work for what I
need it for. Now onto other stuff.

:-)


> --
> From: Tim Musson[SMTP:[EMAIL PROTECTED]]
> Reply To: Tim Musson
> Sent: Wednesday, September 04, 2002 8:46 PM
> To:   [EMAIL PROTECTED]
> Subject:  Re: Newbie question - Can smtp send attachments?
> 
> Hey Alex, 
> 
> My MUA believes you used Internet Mail Service (5.5.2653.19)
> to write the following on Wednesday, September 4, 2002 at 2:39:07 PM.
> 
> YA> Hi,
> 
> YA> Having problems with just a simple test of MIME::Lite. Here is the
> output:
> 
> YA>
> **
> **
> YA> **
> YA> Global symbol "$msg" requires explicit package name at
> mimetest.pl
> YA> line 6.
> 
> Been having problems with my mail today so don't know if you have a
> response yet...  What is happening is from the 'use strict;' line.
> 
> Basically you want to 'scope' your variables.  Easiest way to take
> care of the err msg is put a 'my' in front of the $msg variable (and
> each one that gets a complaint).   Note: you only do this once in the
> current scope...
> 
> Once you do that and get it tested, run perldoc and check out the
> 'strict' and 'warnings' modules - you should always use them when
> working on your code.
> 
> YA> And here is the script:
> 
> YA>
> **
> **
> YA> **
> YA> #!/usr/local/bin/perl -w
> 
> YA> use MIME::Lite;
> YA> use strict;
>,,,--put the my here.
> YA> $msg = MIME::Lite->new(
> YA> From=>'[EMAIL PROTECTED]',
> YA> To  =>'[EMAIL PROTECTED]',
> YA> Subject =>'Testing MIME::Lite Module.',
> YA> Data=>"Successfully sent message."
> YA> );
> 
> YA> $msg->send;
> YA>
> **
> **
> YA> **
> YA> So, what does the output message mean?
> 
> 
> -- 
> [EMAIL PROTECTED]
> Flying with The Bat! eMail v1.61
> Windows 2000 5.0.2195 (Service Pack 2)
> The generation of random numbers is too important to be left to chance.
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Window Services - stop/start (Newbie)...

2002-09-10 Thread Yuen, Alex

Hi,

Does anyone know if Perl can stop or start a Service in Windows NT or 2000?

Trying to write a script to stop the Service of an application, archive the
log files and then restart the Service. Plus, record this transaction to a
seperate log file. Another plus, send out an e-mail notification if an error
were to occur in any step of the Perl script.

Haven't decided to attach the log to the e-mail or not. But would be using
Mime::Lite for this.

Thanks.

Alex

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Window Services - stop/start (Newbie)...

2002-09-12 Thread Yuen, Alex

Hi,

I just tried to install both modules (Win32::Service & Win32::Lanman). Get
the message that I am using the wrong build of Perl. Both files were
downloaded from CPAN. 

Didn't see a make.pl file, but did see an install.pl file. Ran that file and
get the error message above. Do I need to create a make.pl file to install
the module?

Or am I missing something very simple?

I am using ActiveState Perl 5.6.1 Build 633. I copied this from the command
prompt...using Windows NT 4.0.


***
E:\>perl -v

This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2001, Larry Wall

Binary build 633 provided by ActiveState Corp. http://www.ActiveState.com
Built 21:33:05 Jun 17 2002


Perl may be copied only under the terms of either the Artistic License or
the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'.  If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.

***
Thanks.

Alex


> --
> From: Timothy Johnson[SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, September 10, 2002 4:34 PM
> To:   'Yuen, Alex'; 'Perl Beginners'
> Subject:  RE: Window Services - stop/start (Newbie)...
> 
> 
> Check out Win32::Service or Win32::Lanman.  Lanman is a whole lot to chew,
> but it can do just about anything involving remote administration of
> NT/2000/XP machines.
> 
> -Original Message-
> From: Yuen, Alex [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 10, 2002 1:33 PM
> To: 'Perl Beginners'
> Subject: Window Services - stop/start (Newbie)...
> 
> 
> Hi,
> 
> Does anyone know if Perl can stop or start a Service in Windows NT or
> 2000?
> 
> Trying to write a script to stop the Service of an application, archive
> the
> log files and then restart the Service. Plus, record this transaction to a
> seperate log file. Another plus, send out an e-mail notification if an
> error
> were to occur in any step of the Perl script.
> 
> Haven't decided to attach the log to the e-mail or not. But would be using
> Mime::Lite for this.
> 
> Thanks.
> 
> Alex
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Window Services - stop/start (Newbie)...

2002-09-12 Thread Yuen, Alex

Tim, 

Thanks for this information.

I managed to install Win32::Lanman using PPM. But I still got an error
message installing Win32::Service. I'm going to see how difficult Lanman is
before racking my head with Win32::Service. 

But here is the error I got if anyone is interested. :)

*
E:\>ppm
PPM interactive shell (2.1.6) - type 'help' for available commands.
PPM> set repository dave http://www.roth.net/perl/packages
PPM> set save
PPM> install win32-service
Install package 'win32-service?' (y/N): y
Installing package 'win32-service'...
Error installing package 'win32-service': Read a PPD for 'win32-service',
but it is not intended for this build of Perl (MSWin32-x86-multi-thread)
PPM> quit
Quit!
*
Thanks.

Alex


> --
> From: Timothy Johnson[SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, September 12, 2002 4:13 PM
> To:   'Yuen, Alex'; 'Perl Beginners'
> Subject:  RE: Window Services - stop/start (Newbie)...
> 
> 
> Why don't you install it via PPM?  If it's not in the Activestate
> repository, you can install it using Dave Roth's PPM repository.
> 
> PPM> set repository dave http://www.roth.net/perl/packages
> PPM> set save
> PPM> install win32-service
> 
> For Win32::Lanman (and many other useful modules), use Jenda's repository:
> http://jenda.krynicky.cz/perl
> 
> 
> -Original Message-
> From: Yuen, Alex [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, September 12, 2002 11:50 AM
> To: 'Perl Beginners'
> Subject: RE: Window Services - stop/start (Newbie)...
> 
> 
> Hi,
> 
> I just tried to install both modules (Win32::Service & Win32::Lanman). Get
> the message that I am using the wrong build of Perl. Both files were
> downloaded from CPAN. 
> 
> Didn't see a make.pl file, but did see an install.pl file. Ran that file
> and
> get the error message above. Do I need to create a make.pl file to install
> the module?
> 
> Or am I missing something very simple?
> 
> I am using ActiveState Perl 5.6.1 Build 633. I copied this from the
> command
> prompt...using Windows NT 4.0.
> 
> **
> **
> ***
> E:\>perl -v
> 
> This is perl, v5.6.1 built for MSWin32-x86-multi-thread
> (with 1 registered patch, see perl -V for more detail)
> 
> Copyright 1987-2001, Larry Wall
> 
> Binary build 633 provided by ActiveState Corp. http://www.ActiveState.com
> Built 21:33:05 Jun 17 2002
> 
> 
> Perl may be copied only under the terms of either the Artistic License or
> the
> GNU General Public License, which may be found in the Perl 5 source kit.
> 
> Complete documentation for Perl, including FAQ lists, should be found on
> this system using `man perl' or `perldoc perl'.  If you have access to the
> Internet, point your browser at http://www.perl.com/, the Perl Home Page.
> **
> **
> ***
> Thanks.
> 
> Alex
> 
> 
> > --
> > From:   Timothy Johnson[SMTP:[EMAIL PROTECTED]]
> > Sent:   Tuesday, September 10, 2002 4:34 PM
> > To: 'Yuen, Alex'; 'Perl Beginners'
> > Subject:RE: Window Services - stop/start (Newbie)...
> > 
> > 
> > Check out Win32::Service or Win32::Lanman.  Lanman is a whole lot to
> chew,
> > but it can do just about anything involving remote administration of
> > NT/2000/XP machines.
> > 
> > -Original Message-
> > From: Yuen, Alex [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, September 10, 2002 1:33 PM
> > To: 'Perl Beginners'
> > Subject: Window Services - stop/start (Newbie)...
> > 
> > 
> > Hi,
> > 
> > Does anyone know if Perl can stop or start a Service in Windows NT or
> > 2000?
> > 
> > Trying to write a script to stop the Service of an application, archive
> > the
> > log files and then restart the Service. Plus, record this transaction to
> a
> > seperate log file. Another plus, send out an e-mail notification if an
> > error
> > were to occur in any step of the Perl script.
> > 
> > Haven't decided to attach the log to the e-mail or not. But would be
> using
> > Mime::Lite for this.
> > 
> > Thanks.
> > 
> > Alex
> > 
> > -- 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Newbie - Help with writing a memory leak script for an applicatio n...

2002-11-12 Thread Yuen, Alex
Hi,

I am still a newbie to Perl.

I am assigned to write a Perl program to monitor a memory leak on an
application running on a Sun system - Solaris. Now, I'm a Windows NT System
Administrator...so, I am trying to transition over to Unix and don't know
where to start. Can someone point me in the right direction to start? What
modules to use for Unix?

The Perl script will be grabbing the information from a log files. The
script will run automatically, by cron, every hour and compares to the
previous hour, then records the difference. If the difference reaches a
critical level, an e-mail notification is sent.

I have ActiveState Perl v5.6.a build 633 installed on my Windows
workstation.

Thanks in advance.

Alex Yuen

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Newbie Question - Monitoring NT Server(s) and Notification...

2002-08-28 Thread Yuen, Alex

Hi All,

I am also a newbie and looking to get a good start on how to actually write
a Perl script to do what I need.

I am looking to setup a script to monitor a NT Server(s) for:
CPU usage   notify if heavily used
Memory usagenotify if heavily used
HardDrive space notify if using up to a certain percentage, like 80%
utilization
Server reboot   notify when a server is rebooted or comes down
Server down notify if and when a server is not responding (if
possible)
Application notify if an application is down (if possible)

Plus others possibilities that can be used.

I have read most of the documentation, but confused at what to use and how
to start. I learn faster by actually doing it from a good starting point,
but I don't know where to begin on this one.

Any suggestions to get me started would be greatly appreciated.

Thanks.

Alex


Life is grand...don't let it pass you by.
Enjoy life...second chances don't always come around.
:-)


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]