[18620] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 788 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Apr 28 06:05:57 2001

Date: Sat, 28 Apr 2001 03:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <988452307-v10-i788@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 28 Apr 2001     Volume: 10 Number: 788

Today's topics:
    Re: Appending to files and flock. <skilchen@swissonline.ch>
    Re: Boole's tools (was Things I'm just not getting in P <bart.lateur@skynet.be>
    Re: capture jpg from avi/mpeg file <gellyfish@gellyfish.com>
    Re: CGI::header is a filehandle? <gellyfish@gellyfish.com>
    Re: Chicago Perl Consultants Needed <webmaster@webdragon.unmunge.net>
    Re: dynamic creation of classes? nobull@mail.com
    Re: extracting hostname from a url? <gellyfish@gellyfish.com>
    Re: Finding all elements in an array matching a certian nobull@mail.com
    Re: Finding all elements in an array matching a certian nobull@mail.com
    Re: Finding all elements in an array matching a certian <krahnj@acm.org>
    Re: First and last element in list loop <gtoomey@usa.net>
    Re: First and last element in list loop <uri@sysarch.com>
    Re: First and last element in list loop <gtoomey@usa.net>
    Re: Help Me Obi One You're my Only Hope <gellyfish@gellyfish.com>
    Re: help me (Gwyn Judd)
    Re: Image representation of a binary string <gtoomey@usa.net>
    Re: Levels of perl programming <webmaster@webdragon.unmunge.net>
    Re: Must send lots of emails (Martien Verbruggen)
    Re: Must send lots of emails <webmaster@webdragon.unmunge.net>
    Re: Parsing an email message from STDIN - Suggestions <gellyfish@gellyfish.com>
    Re: run by click in linux <gellyfish@gellyfish.com>
    Re: Strange string -> num conversion (Gwyn Judd)
    Re: Strange string -> num conversion <gellyfish@gellyfish.com>
    Re: The most complete C interpreter in the world is ava <gellyfish@gellyfish.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 28 Apr 2001 11:30:46 +0200
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: Appending to files and flock.
Message-Id: <9ce30e$dmnh6$1@ID-13368.news.dfncis.de>

<nobull@mail.com> wrote in news:u9u23af6ps.fsf@wcl-l.bham.ac.uk...
>
> If you know you are only going to use a system that does correctly
> implement appending (i.e. not Win32) then you can omit the seek()
> from the above code.
>
How do you know that Win32 doesn't implement appending correctly?

> If you know are only writting code to run on an OS and filesystem
> that does implement append mode correctly (a local filesystem on a
> modern Unix for example), and you keep the file in block-buffered
> mode and you write less than one buffer-full of output between each
> manual flushing of the buffer then each bufferload is almost
> garanteed to be written to the end of the file in one chunk without
> getting intermingled with anyone else's output.
>
The crucial part here is the flushing but the paragraph is probably
too difficult to be understood by newbies. How do you manually flush
in Perl? How do you know if the data for the next output operation
can be placed in the blockbuffer with or without causing a buffer
flush?

The code snippet from the OP had no such kind of test. And it
didn't use autoflush either. So the code has a very high potential to
cause data corruption. But Abigail still claimed that there is no
need to lock in this code because of the opening mode. I don't agree.

If somebody is trying to continuously append datalines to a file by
concurrent processes, (s)he most likely doesn't want to append non
intermingled blocks (bufferloads) but the non intermingled results
from each single output operation. So if (s)he doesn't want to
use flock while concurrently appending to a file, (s)he at least
_MUST_ use autoflushing on the filehandle or use syswrite to output
the data.



------------------------------

Date: Sat, 28 Apr 2001 09:46:25 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Boole's tools (was Things I'm just not getting in Perl)
Message-Id: <m64let8jbtm3nuj82fal6kgj31kvvt0r5f@4ax.com>

Andrew Lee wrote:

>> Andrew Lee (andrew_lee@nospamearthlink.net) wrote on MMDCCXCVI September
>
>Maybe your problem stems from your misuse of Roman Numerals ... either that or I
>posted the refered to article 795 years from now.

The roman numerals are the day of the month. Convert to numbers,
subtract that number of days from your actual posting date, and see what
Sepember that is. It turns out to be 1993, which Abigail seems to
consider "the beginning of the end".

-- 
	Bart.


------------------------------

Date: 28 Apr 2001 09:38:51 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: capture jpg from avi/mpeg file
Message-Id: <9ce33b$o6c$6@uranium.btinternet.com>

ilmbase <ilmbase@zacksmail.com> wrote:
> Hi,
> 
> I am searching for a package that makes it possible to capture a screenshot
> from a avi or mpeg file and saves it as an .jpg file.
> Any help is appreciated !
> 

If there is a Perl module that can do this then it will be available from
CPAN <http://search.cpan.org> - if you are looking for a readymade
program that can do this then you are almost certainly asking in the
wrong place.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


------------------------------

Date: 28 Apr 2001 09:11:22 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: CGI::header is a filehandle?
Message-Id: <9ce1fq$o6c$4@uranium.btinternet.com>

Rudolf Polzer <eins@durchnull.de> wrote:
> Look at the following script:
> 
> 
> #!/usr/bin/perl -w
> 
> use CGI;
> 
> {
>  print "1:\n";
>  print (CGI::header (-type => 'text/html'));
> 
>  print "2:\n";
>  print scalar (CGI::header (-type => 'text/html'));
> }
> 
> use CGI qw/:standard/;
> print "3:\n";
> print (header (-type => 'text/html'));
> print "4:\n";
> print (CGI::header (-type => 'text/html'));
> 
> 
> Do you find the error without executing?
> 
> The problem is: 1. does not work because Perl thinks CGI::header was a 
> file handle. But doesn't CGI.pm define it as a sub?
> 

It surprised me for a second but I dont know why it should have done.
filehandles can have the same names as subroutines everywhere.  The
subroutine name in your first example is in the position that Perl would
expect a filehandle - that is how the lexer sees it while there is a space
between the subroutine name and the left parenthesis of the argument list.
Removing the space there will allow the parser to see what you mean. 

Alternatively you could do:

  print (+CGI::header (-type => 'text/html'));

If you *must* have all those spaces.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


------------------------------

Date: 28 Apr 2001 08:51:51 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Chicago Perl Consultants Needed
Message-Id: <9ce0b7$gno$1@216.155.32.133>

In article <slrn9eji82.sib.dha@panix2.panix.com>,
 dha@panix2.panix.com (David H. Adler) wrote:

 | In article <slrn9ebl8k.qhi.tadmc@tadmc26.august.net>, Tad McClellan wrote:
 | > 
 | > He seems as perceptive as a potato.
 | 
 | Hey!  Don't insult the potatoes that way!
 | 

yeah, we wouldn't want them going around with a chip on their 
shoulders... 

:-)

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


------------------------------

Date: 28 Apr 2001 08:19:09 +0100
From: nobull@mail.com
Subject: Re: dynamic creation of classes?
Message-Id: <u91yqdcx02.fsf@wcl-l.bham.ac.uk>

anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:

>     $class =~ s!::!/!g;  $class .= '.pm';
>     require $class;

I used to recommend this myself, but then I head of .pmc files.

eval "require $class";

I hate eval() as nuch as the nest person but I don't see it's
avoidable here.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: 28 Apr 2001 09:35:58 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: extracting hostname from a url?
Message-Id: <9ce2tu$o6c$5@uranium.btinternet.com>

Logan Shaw <logan@cs.utexas.edu> wrote:
> In article <comdog-007CA4.01432127042001@news.panix.com>,
> brian d foy  <comdog@panix.com> wrote:
>>In article <9cav87$i47$1@charity.cs.utexas.edu>, logan@cs.utexas.edu 
>>(Logan Shaw) wrote:
>>
>>> In article <3AE8CA05.A9B2697C@cs.tamu.edu>,
>>> Neeraj Khandelwal  <neerajk@cs.tamu.edu> wrote:
>>> >hi
>>> >
>>> >I need to extract the hostname from a url. what would be a neat regular
>>> >expression to do this? for example given url
>>
>>> Anyway, one way to do what you're talking about is something like this:
>>> 
>>> 	m<^(http://[^/]+/?)>i
>>
>>why use a regular expression when a URI module exists?
> 
> IMHO, sometimes a module is overkill.  If all you need is to do this
> one thing, then typing "m<^(http://[^/]+/?)>i" is much easier and more
> efficient than installing the URI module on every machine that will
> ever use the script.
> 

Until of course the OP wants to do the same for a gopher: or ldap: URL and
comes back to ask how to do it again.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


------------------------------

Date: 28 Apr 2001 08:01:34 +0100
From: nobull@mail.com
Subject: Re: Finding all elements in an array matching a certian criteria
Message-Id: <u98zklcxtd.fsf@wcl-l.bham.ac.uk>

John W Krahn <krahnj@acm.org> writes:

> nobull@mail.com wrote:
> > 
> > tadmc@augustmail.com (Tad McClellan) writes:
> > 
> > >    my @wanted = grep { /^$pattern/ } @allfiles;
> > 
> > I think you meant:
> > 
> > my @wanted = grep { /^($pattern)_/ } @allfiles;
> 
> I think he meant:
> 
> my @wanted = grep { /^${pattern}_/ } @allfiles;

Why do you think that?

my $pattern = 'foo|bar';
print "I think NoBull was right\n"
  if 'notbar_' =~ /^${pattern}_/;
print "I think NoBull was right\n"
  if 'food_' =~ /^${pattern}_/;

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: 28 Apr 2001 08:13:56 +0100
From: nobull@mail.com
Subject: Re: Finding all elements in an array matching a certian criteria
Message-Id: <u94rv9cx8r.fsf@wcl-l.bham.ac.uk>

tadmc@augustmail.com (Tad McClellan) writes:

> nobull@mail.com <nobull@mail.com> wrote:
> >tadmc@augustmail.com (Tad McClellan) writes:

> >>    my $pattern = join '|', sort {$b cmp $a} keys %systems;
> >
> >sort?  Do you also get paid a bonus for using sort?  
> 
> 
> No. But, since I usually work "by the job", I get paid more
> if my code works even after executing:   $systems{richeson} => 1;

It would work/fail exactly the same without the sort.

> The left-to-right matching of alternatives has cost me a couple
> hours of troubleshooting in the past, so I always guard against
> keys that are prefixes of other keys by ensuring that the longer
> one is leftmost.

Even when, as in this case, your code is not bothered with which
subexpression matched.  Anyhow once you add the missing () and _ to
the pattern match this would cease to be an issue.

> >>    my @wanted = grep { /^$pattern/ } @allfiles;
> >
> >I think you meant:
> >
> >my @wanted = grep { /^($pattern)_/ } @allfiles;
> 
> That's better too.

Because it actually works.

>  Now the sort() is no longer needed.

It never was.  You got exactly the same possibility for false
positives with or without it.
 
> But I think this is probably better yet:
> 
>   my @wanted = grep { /^${pattern}_/ } @allfiles;

No, because that doesn't actually work - see another branch of this
thread.

If you are being pedantic (What? Tad? Pedantic? Never! :-) )

my @wanted = grep { /^(?:$pattern)_/ } @allfiles;

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: Sat, 28 Apr 2001 08:31:21 GMT
From: John W Krahn <krahnj@acm.org>
Subject: Re: Finding all elements in an array matching a certian criteria
Message-Id: <3AEA0A94.6C347434@acm.org>

nobull@mail.com wrote:
> 
> John W Krahn <krahnj@acm.org> writes:
> 
> > nobull@mail.com wrote:
> > >
> > > tadmc@augustmail.com (Tad McClellan) writes:
> > >
> > > >    my @wanted = grep { /^$pattern/ } @allfiles;
> > >
> > > I think you meant:
> > >
> > > my @wanted = grep { /^($pattern)_/ } @allfiles;
> >
> > I think he meant:
> >
> > my @wanted = grep { /^${pattern}_/ } @allfiles;
> 
> Why do you think that?

I called the Psychic Friends Network and they told me he would post that
exact line of Perl code at Fri, 27 Apr 2001 20:32:42 CDT.


John


------------------------------

Date: Sat, 28 Apr 2001 17:16:03 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: First and last element in list loop
Message-Id: <EVtG6.13146$482.66040@newsfeeds.bigpond.com>

Yes, but you haven't defined first() and last().

gtoomey
--------
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:9cd82t$qtc$6@mamenchi.zrz.TU-Berlin.DE...
> According to Ren Maddox  <ren@tivoli.com>:
> > On Sat, 28 Apr 2001, gtoomey@usa.net wrote:
> >
> > > When using the list loop context
> > > for (@list)
> > >   {  .... }
> > >
> > > is there an easy way to test for the first and last element in the
> > > loop.  Something like $_.first or $.last?
> >
> > [snip]
> >
> > > This there an elegant Perl solution for this?
> >
> > As others have already indicated, not really.  But I wonder, what type
> > of situation leads to this need?
>
>     my @animals = qw( birds cats dogs);
>     my $sentence = '';
>     foreach ( @animals ) {
>         if ( first() ) {
>             $sentence .= "There are $_";
>         } elsif ( last() ) {
>             $sentence .= " and $_.";
>         } else {
>             $sentence .= ", $_";
>         }
>     }
>
> This may not be the most idiomatic way to do it, but it's not entirely
> off the track.
>
> Anno




------------------------------

Date: Sat, 28 Apr 2001 07:29:06 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: First and last element in list loop
Message-Id: <x7bsphh48f.fsf@home.sysarch.com>

>>>>> "GJ" == Gwyn Judd <tjla@guvfybir.qlaqaf.bet> writes:

  GJ> "mein Luftkissenfahrzeug ist voll von den Aalen"
  GJ> said Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) in 
  GJ> <9cd06s$qtc$1@mamenchi.zrz.TU-Berlin.DE>:

  >> Maybe one day we will get $# to mean the loop index in foreach.  Then
  >> this will be more convenient.

  GJ> I dunno though, wouldn't this break programs that do stuff like:

  GJ> print "The index of the last item is $#array\n";

he means plain $# as the perl special variable that would track the
index of a foreach loop. it has been bandied about in both p5p and perl6
lists.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


------------------------------

Date: Sat, 28 Apr 2001 17:52:42 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: First and last element in list loop
Message-Id: <_ruG6.13173$482.66304@newsfeeds.bigpond.com>

Uri, this is a little closer still.


for (@a=((1) x 4)) {

 print \$_, " $_\n" ;

 print "first $_\n" if \$_ == \$a[0] ;
 print "last $_\n" if \$_ == \$a[$#a] ;
 }


SCALAR(0x80ca55c) 1
first 1
SCALAR(0x80d0bb4) 1
SCALAR(0x80d0ca4) 1
SCALAR(0x80d0cf8) 1
last 1


gtoomey
---------
"Uri Guttman" <uri@sysarch.com> wrote in message
news:x7eludh947.fsf@home.sysarch.com...
> >>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:
>
>   AS> According to Vinny Murphy  <vmurphy@Cisco.Com>:
>   >> "Gregory Toomey" <gtoomey@usa.net> writes:
>   >>
>   >> > When using the list loop context
>   >> > for (@list)
>   >> >   {  .... }
>   >> >
>   >> > is there an easy way to test for the first and last element in the
loop.
>   >> > Something like $_.first or $.last?
>   >>
>   >> Something like:
>   >>
>   >> my @a = ( "A" .. "Z");
>
>   AS> what about @a = ( 1 ) x 100; ?
>
>   >> for ( @a ) {
>   >> print "first " if $a[0]  eq $_;
>   >> print "last "  if $a[-1] eq $_;
>   >> print "$_\n";
>   >> }
>
>   AS> This is only an option if all enelemets in the list are distinct.
>
> then use refs and it works fine:
>
> @a = ( 1 ) x 4 ;
>
> foreach $a ( @a ) {
>
> print \$a, " $a\n" ;
>
> print "first $a\n" if \$a == \$a[0] ;
> print "last $a\n" if \$a == \$a[$#a] ;
> }
>
>
> SCALAR(0xc3864) 1
> first 1
> SCALAR(0xcdb28) 1
> SCALAR(0xd5040) 1
> SCALAR(0xd5094) 1
> last 1
>
>
> note that comparing refs with == is faster than eq and uses numeric
> compare in recent perls.
>
> uri
>
> --
> Uri Guttman  ---------  uri@sysarch.com  ----------
http://www.sysarch.com
> SYStems ARCHitecture and Stem Development ------
http://www.stemsystems.com
> Learn Advanced Object Oriented Perl from Damian Conway - Boston, July
10-11
> Class and Registration info:
http://www.sysarch.com/perl/OOP_class.html




------------------------------

Date: 28 Apr 2001 08:57:36 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help Me Obi One You're my Only Hope
Message-Id: <9ce0m0$o6c$3@uranium.btinternet.com>

Tuan Ngo <tuan.ngo1@home.com> wrote:
> 
> Sitting at a UNIX (Irix 6.5.8) terminal
> 

Sorry, dont have one of those.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


------------------------------

Date: Sat, 28 Apr 2001 07:57:06 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: help me
Message-Id: <slrn9el1r4.sh.tjla@thislove.dyndns.org>

"mein Luftkissenfahrzeug ist voll von den Aalen"
said Bob Walton (bwalton@rochester.rr.com) in 
<3AEA157A.1C65BD86@rochester.rr.com>:
>RS wrote:
>> I 'm writing counter for my site and I would like to log my guests display
>> settings (resolution).

>perldoc -q increment the counter

I think that the question you answered is not the same question as the
question that was asked. I don't think you can do this in Perl anyway.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Love your enemies: they'll go crazy trying to figure out what you're up
to.


------------------------------

Date: Sat, 28 Apr 2001 17:20:59 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: Image representation of a binary string
Message-Id: <f_tG6.13151$482.66214@newsfeeds.bigpond.com>

Is this a question or a political statement?

gtoomey
---------
"Benjamin Goldberg" <goldbb2@earthlink.net> wrote in message
news:3AE9D8D9.DA92AC79@earthlink.net...
 ...




------------------------------

Date: 28 Apr 2001 08:33:26 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Levels of perl programming
Message-Id: <9cdv8m$gno$0@216.155.32.133>

In article <slrn9ej98t.4av.tadmc@tadmc26.august.net>,
 tadmc@augustmail.com (Tad McClellan) wrote:

 | Samuel Thomas <sthomas@ws5120.nc.fnc.fujitsu.com> wrote:
 | >I feel like and idiot for not being able to find this but
 | >can anyone point me to the document that lists 7 or so 
 | >levels of perl skill and how to tell which one you are?
 | 
 | 
 | "Seven Levels of Perl Mastery":
 | 
 | 
 |    http://larc.ee.nthu.edu.tw/~cfwu/perl/japh.txt
 
I'm a really weird mix of some of these things, and have some of my 
own...  

1. Hasn't had this much *fun* since learning to hack Z-80 assembler into 
my TRS-80 BASIC programs, ala Leo Christopherson, fifteen years ago. :-D

1.a. ok, NOT counting sex.  O :)

2. LOVES CPAN.pm (et.al.), has written a utility script to compare 
installed/current versions of modules, and runs it regularly. Tried 
(futilely) to convince the ISP to use it when their system blew up 
recently and they had to re-install everything. (laughing) :D 

3. occasionally re-writes (ex|s)ample scripts to 'do a little more' or 
'look a little more pretty' or 'to modernize it with new things I've 
learned'.

4. knows the difference between CGI and Perl and takes brutal advantage 
of this, but doesn't use Perl solely for web-based apps.

5. Programs under MacPerl, but all or nearly all programs run 'as is' on 
Unix, and take special pains to see that this is so, on some occasions.

6. uses strict|subs; and -w, always.  

7. thoroughly groks perlref, perldsc, and perllol, and loves it :-)

8. knows that 
    "text $var ", func($string) 
can be faster than 
    "text " . $var . " " . func($string) 
when working with string concatenation/output on occasion.

9. is typeglob-aware but hasn't used them often yet. 

10. is beginning to grok OOPerl, and has the Damian Conway book which 
will remain a constant traveling companion until he DOES grok it, and 
can get to the point where he can start to see how he would actually use 
some of this stuff. is currently awaiting epiphany. Would love to take 
the upcoming course up in Boston but can't afford it. :/

10.a. knows why $var = Method->new; is preferred over $var = new Method;

11. Appreciates the aethetics[1] of the Schwartzian Transform, and the 
Orcish Maneuver, and keeps a sort of 'log' of (aesthetic|interesting) 
methods/snippets of doing things in perl for future reference. 

11.a. I actually had a moment of epiphany scanning the Camel one day, 
and realized just exactly what "sorting on a manufactured key array may 
be faster than using a fancy sort subroutine."[2] meant, and how it 
would apply to a program being currently worked on, wrote the code in my 
head, and tossed it all together in an hour after getting home from the 
restaurant where I was eating and reading the Camel ;-D

12. has started answering questions on clpm. Isn't always right/is 
sometimes unaware of certain things/but is willing to learn about them 
and is using this as a method of doing so more quickly. :j

13. uses regexes, knows how useful they can be, still doesn't grok ALL 
about them yet, and is waiting for the next edition of MRE to come out 
before buying it. ;-)

14. has written a suite of perl scripts to assist in administering a 
modest SQL database of information. 'errror'-checking, etc. ;)

15. Knows about DBI and has written some programs that use it, went 
through special pains to get DBI working under MacPerl even, but isn't 
100% familiar with all of it. yet.

16. pays attention to which books the gurus think are worth owning, has 
some of them already, and keeps notes on the rest for future reference.

17. occasionally writes code in his head while working at the 'other' 
job that's paying the rent, comes home, plugs it in, code works first 
run. Thinks this is neat. ;)

18. Doesn't grok the debugger yet. :/ 

19. knows the difference between local and my, and avoids local wherever 
possible. has occasionally done weird things like: 

    BEGIN {
        @main::globals = qw($huge $list $of @vars %to_share);
    }

    # this takes advantage of the fact that use vars expects list context
    use vars @main::globals, 
             qw($internal_comment1 $stylesheet $namefill $htmlout 
                $textout @htmldata @textdata $cwd);

    package Other; # slip into the package
    use vars @main::globals; 
    # and slide in our 'globals' that get imported to that namespace

    package main; # then slide back out to main again. 

20. Prefers Mail::Mailer or MIME::Lite over Net::SMTP

21. Still occasionally gets bit by run-time vs compile-time. ;) doh!

22. Thinks Perl is elegant despite it's apparent klunkiness and 
occasional kludginess. 

23. Thinks Perl has entelechy.


wonder where I fit in.. ? =:) 

(repeat after me. DO NOT wake up in the middle of the night for no 
apparent reason, decide to stay up, and eat chinese food while reading 
clpm. weird things happen.)

[1] there's a typo on that website ;)
[2]  ('Efficiency' p. 541, 2nd Edition) [i.e. a Schwartizan Transform]

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


------------------------------

Date: Sat, 28 Apr 2001 17:22:52 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Must send lots of emails
Message-Id: <slrn9ekruc.hic.mgjv@martien.heliotrope.home>

On 28 Apr 2001 06:39:53 GMT,
	Scott R. Godin <webmaster@webdragon.unmunge.net> wrote:
> In article <fuegetcqpvtii9n92umfu585427hj8fhfv@4ax.com>,
>  Rob Greenbank <rob@frii.com> wrote:
> 
[snip long bit about email]

> Oy, this is too nice to waste.. and should probably wind up in the FAQ 
> somewhere.

Maybe, but probably not the Perl FAQ. There wasn't anything Perl in that
post, really.

> along with the caveat " ... if you insist on doing this in Perl instead 
> of using something like Listserv, anyway..." :-)

That would be the only Perl bit.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | The gene pool could use a little
Commercial Dynamics Pty. Ltd.   | chlorine.
NSW, Australia                  | 


------------------------------

Date: 28 Apr 2001 09:10:01 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: Must send lots of emails
Message-Id: <9ce1d9$gno$3@216.155.32.133>

In article <slrn9ekruc.hic.mgjv@martien.heliotrope.home>,
 mgjv@tradingpost.com.au (Martien Verbruggen) wrote:

 | [snip long bit about email]
 | 
 | > Oy, this is too nice to waste.. and should probably wind up in the FAQ 
 | > somewhere.
 | 
 | Maybe, but probably not the Perl FAQ. There wasn't anything Perl in that
 | post, really.
 | 
 | > along with the caveat " ... if you insist on doing this in Perl instead 
 | > of using something like Listserv, anyway..." :-)
 | 
 | That would be the only Perl bit.

It seems to get asked often enough anyway that inclusion might be 
warranted if only as a deterrant. :-)

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


------------------------------

Date: 28 Apr 2001 08:52:48 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Parsing an email message from STDIN - Suggestions
Message-Id: <9ce0d0$o6c$1@uranium.btinternet.com>

Brian Seppanen <seppy@chartermi.net> wrote:
> I'm working on a perl 5.6.0 script that will take email headers and
> body, and at this point all I'm trying to do is grab the from, the date,
> and subject.
> 
> while (<STDIN>) {
> my ($from,$originator)=split(/From:/);
> my ($date,$recievetime)=split(/Date:/);
> my ($subject,$command)=split(/Subject:/);
> open (DEBUG,">debug.log") || die "Can't Open File: $!\n";
> print DEBUG "From:\t$originator\n";
> print DEBUG "Time:\t$recievetime\n";
> print DEBUG "Command:\t$command\n";
> close DEBUG;
> }
> 
> This is currently how I try to do it, but it isn't working, and I'm sure
> there is a much better way to do it.  I get the following errors
> currently.
> 
> Use of uninitialized value in concatenation (.) at script.pl line 16,
> <STDIN> line 1.
> Use of uninitialized value in concatenation (.) at script.pl line 17,
> <STDIN> line 1.
> 
> Procmail is piping the email to the perl script as so, which is why it
> is coming from STDIN.
> :0bhc:/my/home/.procmail/lock
> | script.pl
> 
> As is probably obvious I'm not a very experienced perl coder.  I'd
> appreciate any assistance.
> 

You might consider using on of the Mail::* modules available from  CPAN.

A Mail::Internet example that does the same as yours would be :


#!/usr/bin/perl

use strict;
use warnings;

use Mail::Internet;
use Mail::Header;

my $message = Mail::Internet->new(\*STDIN);

my $head = $message->head;

my $originator    = $head->get('From');
my $command       = $head->get('Subject');
my $receivetime   = $head->get('Date');

open(DEBUG,'>debug.log') || die "Can't Open 'debug.log' : $!\n";

print DEBUG <<ELELE;
From:\t$originator
Time:\t$receivetime
Command:\t$command
ELELE


/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


------------------------------

Date: 28 Apr 2001 08:54:48 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: run by click in linux
Message-Id: <9ce0go$o6c$2@uranium.btinternet.com>

Ying Hu <yhu@mail.nih.gov> wrote:
> hi,
> how can I run one perl script by click the icon in Linux. Thanks
> 

I would read the documentation for your window manager.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


------------------------------

Date: Sat, 28 Apr 2001 07:36:22 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Strange string -> num conversion
Message-Id: <slrn9el0k8.sh.tjla@thislove.dyndns.org>

"mein Luftkissenfahrzeug ist voll von den Aalen"
said Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) in 
<9ccibj$gfu$4@mamenchi.zrz.TU-Berlin.DE>:
>According to Jean-Louis Leroy  <jll63@easynet.be>:
>> Why does this:
>> 
>>         perl -e "print '0x12' + 1"
>> 
>> ...print 2.125 ??
>
>It does?  It prints 1 for me.  Probably the output got mixed up
>with your shell prompt.  Use "perl -le" to give it a linefeed.

[gwyn@thislove:~]$ perl -le "print '0x12' + 1"
19

[gwyn@thislove:~]$ perl -v

This is perl, v5.6.0 built for ppc-linux

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
It's raisins that make Post Raisin Bran so raisiny ...


------------------------------

Date: 28 Apr 2001 08:31:55 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Strange string -> num conversion
Message-Id: <9cdv5r$3ms$1@neptunium.btinternet.com>

Shay Harding <sharding@ccbill.com> wrote:
> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> news:9ccr7g$ilk$2@mamenchi.zrz.TU-Berlin.DE...
>> According to Jean-Louis Leroy  <jll63@easynet.be>:
>> > anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
>> >
>> > > Something is fishy.  What Perl version are you using?  On what
>> > > system?
>> >
>> > I found out on a Red Hat 6.2 system that had perl 5.005. I don't have
>> > access to it right now. The examples I posted were made on my home
>> > computer (see below).
>> >
>> > Now if I try this on perl 5.6.0 on NT 4 in a vmware computer, I get
>> > the expected result (i.e. 1).
>> >
>> > And when I try again on my computer at work (SUSe 7) I get 19 (looks
>> > like 0x12 is interpreted as a hex number; makes sense).
>>
> 
> Curious if this isn't more OS dependant? I tried it with the following
> configs:
> 
> RedHat 7 w/ Perl 5.6.0              ===   2.125
> Mandrake 7.2 w/ Perl 5.6.0       ===   2.125
> FreeBSD 3.5 w/ Perl 5.005_03 ===   1
> FreeBSD 4.2 w/ Perl 5.6.0        ===   1
> 
> Seems all the Linux variants treat it the same but the FreeBSD boxes return
> 1?
> 

It is dependent on the numeric conversion functions in your C libraries.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


------------------------------

Date: 28 Apr 2001 09:45:28 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: The most complete C interpreter in the world is available from  SoftIntegration.com
Message-Id: <9ce3fo$o6c$7@uranium.btinternet.com>

" SoftIntegration <announce@softintegration.com>" <announce@softintegration.com> wrote:
> SoftIntegration, Inc. has launched Ch 2.0,
> 

<snip spam>

> Please feel free to redistribute this announcement.
> 

Please feel free to killfile this poster.

/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 788
**************************************


home help back first fref pref prev next nref lref last post