New on Mail::Send

2005-11-16 Thread ZHAO, BING
 I am on Windows XP home edition. I have this software Secure Shell which tunnels to 
a remote host(unix). The remote is very strictly managed, any installation of anything would 
require me to talk to/call up the system administator(this is national security). Then I have this 
home-made module directory, just a dir with lots of *.pm files, I have got away without actually 
downloading any module for a while. ( I usually just copy and paste the raw source code and save 
it under my module dir)
 Any 'make install' would result in Error. Since what I am doing is relatively 
simple, I just dug out the required module from the MailTools-1.67/, like Mail::Send, Mail::Mailer 
etc and save them into my secret home-made module dir and set path to it.



 STOP: any suggestion for me on how to install modules correctly or any doubt for me 
on if I really want to learn to install modules, plz stop. I appreciate your eagerness to show off 
your seniority. And stop making assumption, as I just stated case clear enough. And when it comes 
down to learning/study, very few people could match my intensity.
 
 My point again: I am a perl beginner. I don't care how the perl is developing and 
where perl is going. I am doing stuff way fancier than what you can imagine. I am current doing a 
project with web input and data anaylysis and email feedback. I need to do them and not to think 
why and how perl is like this, why and how perl module works this way. As long as it works, I am 
happy and I am making progress. If the purpose of being on this list is to ask questions and help 
each other out, I am in for it.

I have enough 'living-a-pumped-up-life' phylosophies from my 5,000-year 
cultural heritages.


 Here is my script:

require Mail::Send;
$msg = new Mail::Send;
$msg = new Mail::Send Subject=>'example subject', To=>'Bing Zhao';
$msg->to('[EMAIL PROTECTED]');
$msg->subject('example subject');
$msg->cc('[EMAIL PROTECTED]');
$fh = $msg->open;
print $fh "Body of message";
$fh->close;


With no error regarding the whereabout of the necessary modules, I assume I got the module thing 
right. Then every time, this 'dead.letter' is generated. I guess it's part of the built-in 
function of Mail::Send, when the script fails to send the email. Anyway, here is a copy of the 
dead.letter files:


From bzhao Wed Nov 16 12:13:15 2005
Return-Path: 
Received: (from [EMAIL PROTECTED])
by gly.lbl.gov (8.12.11/8.12.11/Submit) id jAGKDFRT011092;
Wed, 16 Nov 2005 12:13:15 -0800
Date: Wed, 16 Nov 2005 12:13:15 -0800
From: bing zhao 
Message-Id: <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]
Subject: example subject
To: [EMAIL PROTECTED]
 
Body of message
 
Any CONSTRUCTIVE suggestion on how I should modify my code?


thanks a lot.

best,

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




Re: follow-up questions on Mail::Send

2005-11-16 Thread ZHAO, BING

Oh, I indeed did what you'll just told me to do:
1. I first downloaded this MailTools-1.67.tar.gz
2. ungziped it
3. cd MailTools-1.67
4. Moreed Readme, followed the instructions, until the last step, "make install" failed, still 
lots of files including a lib/ were generated.
5. Tried to run my file. Error! Followed the error message, step by step, (errors mostly are 
"can't find Send.pm" etc), that's how I went into the Mailtoos-1.67 =>lib=>Mail. to get the 
Send.pm and saved it in my current directory.
6. Then it finally seemed to be working. But got stuck, a dead.letter is generated every time. No 
email was sent whatsoever.


I am just perl beginner and doing bioperl most of time and it would cost me 6 months at least to 
read the Camel book. Then I would understand what the modules really are saying. I don't believe 
anyone cares how the modules are coded, just trying to get them to work in your script. That's 
exactly what I am doing. And no, it didn't work.  help me and tell me what I did was wrong. Tell 
you the truth, I don't understand how the Mail::Send is coded, nor I believe many of people in 
this list do, nor anyone in this list cares how Mail::Send is coded.



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




follow-up questions on Mail::Send

2005-11-16 Thread ZHAO, BING

Hi,
   I have used small single package named as X.pm before, never big ones. But for 
Mail::Send, I downloaded this huge file MailTools-1.67. I dug several modules out like Send.pm, 
Mailer.pm etc and saved them in the current directory.

   Tried to run my file, but got this dead.letter generated:

From bzhao Wed Nov 16 12:13:15 2005
Return-Path: 
Received: (from [EMAIL PROTECTED])
by gly.lbl.gov (8.12.11/8.12.11/Submit) id jAGKDFRT011092;
Wed, 16 Nov 2005 12:13:15 -0800
Date: Wed, 16 Nov 2005 12:13:15 -0800
From: bing zhao 
Message-Id: <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]
Subject: example subject
To: [EMAIL PROTECTED]
 
Body of message
 
***

CONTENT OF MY runMail.pl:


require Mail::Send;
 
$msg = new Mail::Send;
 
$msg = new Mail::Send Subject=>'example subject', To=>'Bing Zhao';
 
$msg->to('[EMAIL PROTECTED]');

#$msg->to('[EMAIL PROTECTED]', '[EMAIL PROTECTED]');
$msg->subject('example subject');
$msg->cc('[EMAIL PROTECTED]');
#$msg->bcc('[EMAIL PROTECTED]');
 
#$msg->set($header, @values);

#$msg->add($header, @values);
#$msg->delete($header);
 
# Launch mailer and set headers. The filehandle returned

# by open() is an instance of the Mail::Mailer class.
# Arguments to the open() method are passed to the Mail::Mailer
# constructor.
 
$fh = $msg->open;   # some default mailer

# $fh = $msg->open('sendmail'); # explicit
 
print $fh "Body of message";
 
$fh->close; # complete the message and send it
 
#$fh->cancel;# not yet implemented
 




Just copied and pasted from the Mail::Send synopsis and made minor modifications. Don't know what 
was wrong. Not really trying to understand how it worked, just want to be able to send a HTML link 
to others. Say, To : [EMAIL PROTECTED]Subject: Hello, there!Message: 
www.berkeley.edu

That's all I have been dreaming for. Help me!!

thanks,

best,

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




about email sender

2005-11-15 Thread ZHAO, BING

Hi, all:
 I have tried to read the email::sender module on CPAN, but it is far beyond my 
ablilty to understand it. And the synopsis gave me big headache too. But I just feel it should be 
no more than 5/6 lines to :

 1. Send email to [EMAIL PROTECTED]
 2. Send email from [EMAIL PROTECTED]
 3. Title: "hello!"
 4. Body:"_MESSAGE_"
 I have been testing the different modules from CPAN, but it seemed I couldn't get 
them to work.
 I feel shameless to ask any of you to give me some ready example to do the above 
things(and the necessay module to install). For those who have used email sender before, it would 
be just breezes, but for me, frustration...

 thanks again and again.

best,



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




Re: tricky problem about stat function-follow up

2005-11-13 Thread ZHAO, BING

On Sun, 13 Nov 2005 17:36:39 -0800
 "ZHAO, BING" <[EMAIL PROTECTED]> wrote:

opendir GOP, "SCRATCH/BACKUP" or die "cannot open directory SCRATCH/BACKUP:$!";
my @smm=grep{($_ ne ".") && ($_ ne "..")} readdir GOP;
foreach (@smm){
my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime,
 $mtime, $ctime, $blksize, $blocks) = stat($_);
print $ctime;
} 
closedir GOP;



This piece of code WORKS when I point opendir GOP to the current directory. But it DOESN"T work 
when I point to the subdirectory SCRATCH/BACKUP within the current directory.

It's tricky. And " print $_  " successfully prints out the files in 
SCRATCH/BACKUP dir.


 By 'doesn't work', I mean $ctime is null.



What is the problem?

thank you all.

bing

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





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




tricky problem about stat function

2005-11-13 Thread ZHAO, BING

opendir GOP, "SCRATCH/BACKUP" or die "cannot open directory SCRATCH/BACKUP:$!";
my @smm=grep{($_ ne ".") && ($_ ne "..")} readdir GOP;
foreach (@smm){
my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime,
 $mtime, $ctime, $blksize, $blocks) = stat($_);
print $ctime;
} 
closedir GOP;



This piece of code WORKS when I point opendir GOP to the current directory. But it DOESN"T work 
when I point to the subdirectory SCRATCH/BACKUP within the current directory.

It's tricky. And " print $_  " successfully prints out the files in 
SCRATCH/BACKUP dir.

What is the problem?

thank you all.

bing

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




PS what is the correct/efficient function to create a file

2005-11-07 Thread ZHAO, BING

Hi,
  unlink $file works fine, but link $file doesn't even exist,
  The sysopen function seems to be tedious, does anyone know how to effectively 
create a file in some directory in perl?


thanks a lot


best,


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




about creating a file in directory

2005-11-07 Thread ZHAO, BING

Hi,
It seems pretty easy to unlink a file from a directory, but wherever describes 
unlinking file has no counterpart on create a file.
 I did perldoc -q file: got what seemed to be what I need, then tested my 
program, no good:

opendir PDB,"SCRATCH" or die "cannot open the SCRATCH dir:$!";
my @GG=grep{!/^./ && !/^../} readdir(PDB); #to store all the file names in the 
array @GG
my $NN=scalar (@GG+1);
$filenamie="PDB_$NN.txt";
open LOO,">>SCRATCH/$filenamie" or die "cannot open the SCRATCH/$filenamie:$!";
sysopen(LOO, "SCRATCH/$filenamie", O_WRONLY|O_TRUNC|O_CREAT)|| die $!;
sysopen(LOO, "SCRATCH/$filenamie", O_WRONLY|O_TRUNC|O_CREAT, 0666)  || die $!;
select LOO;
print "linking was successful!";


This didn't work.
What was wrong?
thanks a lot.

best,

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




about cron and perl

2005-11-04 Thread ZHAO, BING

Hi,
  I was advised to check out man cron for how to use cron. Set off do_it.pl using cron. 
But that's about it , all I can get from web help. I have no clue:

  1. what should I include in the do_it.pl, say to delete certain old 
files?
  2. this is a more unix problem, how should I exactly invoke "crontab do_it.pl", say I 
want cron to run do_it.pl everyday?

   thank you all.

best,

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




about man page

2005-10-28 Thread ZHAO, BING

Hi:
what is manpage? Where is it locate in cpan? to be specific, how do I get to cron 
manpage?

 thank you all.

best

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




about running unix command in perl script

2005-10-28 Thread ZHAO, BING

Hi,
   Is there a way to run unix command in perl?
   To be specific, for the ftp command:
   1.ftp ftp.rcsb.org
   2.cd /pub/pdb/data/structures/divided/pdb/
   3.cd nx
   4.get pdb1nxc.ent.Z
   5.bye
   I need to automate this process to ftp get the file 
pdb1nxc.ent.Z.
   thank you.

bing

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




delete file after on week

2005-10-22 Thread ZHAO, BING

Hi:
I need to delete files older than one week old, I know how to code that(with the help 
of many kind people on this list):
But it only happens when I run the program, there is a chance I will not be running 
the program for more than a week. And the dir keeps getting larger(downloading files from 
website), I need those files older than 1 week all gone WITHOUT having to type ./do_it.pl on unix 
command line.
Any idea on this? It seems pretty unreasonle to me, even. Let me know if this is 
something impossible.

thank you.

bing

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




call java in perl

2005-10-22 Thread ZHAO, BING

Hi,
I knew there are many ways to call java in perl or call perl in java, but I have been 
searching, still got nothing, does any of you know some online source about linking the two 
together?

thanks,

bing

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




remainder function

2005-10-14 Thread ZHAO, BING

Hi,
 Is there a remainder function, since I need to check if a number is divisible by 
another?

 Thank you all.

best,

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




hi

2005-10-10 Thread ZHAO, BING

Hi,
  I am doing this simple enough script, but somehow it 
generates error:



open COO, "1898.inf" or die "Cannot open file 1898.inf:$!";
@shrimp=;

foreach @shrimp{
$squid=substr($_,0,4);
$shark=$_.".pdb";
system "\rm dali.lock"; #ignore this part
system "dalilite ~readbrk pdb1898/$shark $squid"; #ignore this part
}


Global symbol "@shrimp" requires explicit package name at ./pdbReadbrk2000.pl 
line 19.
syntax error at ./pdbReadbrk2000.pl line 21, near "foreach @shrimp"
Global symbol "$to" requires explicit package name at ./pdbReadbrk2000.pl line 
21.


thank you all, what did I do wrong?

best,

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




keeping track of the 'age' of a file

2005-10-10 Thread ZHAO, BING

Hi,
  Sorry I have to ask random questions again, perl is so profoud and I just finished 
reading the Llama book, and deeply feel like doing crazy things but couldn't  but still believe 
perl could do it and believe one of you guys could enlighten me..

   No more blah.
   I am doing this CGI upload website, by saving files submitted by other people, 
(there is no problem with the storage capacity), I can readily delete the file right after all the 
processing/modification on it is done. But, I figured it might be a good idea to save the file for 
like a week then delete it, if I know some kind of function like "clock"(as wild as it can get..), 
"date" etc, so after a week or so, the perl script would delete the file.
If you think this is something too crazy, don't hesitate to throw me the words," 
put it out, you idiot!", " are you nuts?" or whatever you feel like saying to me, then I will know 
"hm, maybe I have to resolve it in another way"

thank you all.

best,

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




random #

2005-10-09 Thread ZHAO, BING

Hi,
 is there a single random number generator function in perl? Or do you have any 
idea/algorithm on how to shuffle the elements in an array?


  Thank you all.

best,

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




two questions

2005-10-06 Thread ZHAO, BING

Hi,
   1. How do I change the unix system background to black, mine is while which is so 
annoying whenever I do perl.
2. How do I download perl modules form CPAN, I completely understand the 4 steps 
listed there, but the problem is I need the perlmodule.gar.gz file to start with, whenever I click 
on the module to download, (by the way, I am on windows XP  Secure Shell to a Unix machine), I got 
a zipped folder, after I extract the zipped file, I then get a normal windows folder containing a 
bunch of files.

Is there a way to download the module and load it into the 
unix ?
Note: I have windows XP SSHed to unix

thanks a lot.

bing

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




question about # of files in a directory

2005-09-28 Thread ZHAO, BING

Hi,
first, I want to thank all who viewed my first question days before, especially to 
those who took time to answer it. It was trenmendous encouragement for a beginner perlee like me. 
Thanks again.

My question:
 Is there a way to call or maybe get the # of files in a directory?
 I am trying to build a storage directory for files which automatically empits itself 
when the # files reaches 50. If there is some commands which do that(like whatever 
COMMAND(directory) ), the problem would be solved, I then will be OK to program the rest of perl.
  To be more specific, I have a CGI online page which takes uploaded files(press 
'upload' on my website, then upload whatever text files, uaually DNA sequence files) then I need 
to modify the files a bit then save the files to the STORAGE directory, the directory can't be 
infinitely increasing, so I need to empty it when the time comes.  And I need to keep track of the 
# of files in that 'damn' directory.
   Maybe you got better idea about how to store the files to the directory? Let me 
know then.


   Thank you all for reading my 'junk'.

best,

Bing

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




hi

2005-09-27 Thread ZHAO, BING

Hi,
How do you INPUT the output( of a file) to the designated file? To be specific, if 
the file being output generates a score/number which needs to be subsequently input into another 
file, how to you set up the output and input?

Thannks a lot.

bz

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