Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread WC -Sx- Jones
Harry Putnam wrote: One thing you could say is to give an example of what you are talking about. I'm not sure I even know what a `reference' is. About References: http://learn.perl.org/library/beginning_perl/3145_Chap07.pdf A Beginner's Overview of General Perl: http://ebb.org/PickingUpPerl/picki

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Harry Putnam
"R. Joseph Newton" <[EMAIL PROTECTED]> writes: > Harry Putnam wrote: > > >> >> Its going very steady... That is, I've never used a reference... : ) > > What can I say? You've got to take the step, if you want to get > there. You will have plenty of help. Until you get these basic > structuring

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
Harry Putnam wrote: > > Its going very steady... That is, I've never used a reference... : ) What can I say? You've got to take the step, if you want to get there. You will have plenty of help. Until you get these basic structuring skills down you are severely limited in the scope of tasks

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Randy W. Sims
R. Joseph Newton wrote: I'll do some more scanning through my hdr directory to see how many folded lines I actually see. Ooooh! I see The To line can also get folded. I think the trick that I showed for testing for initial space should work for that It is very clear that the input processing ha

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Randy W. Sims
R. Joseph Newton wrote: I count 13 characters in test_hdr_good header_is_good { has 15 characters. My personal preference is that if the variable/function returns a boolean, then the name should start with (is|has|have), etc. if ( has_good_header() ) {...} use constant HAVE_MODULE_FOO => eval {

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Smoot Carl-Mitchell
On Sat, 27 Mar 2004 14:36:56 -0800 "R. Joseph Newton" <[EMAIL PROTECTED]> wrote: > I'll do some more scanning through my hdr directory to see how many > folded lines I actually see. Ooooh! I see The To line can also get > folded. I think the trick that I showed for testing for initial space > sh

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Harry Putnam
"R. Joseph Newton" <[EMAIL PROTECTED]> writes: > The point here is that the script itelf is too broad a scope for most variables. > With > a few exceptions, it is best when you can see the entire scope of any variable > within a > single screen. This takes structure. It is very much worth the

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
Smoot Carl-Mitchell wrote: > > Actually, I'm pretty sure it is only the Received header that would > > ever show more than once in the main header of a message. > > Read the relevant RFCs for mail message standards. I'd start with > RFC2822 and work forward from there. This is definitely a good i

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread John W. Krahn
Wc -Sx- Jones wrote: > > Harry Putnam wrote: > > "R. Joseph Newton" <[EMAIL PROTECTED]> writes: > >> > >>Why here. Since you are doing this with each line, you could write in the loop > >>control: > >>while (my $line = ) { > > > > Not sure I understand the advantage. In my formulation, `$line' i

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
Harry Putnam wrote: > Yes, I see now. > > I think I may not have understood the meaning of `global'. I > understood it to mean these variables could theoretically be exported > as in the case of `do "./this_script"; from another script. > > I was under the impression that a `my($var);' at the beg

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
"R. Joseph Newton" wrote: > Ooops > ... At a time when I had 13, 038 message in a > given mailbox, should be ... At a time when I had 13, 1398 message in a given mailbox, Which makes the following more meaningful: > these were the only header items to appear in exactly that many > messages: >

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
Harry Putnam wrote: > ... I'm having trouble seeing what is shorter or > better about this. > > : sub test_hdr_good { I count 13 characters in test_hdr_good header_is_good { has 15 characters. For the price of two characters, you can => indicate the type of information [boolean] returned. If

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
Harry Putnam wrote: > > I think Joseph was implying the 'chomp'. This is > > still shorter and IMO clearer than using $_. > > > > while ( my $line = ) { > > chomp $line; > > I hope it doesn't sound like I'm being a hard head... because at my > stage of skill I'm not likely to st

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
"Charles K. Clarkson" wrote: > Harry Putnam <[EMAIL PROTECTED]> wrote: > : > : "R. Joseph Newton" <[EMAIL PROTECTED]> writes: > : > : > > Something like: > : > > [...] snipped getopts and other unrelated stuff > : > > while(){ > : > > chomp; > : > > my $line = $_; > : > >

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
Harry Putnam wrote: > >> Something like: > >> [...] snipped getopts and other unrelated stuff > >> while(){ > >> chomp; > >> my $line = $_; > > > > Why here. Since you are doing this with each line, you could write in the loop > > control: > > while (my $line = ) { > >

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Smoot Carl-Mitchell
On Sat, 27 Mar 2004 11:44:28 -0800 "R. Joseph Newton" <[EMAIL PROTECTED]> wrote: > "Randy W. Sims" wrote: > > > On 3/27/2004 2:23 AM, R. Joseph Newton wrote: > > > These lines should probably be going into a hash, > > > keyed to the portion of the line before the colon. > > > > Don't forget that

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread R. Joseph Newton
"Randy W. Sims" wrote: > On 3/27/2004 2:23 AM, R. Joseph Newton wrote: > > These lines should probably be going into a hash, > > keyed to the portion of the line before the colon. > > Don't forget that some header fields can appear more than once. > > Regards, > Randy. Actually, I'm pretty sure i

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Harry Putnam
"Charles K. Clarkson" <[EMAIL PROTECTED]> writes: [...] > As programs get larger, many perl programmers find > declaring variables at the top of a code structure a > poor idea. In perl it is generally better to declare a > variable at or very near it's first invocation. I appreciate you lett

RE: Home made mail news search tool, and folded header lines

2004-03-27 Thread Charles K. Clarkson
Harry Putnam <[EMAIL PROTECTED]> wrote: : : "Charles K. Clarkson" <[EMAIL PROTECTED]> writes: : : > : I wanted a way to ensure that each reg has hit at : > : least once. Otherwise we don't print. So I used a : > : formulation like this (Not posted previously for : > : clarity): : > : : > :

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Harry Putnam
"Charles K. Clarkson" <[EMAIL PROTECTED]> writes: > : > > while(){ > : > > chomp; > : > > my $line = $_; > : > > : > Why here. Since you are doing this with each line, > : > you could write in the loop control: > : > while (my $line = ) { > : > : Not sure I understand

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread WC -Sx- Jones
Harry Putnam wrote: "R. Joseph Newton" <[EMAIL PROTECTED]> writes: An example would be that I wanted to run a series of regex against each line of input (While in headers) grabing the matches into an array for printing. Something like: [...] snipped getopts and other unrelated stuff while(){

RE: Home made mail news search tool, and folded header lines

2004-03-27 Thread Charles K. Clarkson
Harry Putnam <[EMAIL PROTECTED]> wrote: : : "R. Joseph Newton" <[EMAIL PROTECTED]> writes: : : > > Something like: : > > [...] snipped getopts and other unrelated stuff : > > while(){ : > > chomp; : > > my $line = $_; : > : > Why here. Since you are doing this with each

Re: Home made mail news search tool, and folded header lines

2004-03-27 Thread Harry Putnam
"R. Joseph Newton" <[EMAIL PROTECTED]> writes: [EMAIL PROTECTED], Thanks for the advice and code snippet... I'm studying your code now for adding to my knowledge base. But understand that base is quite small at present so it takes me a while to figure out what code is doing. Usually involving ma

Re: Home made mail news search tool, and folded header lines

2004-03-26 Thread Randy W. Sims
On 3/27/2004 2:23 AM, R. Joseph Newton wrote: These lines should probably be going into a hash, keyed to the portion of the line before the colon. Don't forget that some header fields can appear more than once. Regards, Randy. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: Home made mail news search tool, and folded header lines

2004-03-26 Thread R. Joseph Newton
Harry Putnam wrote: > I'm writing a home boy mail/news search tool and wondered if there is > a cononical way to handle folded or indented header lines. > > An example would be that I wanted to run a series of regex against each > line of input (While in headers) grabing the matches into an array

Re: Home made mail news search tool, and folded header lines

2004-03-26 Thread Randy W. Sims
Harry Putnam wrote: "Randy W. Sims" <[EMAIL PROTECTED]> writes: Harry Putnam wrote: I'm writing a home boy mail/news search tool and wondered if there is a cononical way to handle folded or indented header lines. There are modules to help read mail headers, but if you want something simple you c

Re: Home made mail news search tool, and folded header lines

2004-03-26 Thread Harry Putnam
"Randy W. Sims" <[EMAIL PROTECTED]> writes: > Harry Putnam wrote: >> I'm writing a home boy mail/news search tool and wondered if there is >> a cononical way to handle folded or indented header lines. > > There are modules to help read mail headers, but if you want something > simple you can modif

Re: Home made mail news search tool, and folded header lines

2004-03-26 Thread Randy W. Sims
Harry Putnam wrote: I'm writing a home boy mail/news search tool and wondered if there is a cononical way to handle folded or indented header lines. There are modules to help read mail headers, but if you want something simple you can modify the following example: #!/usr/bin/perl use strict; use

Home made mail news search tool, and folded header lines

2004-03-25 Thread Harry Putnam
I'm writing a home boy mail/news search tool and wondered if there is a cononical way to handle folded or indented header lines. An example would be that I wanted to run a series of regex against each line of input (While in headers) grabing the matches into an array for printing. Something like: