[9388] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2983 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 25 16:07:57 1998

Date: Thu, 25 Jun 98 13:01:40 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 25 Jun 1998     Volume: 8 Number: 2983

Today's topics:
    Re: Perlre needs patch? (was: searching with Perl ?) (John Moreno)
    Re: Perlre needs patch? (was: searching with Perl ?) (Larry Rosler)
    Re: Perlre needs patch? (was: searching with Perl ?) (John Moreno)
    Re: Reference parameters and scripts (Marc Haber)
    Re: regex error <dwinfield@arrissys.com>
    Re: Regexp/Email header problem (John Moreno)
    Re: s/\s//g - causing strange result <*@qz.to>
    Re: Sending mail through another server? (Ford Prefect)
        Strange ommission from perl function list <mgregory@asc.sps.mot.com>
        SybPerl Text/Image routine <wsanchez@tribune.com>
        The return status from system()? <mgregory@asc.sps.mot.com>
        We need a weekly posting regarding 'education' of newbi <mgregory@asc.sps.mot.com>
    Re: What a Crappy World (Mark-Jason Dominus)
    Re: What a Crappy World (T. Ames)
    Re: WIN32::ODBC jhildeb2@my-dejanews.com
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 25 Jun 1998 18:17:09 GMT
From: phenix@interpath.com (John Moreno)
Subject: Re: Perlre needs patch? (was: searching with Perl ?)
Message-Id: <1db6mni.oww9vx1u9e9fkN@roxboro0-061.dyn.interpath.net>

Rob Hutchings <dlaser@ermine.ox.ac.uk> wrote:

> phenix@interpath.com (John Moreno) writes:
> 
> > 
> > F.Quednau <quednauf@nortel.co.uk> wrote:
> > 
> > > Funny enough, the perlre page doesn't seem to explicitly state what g
> > > does, but I think I read between the lines that it is the global match
> > > operator.
> > 
> > You're absolutely right - both about what it does and about it not being
> > mentioned in perlre (at least not in the version I have).
> > 
> 
> The perlre page refers you to perlop to find out about operators,
> so no wonder it doen't mention g!

I quote "This page describes the syntax of regular expressions in Perl.
For a description of how to use regular expressions in matching
operations, plus various examples of the same, see m// and s/// in in
the perlop manpage."

This makes it clear that /syntax/ of regular expressions should be
described in perlre.  It explains /i /m /s and /x - it should do the
same for /g and /o.

-- 
John Moreno


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

Date: Thu, 25 Jun 1998 11:41:09 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perlre needs patch? (was: searching with Perl ?)
Message-Id: <MPG.ffc39a2984329139896d1@nntp.hpl.hp.com>

In article <1db6mni.oww9vx1u9e9fkN@roxboro0-061.dyn.interpath.net>, John 
Moreno <phenix@interpath.com> says...
 ...
> I quote "This page describes the syntax of regular expressions in Perl.
> For a description of how to use regular expressions in matching
> operations, plus various examples of the same, see m// and s/// in in
> the perlop manpage."
> 
> This makes it clear that /syntax/ of regular expressions should be
> described in perlre.  It explains /i /m /s and /x - it should do the
> same for /g and /o.

Perhaps.  But note that i, m, s and x *are* part of the syntax of 
regexes, because they can appear *in* the regex (in the form (?imsx) or 
whatever).  But g and o cannot, so they are treated as operators.

i, m, s and x tell how to parse the regex; g and o tell how to apply it.

But it wouldn't hurt to have *more* documentation rather than less.

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 25 Jun 1998 19:23:12 GMT
From: phenix@interpath.com (John Moreno)
Subject: Re: Perlre needs patch? (was: searching with Perl ?)
Message-Id: <1db6psk.xafy9k2ctomiN@roxboro0-061.dyn.interpath.net>

Larry Rosler <lr@hpl.hp.com> wrote:

> In article <1db6mni.oww9vx1u9e9fkN@roxboro0-061.dyn.interpath.net>, John
> Moreno <phenix@interpath.com> says...
> ...
> > I quote "This page describes the syntax of regular expressions in Perl.
> > For a description of how to use regular expressions in matching
> > operations, plus various examples of the same, see m// and s/// in in
> > the perlop manpage."
> > 
> > This makes it clear that /syntax/ of regular expressions should be
> > described in perlre.  It explains /i /m /s and /x - it should do the
> > same for /g and /o.
> 
> Perhaps.  But note that i, m, s and x *are* part of the syntax of 
> regexes, because they can appear *in* the regex (in the form (?imsx) or
> whatever).  But g and o cannot, so they are treated as operators.
> 
> i, m, s and x tell how to parse the regex; g and o tell how to apply it.

I disagree, but that's not important...

> But it wouldn't hurt to have *more* documentation rather than less.

This is.  And I agree.

-- 
John Moreno


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

Date: Thu, 25 Jun 1998 18:07:03 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Re: Reference parameters and scripts
Message-Id: <6mu3l4$b70$1@nz12.rz.uni-karlsruhe.de>

lr@hpl.hp.com (Larry Rosler) wrote:
>In article <6mt6vt$6t4$8@nz12.rz.uni-karlsruhe.de>, Marc Haber 
><Marc.Haber-usenet@gmx.de> says...
>> I probably need some syntactical sugar to
>> get that to work.
>
>Exactly.  You need to pass a reference to a typeglob:
>
>mytest(\*STDIN, \@ThisArray);
>
>should work fine and pass 'use strict;'.

Thanks Larry!

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29


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

Date: Thu, 25 Jun 1998 15:44:10 -0400
From: David D Winfield <dwinfield@arrissys.com>
Subject: Re: regex error
Message-Id: <3592A88A.727A3258@arrissys.com>

It was pointed out (thanks Jon) that I did not supply an objective.
Correct.
I also forgot the that I modified the script from the original:
	  $Msg =~ /^(+\/\;)/;

I am expecting the string, up to and including, the second ';'
(semicolon).  I forgot to mention that this is running on perl version
5.004_01 on Sun Unix System V. Now for the kicker.  I have an answer.  
	  $Msg =~ /^(.+\/\;)/; does what i need it to do...
	
If you have another one I'd appreciate it. Since, after all 'there's
more than one way to do it!' (can I say that?)

thanks again
Dave

David D Winfield wrote:
> 
> Hi:
> 
> I am having a bit of a problem with this regular expression and it looks
> ok to me.  Surely clearer eyes will prevail.
> 
>  $Msg =~ /^(+\/.\;.)/;
>  where
>  $Msg = 123;MINUS pso.xxxxxxx/stuff/1221/;Another part of the string
> Any sugestions?
> 
> Thanks
> Dave Winfield
> dwinfiel@arrissys.com


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

Date: Thu, 25 Jun 1998 18:53:26 GMT
From: phenix@interpath.com (John Moreno)
Subject: Re: Regexp/Email header problem
Message-Id: <1db6nig.1720fkm1ut56a2N@roxboro0-061.dyn.interpath.net>

H. Wade Minter <hminter@herc.com> wrote:

> Hello,
> 
> I'm trying to strip out email headers in a string, while leaving the
> message intact.  I've tried various regexps, checked both books, RFTM,
> prayed in Incan monkey gods, everything, but the fool thing STILL isn't
> doing right.
> 
> The headers are the standard SMTP headers, starting with "From
> someuser@somewhere....." and ending with the last header, and blank
> line, and the start of the message.
 
-snip-
 
> And here are some of the regexps I've tried with no success:
> * $newmessage =~ s/From .*\n^\n//ms; # Leaves nothing in $newmessage
> * $newmessage =~ s/From .*\n\n//ms; # Leaves EVERYTHING in $newmessage
> * $newmessage =~ s/From .* \n\n//ms; # Ditto
> * $newmessage =~ s/From [\w]+\n\n//ms; # Ditto again
> 
> Any assistance would be appreciated.

You have several problems - first the headers don't necessarily start
with From (in fact they almost always start with Received, but that's
neither here nor there) and secondly you're above regex is looking for
"From " instead of "From: ".  So if you are actually reading a STMP
message you want $newmessage =~ s/(.+?)\n\n(.+)/$2/s; and if you are
reading from a mailbox (as indicated by the presence of the "From ") you
want $newmessage =~ s/^(From .+?)\n\n(.+)/$2/s;  of course this has a
problem in that if you are reading in a mail box this just get's you the
FIRST message w/o header AND the rest of the messages with headers all
in one string.  If you're dealing with a mailbox you'll want something
more along the lines of:

@array = split "\nFrom [^\n]*@.+",$newmessage; # this is isn't perfect,
                                               # but it'll mainly do
$i=1;
foreach $mess (@array) { 
$mess =~ s/(.+?)\n\n(.+)/$2/s;
print "$i -$mess -\n";
$i++;
}  

Which will leave you with a array of just the bodies.

-- 
John Moreno 


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

Date: 25 Jun 1998 19:25:44 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: s/\s//g - causing strange result
Message-Id: <eli$9806251519@qz.little-neck.ny.us>

In comp.lang.perl.misc, Colin Kilburn  <ckilburn@nbnet.nb.ca> wrote:
> So I printed out a little of the dubug to show the
> values being clobbered.
> My comments are marked with <<<<<<<<.
> Why this happens is a mystry to me.

Other people have answered your question, but I don't think they were
very clear about it.

When you use the RE special variables, eg $1, $2, $`, $&, $', $+, etc,
they are *only* gauranteed to be in scope until the next time you
perform a pattern match. This goes for both the m// and s/// forms.
If you need these variables to be persistent longer, copy them into
a different variable.

Elijah
------
try to shy away from $`, $&, and $' though



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

Date: Thu, 25 Jun 1998 18:51:47 GMT
From: fordprefect@nospam.bigfooot.com (Ford Prefect)
Subject: Re: Sending mail through another server?
Message-Id: <35939c29.226489364@news.charm.net>

Geez ... if you only knew how often I hear that. =)

Ford

On Thu, 25 Jun 1998 10:50:46 -0700, lr@hpl.hp.com (Larry Rosler)
wrote:

>In article <35927eb9.218953939@news.charm.net>, Ford Prefect 
><fordprefect@nospam.bigfooot.com> says...
>> Hey gang,
>> 
>> 	I was wondering if someone could point me in the right
>> direction.  I'm looking to send e-mail via a perl script through our
>> SMTP server here.  The box that will be running the script is an NT
>> box and does not have a mail package in it.  The only examples I've
>> seen are ones that have sendmail already on the box.  I did a scan on
>> this group and through 3 different perl books ( don't know if they're
>> that good ) and I haven't seen anything that might kick me off in the
>> right direction.   Any ideas?  
>> 
>> Ford
>> 
>
>The answer is 42. :-)



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

Date: 25 Jun 1998 15:56:59 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Strange ommission from perl function list
Message-Id: <r87m26gfnw.fsf@asc.sps.mot.com>


Have I missed it somewhere, or are there no 'maximum' & 'minimum'
functions in the standard perl distribution?

The number of times I find myself including a function like

sub min 
{
  my($a, $b) = @_;

  return($a < $b ? $a : $b);
} 

is ridiculous!

Martin.


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

Date: Thu, 25 Jun 1998 13:43:50 -0400
From: William Sanchez <wsanchez@tribune.com>
Subject: SybPerl Text/Image routine
Message-Id: <35928C56.CF406611@tribune.com>

Has anyone been succesful with the sybperl image/text routine?
I've tried to insert an image(JPG) into the database using the SybPerl
man page example o but have not been able to acomplish this.

Can someone provide me with a snippet of code where this routine is
being used?

Thank You,
William





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

Date: 25 Jun 1998 12:16:43 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: The return status from system()?
Message-Id: <r8d8bygpv0.fsf_-_@asc.sps.mot.com>


A few days ago I posted a question about the return status from
system() depending on the various things that can happen to the called
program.

There has been some off-line discussion about this, and my conclusion
is that despite what perldoc & Blue Camel say, the only thing you can
safely conclude is that if system() returns a non-zero, then something
'abnormal' happened.  

You can't say *with certainty* anything about whether a core was dumped,
a signal was received or any of those good things that you might want
to know.  

There appear to be counter-examples to all the documentation that I
have read, or examples of where the documentation is misleading at
best.

I think (hope) that the perl gurus are examining this, and there may
be a better answer, but for now this is my experience, for what its worth.

If anyone else can clarify the situation, I would be grateful, since
I'd love my perl program to be able to tell the difference between
either itself or the called program receiving SIGINT during a system()
call and receving an error status from the called program.

Martin.


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

Date: 25 Jun 1998 12:08:45 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: We need a weekly posting regarding 'education' of newbies
Message-Id: <r8emwegq8a.fsf@asc.sps.mot.com>


Gang,

In just one day we have two independent threads of people discussing
this age old issue.

Is there someone out there who can summarise the points (from both
sides) into a posting that can go out - oh - once a week.  misc.kids
has (used to have?) a similar thing for contentious issues there - it
was pretty good.  

Then it would be stated regularly, clearly, that there are people with
a particular attitude to particular questions in this newsgroup and
this is just a fact about the group.  Its also a fact that these
people generally have a lot to offer.  So readers would be advised to
either read their posts and extract what you want, or ignore
them... but stop moaning about a fact that is not going to change...

Martin.




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

Date: 25 Jun 1998 14:02:05 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: What a Crappy World
Message-Id: <6mu3at$lsk$1@monet.op.net>
Keywords: aural inspect truncate win

In article <35914065.5006321@news.tc.umn.edu>,
T. Ames <ames0009@tc.umn.edu> wrote:
>I've noticed (and I'm not the only one) that you use your sigs. as a
>means to further insulting people. 

Nope, it's just the Awesome Power of Dada.

A couple of years ago I started adding a random `keywords' to the
headers of my articles.  It's surprising how much editorial meaning
people can infer from random keywords.



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

Date: Thu, 25 Jun 1998 18:45:10 GMT
From: ames0009@tc.umn.edu (T. Ames)
Subject: Re: What a Crappy World
Message-Id: <359299c1.1437131@news.tc.umn.edu>

On 25 Jun 1998 08:40:21 GMT, abigail@fnx.com (Abigail) wrote:


>
>You're a troll.
>
>
>*plonk*
>>Abigail
>-- 
Funny how every time you disagree with someone you resort to name
calling.  But hey, if you can't match someone's arguments, attack them
personally.

Sorry, some of us don't want to sit at your feet, Euclid.

T. Ames



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

Date: Thu, 25 Jun 1998 19:06:24 GMT
From: jhildeb2@my-dejanews.com
Subject: Re: WIN32::ODBC
Message-Id: <6mu73g$st9$1@nnrp1.dejanews.com>

Good idea.  I'm embarrassed that I didn't think of it myself.

Thanks for your help,

Jim Hildebrand


In article <6mt072$3fa@xpress.inforis.nnov.su>,
  "Michael Sazonov" <msazonov@usa.net> wrote:
>
>
> jhildeb2@my-dejanews.com PI[ET W SOOB]ENII
> <6mrp84$i3h$1@nnrp1.dejanews.com> ...
> >
> >I am using Dave Roth's WIN32::ODBC package with
> ActiveState's build 316 of
> >Perl for WIN32.  The program I am writing opens up multiple
> ODBC connections
> >to an Microsoft SQL server (version 6.0 if that matters).
> In an error
> >situation I would like to be able to close all my open ODBC
> connections
> >before ending the program.  Using the Connection() function
> I can get a list
> >of all the connection numbers of my open connections but
> the Close() function
> >needs to be referenced using an ODBC Connection object
> (e.g. $db->Close()).
> >I can't seem to find a way to translate a connection number
> into a connection
> >object.  Does anyone have any ideas?
>
> Why not to use hash for all connections?
>
> $db = new Win32::ODBC($DSN);
> $cnum = $db->Connection;
> $conn{$cnum} = $db;
> ..
> #On error condition:
> @cnums = $db->GetConnections;
> foreach(@cnums) {
>   $conn{$_}->Close;
> }
>
> Hope this helps.
>
> ===
> Mike, sysadmin
>
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 2983
**************************************

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