[16086] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3498 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 28 06:10:37 2000

Date: Wed, 28 Jun 2000 03:10:16 -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: <962187015-v9-i3498@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 28 Jun 2000     Volume: 9 Number: 3498

Today's topics:
        pipes <speier@aracnet.com>
        Read out attachment of an Email <thermann@mtgnet.de>
    Re: Read out attachment of an Email <thunderbear@bigfoot.com>
    Re: regex brain teaser <nomail@nomail.com>
        Rookie's question (TSOI_WING_SHING)
        Sending HTML messages, using perl and sendmail <preble@ipass.net>
    Re: Sending HTML messages, using perl and sendmail <vikas@youssef.de>
    Re: Sending HTML messages, using perl and sendmail <Peter.Dintelmann@dresdner-bank.com>
    Re: Simple regular expression question (jason)
    Re: split regex (Charles DeRykus)
    Re: system call for /usr/bin/find without spawning shel (Rafael Garcia-Suarez)
    Re: Teen Volenteers WANTED (Bart Lateur)
        UK Perl Programmers Wanted for Small Jobs <Dupont@netcomuk.co.uk>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 27 Jun 2000 22:32:15 -0700
From: "Guy Speier" <speier@aracnet.com>
Subject: pipes
Message-Id: <x%f65.319$9e.69680@typhoon.aracnet.com>

Hello,

I am trying to open multiple pipes to an external application, so that I can
write to each of them, close the pipe, and have them all run simultaneously.
I would like to close these pipes and exit my script without waiting for
them, but more importantly, I would like them to not run sequentially.

When I look in O'reilly & Associates, under close, I see "Note, however,
that a dup'ed pipe is treated as an ordinary filehandle, and close will not
wait for the child on that filehandle.

How can I "dup" a pipe?  I would love an example / explanation mailed to
mailto:speier.guy@cnf.com

Thank you muchly in advanced!
Guy






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

Date: Wed, 28 Jun 2000 09:34:45 +0200
From: "Thomas Hermann" <thermann@mtgnet.de>
Subject: Read out attachment of an Email
Message-Id: <8jc9p0$2aec$1@wrath.news.nacamar.de>

Hello,
I have to read out the attachment (not the body!!) of an Email
by a Perl Script.
Does anybody knows a good method to do this?

Thanks,

     Thomas




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

Date: Wed, 28 Jun 2000 09:48:29 +0200
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: Read out attachment of an Email
Message-Id: <3959ADCD.6F7DBECF@bigfoot.com>

Thomas Hermann wrote:
> 
> Hello,
> I have to read out the attachment (not the body!!) of an Email
> by a Perl Script.
> Does anybody knows a good method to do this?

MIME::Tools from CPAN.

-- 
  Thorbjørn Ravn Andersen         "...plus...Tubular Bells!"
  http://bigfoot.com/~thunderbear


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

Date: Tue, 27 Jun 2000 22:31:08 -0400
From: "Jonah" <nomail@nomail.com>
Subject: Re: regex brain teaser
Message-Id: <8jbujh$6g8$1@onlink3.onlink.net>

Stephen Kloder <stephenk@cc.gatech.edu> wrote in message
news:395970A0.D822696E@cc.gatech.edu...
> Stephen Kloder wrote:
>
> >
> > m#^((\w+/)*\w+)?$# matches word1/word2/.../wordn, and the null string,
but
> > not word1 or word1//word2
>
> I just reviewed this and realized that this regex does indeed match single
> words.  Change the * to a + if you don't want to match those.
>

This is quite good! It's exactly what I need. It might have helped
if I realized that \w takes into consideration \d too, oh well.
thanks for your help.




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

Date: 28 Jun 2000 05:11:36 GMT
From: wstsoi@ee.cuhk.hk (TSOI_WING_SHING)
Subject: Rookie's question
Message-Id: <8jc1e8$n2p$1@eng-ser1.erg.cuhk.edu.hk>


HI How could I know what modules my Perl have?
And their versions, documents under Unix.

Just liked online document and ppm of ActivePerl.

Thanks very much!!!


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

Date: Wed, 28 Jun 2000 04:47:10 -0400
From: "E. Preble" <preble@ipass.net>
Subject: Sending HTML messages, using perl and sendmail
Message-Id: <zZi65.176$dg2.1884@saturn.ipass.net>

This question could apply to many newsgroups, but since I'm
coding in PERL, I'll post here. Simply put, I want to send
HTML formatted messages through PERL, with sendmail if
possible. How is this done?

Typical, text only, messages can be sent as follows:

open (MAIL, "|$mailprog -t") || print "Can't start mail
program";
print MAIL "To: $address\n";
print MAIL  "From: $Myaddress\n";
print MAIL  "Subject: $subject\n\n";
print MAIL "$message";
close (MAIL);

Is there a way to define a text/html message using perl?

Thanks ahead!

Edward Preble



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

Date: Wed, 28 Jun 2000 11:12:30 +0200
From: Vikas <vikas@youssef.de>
Subject: Re: Sending HTML messages, using perl and sendmail
Message-Id: <3959C17B.6D57AA44@youssef.de>



"E. Preble" wrote:

> This question could apply to many newsgroups, but since I'm
> coding in PERL, I'll post here. Simply put, I want to send
> HTML formatted messages through PERL, with sendmail if
> possible. How is this done?
>
> Typical, text only, messages can be sent as follows:
>
> open (MAIL, "|$mailprog -t") || print "Can't start mail
> program";
> print MAIL "To: $address\n";
> print MAIL  "From: $Myaddress\n";
> print MAIL  "Subject: $subject\n\n";
> print MAIL "$message";
> close (MAIL);
>
> Is there a way to define a text/html message using perl?
>
> Thanks ahead!
>
> Edward Preble

Hello Edward,

i have just get a email that contains html tags. in netscape
you can view the source of the email. Because you are
writing a part of the source, and in that email that i have
recieved contains:
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

 ... before the html-tags. So i think thats why you can your
write in your source like the following ...

open (MAIL, "|$mailprog -t") || print "Can't start mail
program";
print MAIL "To: $address\n";
print MAIL  "From: $Myaddress\n";
print MAIL  "Subject: $subject\n\n";

print MAIL "Content-Type: text/html;\n";
print MAIL "        charset=ß"iso-8859-1\"";
print MAIL "Content-Transfer-Encoding: quoted-printable\n";

print MAIL "$message_html_formated";
close (MAIL);

please let me know if that works.
hope that helped,
Vikas Narula




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

Date: Wed, 28 Jun 2000 11:16:14 +0200
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: Sending HTML messages, using perl and sendmail
Message-Id: <8jcfn8$7pr4@intranews.dresdnerbank.de>

    Hi,

E. Preble schrieb in Nachricht ...
    --snip--
>I want to send
>HTML formatted messages through PERL, with sendmail if
>possible.

    everything is possible with perl ;-)

>Typical, text only, messages can be sent as follows:
>
>open (MAIL, "|$mailprog -t") || print "Can't start mail
>program";
>print MAIL "To: $address\n";
>print MAIL  "From: $Myaddress\n";
>print MAIL  "Subject: $subject\n\n";
>print MAIL "$message";
>close (MAIL);

    Now get a tutorial on smtp & co. (if you are really
    interested in email apps get a copy of David Wood's
    'Programming Internet Email')

>Is there a way to define a text/html message using perl?

    Just send a header line "Content-type: text/html"
    (print MAIL "Content-type: text/html\n";).
    (eventually use the charset attribute) and send html
    content ($message = qq{<html> ... </html>};)

    BTW have you ever thought on having your headers
    in a hash???

    %headers = ( 'From'     => <email>,
                            'To'          => <email>,
                            'Subject'  => <subject,
                            ....
                          );

    and say something like

        print MAIL join "\n", map "$: $headers{$_}\n", keys %headers;
        print "\n\n";

    Best regards,

        Peter Dintelmann





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

Date: Wed, 28 Jun 2000 08:37:43 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Simple regular expression question
Message-Id: <MPG.13c456987a500928989756@news>

Tad McClellan writes ..
>On Tue, 27 Jun 2000 07:55:26 GMT, jason <elephant@squirrelgroup.com> wrote:
>>Kenny Lim writes ..
>>>ie.
>>>
>
>>>(m/{([\w]{8})+\-([\w]{4})+\-([\w]{4})+\-([\w]{4})+\-([\w]{12})}|{([\w]{8})+\
>>>-([\w]{4})+\-([\w]{4})+\-([\w]{4})+\-([\w]{12})}/ig)
>
>>the pipe character (|) is a special character in Perl's regex (and most 
>>regexes) .. so it needs to be escaped
>
>
>And conversely, hyphen is *not* a special character, so you
>shouldn't hide them behind backslashes.

while we're at it - you don't need either modifier .. there are no 
characters in your regex to require insensitivity - and from your data 
you only have one occurrence of the above per line - so there's no need 
to do things globally

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Wed, 28 Jun 2000 04:38:55 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: split regex
Message-Id: <FwuKww.919@news.boeing.com>

In article <FwuG90.6In@news.boeing.com>,
Charles DeRykus <ced@bcstec.ca.boeing.com> wrote:
>In article <8jbf0k$mvn$1@kira.cc.uakron.edu>, Todd W <trw@uakron.edu> wrote:
>>I am trying to figure out how to split on only the last two underscores in
>>my string. Any1 mind helping? Thanks in advance.
>>
>
>my $some_string = ...
>
>my $one  = '(?:[^_]*_?[^_]*$)'; # one other underscore 
>my $none = '(?:[^_]*$)';        # no more underscores
>
>my @split = split( /    _       # split on an underscore  
>                     (?=        # if via lookahead there's  
>                         $one   #    one more underscore 
>                           |    #           or
>                         $none  #    no more underscores
>                     )
>                   /x, $some_string  
>                 );
>

Whoops, don't need the "or":

my $none_or_one = '(?=[^_]*_?[^_]*$';  # same as $one above

my @split = split( /    _              # split on an underscore  
                     (?=               # if via lookahead there's  
                         $none_or_one  # 0 or 1 underscores more
                     )
                    /x, $some_string  
                  );


--
Charles DeRykus


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

Date: Wed, 28 Jun 2000 06:37:03 GMT
From: garcia_suarez@hotmail.com (Rafael Garcia-Suarez)
Subject: Re: system call for /usr/bin/find without spawning shell
Message-Id: <slrn8lj7gb.7gf.garcia_suarez@rafael.kazibao.net>

backtick@my-deja.com wrote in comp.lang.perl.misc:
>I'm new to CGI scripting, and am working on a script that needs to
>call /usr/bin/find with -exec.  I've read in the WWW security faq that
>if I call system with my arguments in a list, instead of one long
>string, it won't spawn a shell, so it won't expand metachars, which is
>obviously good.
>
>So I'm trying to call system with something like this:
>
>system "/usr/bin/find",$currentloc,$archiveloc,'-name','*.html','-
>exec',"egrep -li \"$querystr\" {} \;";

This works for me:

system "/usr/bin/find",$currentloc,$archiveloc,'-name','*.html',
'-exec','egrep', '-li', $querystr, '{}', ';';

You don't need to escape the ';' at the end because no shell is invoked.
By the way, in your original statement, there was _no_ backslash before
the ';' : you didn't double the backslash in a double-quoted string.

The same argument explains why I used directly $querystr and not
"'$querystr'".

Performance tip: you can grab the list of files you want with the
File::Find module, and then execute a single egrep process:
  system '/usr/bin/egrep','-li',$querystr,@list_of_files;
Instead of creating 1 find process and n egrep processes, you will use
only 1 egrep process. But egrep must be able to handle a long
command-line.

-- 
Rafael Garcia-Suarez


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

Date: Wed, 28 Jun 2000 08:29:34 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Teen Volenteers WANTED
Message-Id: <3959b688.258586@news.skynet.be>

Abigail wrote:

>'' They're not languages in the same way red paint is not a language.
>'' They're markup.
>
>
>No, they are not markup, for the same reason Perl variables aren't
>the language.
>
>Hint: HTML and XML aren't just pretty tokens. The different letters
>actually stand for something. Including the L.

So does the "M".

The difference between a "markup language" and a "programming language"
is, mainly, the ability to create loops and conditionals in the latter.

You could consider WMF (Windows Meta File) as a language too: it
contains commands for the display to draw, lines, rectangles etc. But
it's data too, because it's only a literal list of what needs to be
painted. Because there can't be loops in a WMF, it's not a programming
language. IMO.

-- 
	Bart.


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

Date: Wed, 28 Jun 2000 09:43:39 +0100
From: "Robert Dupont" <Dupont@netcomuk.co.uk>
Subject: UK Perl Programmers Wanted for Small Jobs
Message-Id: <8jcdp8$l9j$1@lyonesse.netcom.net.uk>

Please get in touch if you can do this and want to earn some money




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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 3498
**************************************


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