[9776] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3369 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 5 16:06:22 1998

Date: Wed, 5 Aug 98 13:00:19 -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           Wed, 5 Aug 1998     Volume: 8 Number: 3369

Today's topics:
    Re: -- Can Multiple ACTIONS be called from one POST? (Steve Linberg)
    Re: -- Can One Perl Script call another one? (Mike Stok)
    Re: And sometimes the FAQ's suck (Greg Bacon)
        Attaching a file to an email with a cgi script chris_wellner@my-dejanews.com
    Re: Attaching a file to an email with a cgi script <rootbeer@teleport.com>
        C extensions <nguyend7@msu.edu>
        CGI.pm and NT garbled GIF uploads <brian@graphicdimensions.com>
    Re: CGI.pm and NT garbled GIF uploads <rootbeer@teleport.com>
    Re: E-mail elektrobank@mailexcite.com
    Re: E-mail <rootbeer@teleport.com>
    Re: hiding user input (Chris Nandor)
    Re: hiding user input (Greg Bacon)
    Re: hiding user input (Michael J Gebis)
    Re: IPC semaphores in Perl under FreeBSD <rootbeer@teleport.com>
    Re: Newbie: Objects (Abigail)
    Re: Perl guru FAR *PLEASE MAKE SURE YOU READ* (Steve Linberg)
    Re: perlfaq - frequently asked questions about Perl (pa <p-fein@uchicago.edu>
    Re: perlfaq - frequently asked questions about Perl (pa <p-fein@uchicago.edu>
    Re: perlfaq - frequently asked questions about Perl (pa (Greg Bacon)
    Re: simple regexp (Steve Linberg)
    Re: simple regexp <rootbeer@teleport.com>
    Re: simple regexp (brian d foy)
    Re: simple regexp <rasan@horizonlive.com>
    Re: simple regexp <rootbeer@teleport.com>
    Re: simple regexp (Craig Berry)
        Teaching Perl <dgris@rand.dimensional.com>
    Re: unravelling (?=...), but what's the frog's motivati (Abigail)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Wed, 05 Aug 1998 15:04:13 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: -- Can Multiple ACTIONS be called from one POST?
Message-Id: <linberg-0508981504130001@projdirc.literacy.upenn.edu>

In article <35C75167.6464@yeahright.net>, Webcruiser
<kamenar@yeahright.net> wrote:

> On a submit, can I call two different cgi scripts from one submit
> action? If so, how?

No.  And please take your CGI questions to
comp.infosystems.www.authoring.cgi.  It's just down the hall.
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: 5 Aug 1998 19:40:09 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: -- Can One Perl Script call another one?
Message-Id: <6qacep$ql1@news-central.tiac.net>

In article <35C75127.F1B@yeahright.net>,
Webcruiser  <kamenar@yeahright.net> wrote:
>I have a cgi script running from a secure server. I need to call a cgi
>script from a different server. How do I do this?

You might consider the LWP modules - the libwww-perl* bundle avaialble on
CPAN, the comprehensive perl archive network.  The documentation for LWP
includes:

DESCRIPTION
       Libwww-perl is a collection of Perl modules which provides
       a simple and consistent programming interface (API) to the
       World-Wide Web.  The main focus of the library is to
       provide classes and functions that allow you to write WWW
       clients, thus libwww-perl said to be a WWW client library.
       The library also contain modules that are of more general
       use.

You can visit CPAN by following a CPAN link at http://www.perl.com

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: 5 Aug 1998 19:27:07 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: And sometimes the FAQ's suck
Message-Id: <6qabmb$2m9$3@info.uah.edu>

In article <6qa4ps$3ft@ws051eng.ictest.delcoelect.com>,
	awdorrin@mail.delcoelect.com (Albert W. Dorrington) writes:
: So if a users misses .085 % of the notes, they don't have any
: business on Usenet - interesting rationale, not very logical, but
: interesting.

The wisdom imparted by n.a.newusers tells new users to seek out these
very special documents.  People who haven't read all the articles in
n.a.newusers have no business posting.  I wish more news admins would
go back to this policy.

Greg


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

Date: Wed, 05 Aug 1998 18:57:40 GMT
From: chris_wellner@my-dejanews.com
Subject: Attaching a file to an email with a cgi script
Message-Id: <6qa9v3$pcd$1@nnrp1.dejanews.com>

There have been a couple questions and answers on this topic but I'm still
having some trouble.  I need to have a script-generated email attach a
document to the email.	Someone suggested MIME::Lite but the documentation
say that's just for GIFs.  Can I attach anything with it?  I doubt it but
maybe that's the case. . .  There was another response about Mail:: but the
documentation on Mail:: says specifically that the only thing it _can't_ do
(of course) is attach a file to an email.  Does anyone have an easy route to
do this through sendmail, preferably, or know which CPAN module might be able
to do this?  I've searched through the CPAN site docs so I'm thinking maybe
I'm out of luck there.	Here's the source code I'm using, so if someone knows
how to do it with sendmail I'll be better off.

Thanks much, because I've been stuck looking around for quite some time to no
avail.

CODE:

## Email response file to the participant
$sendmail="/windows/system/sendmail";
$to="freak\@uiuc.edu";
$subject="Requested Information from Object Enterprises.";

open MAIL, "|$sendmail -t -oi";
print MAIL <<EOMH;
Reply-to: freak\@uiuc.edu
From: freak\@uiuc.edu
To: $email
Subject: $subject

EOMH

print MAIL "Form response data from $name:";
while (($key, $value) = each %data)
	{
    print MAIL "$key       $value\n";
	}

## Here's where I need to grab a file and attach it to
## the email, I presume. . .
## Retrieve requested file and forward to client.
## How do you attach a file?  Not sure.

print MAIL <<EOMF;
<REMOTE HOST>
$ENV{'REMOTE_HOST'}

<REMOTE ADDRESS>
$ENV{'REMOTE_ADDR'}

<USER AGENT>
$ENV{'HTTP_USER_AGENT'}

EOMF
close MAIL;

die;

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Wed, 05 Aug 1998 19:18:27 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Attaching a file to an email with a cgi script
Message-Id: <Pine.GSO.4.02.9808051217140.14291-100000@user2.teleport.com>

On Wed, 5 Aug 1998 chris_wellner@my-dejanews.com wrote:

> Subject: Attaching a file to an email with a cgi script
> 
> There have been a couple questions and answers on this topic but I'm
> still having some trouble.

If you're using the proper commands to run another program from perl, but
the other program doesn't cooperate, then it's the other program's fault.
If you're not using the proper commands, then it's your fault. If you
aren't sure about the proper commands, you should read the program's
documentation. If you've read it and you're still not sure, you should ask
in a newsgroup about the program.

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 5 Aug 1998 19:07:04 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: C extensions
Message-Id: <6qaago$atj$1@msunews.cl.msu.edu>

I'm been messing around with writing C extensions for perl.  My
problem is I want my function to use $_ when there isn't an argument
passed to it.  I can do it in perl, but I'm not sure of the C code to
place in my XS file.

-- 
           Dan Nguyen            | There is only one happiness in
        nguyend7@msu.edu         |   life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 |                   -George Sand



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

Date: Wed, 5 Aug 1998 14:35:19 -0500
From: "Brian Busche" <brian@graphicdimensions.com>
Subject: CGI.pm and NT garbled GIF uploads
Message-Id: <35c8b295.0@news.dls.net>

I have the latest version of CGI.pm running on IIS 4.0 and when I upload a
GIF file it appears to be saved properly (i.e. correct directory, proper
file size, etc.) however, the image appears corrupted when viewed through a
browser.  I can almost recognize the image, but it looks squashed and diced.
Oh yeah, I am using IE 4 to upload the file and view it.

Any ideas?




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

Date: Wed, 05 Aug 1998 19:47:53 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: CGI.pm and NT garbled GIF uploads
Message-Id: <Pine.GSO.4.02.9808051246510.14291-100000@user2.teleport.com>

On Wed, 5 Aug 1998, Brian Busche wrote:

> I have the latest version of CGI.pm running on IIS 4.0 and when I
> upload a GIF file it appears to be saved properly (i.e. correct
> directory, proper file size, etc.) however, the image appears
> corrupted when viewed through a browser.  I can almost recognize the
> image, but it looks squashed and diced. Oh yeah, I am using IE 4 to
> upload the file and view it.

Somewhere along the line, you're doing something wrong. But without seeing
your code, I can only guess. So my guess is "binmode?". Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 05 Aug 1998 15:33:11 -0500
From: elektrobank@mailexcite.com
Subject: Re: E-mail
Message-Id: <elektrobank-0508981533110001@129.10.172.105>

I'd like to actually receive the text in my e-mail messages from a perl script.
> 
> > Is there a way to check an e-mail account from a perl script?
> 
> You mean check if an email address is valid?  No.  See the FAQ.
> If you mean to write a perl script to check your email, yes.  Perhaps. 
> Depending on your OS.  You'll have to write code to talk to your mail
> server.
> _____________________________________________________________________
> Steve Linberg                       National Center on Adult Literacy
> Systems Programmer &c.                     University of Pennsylvania
> linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: Wed, 05 Aug 1998 19:46:38 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: E-mail
Message-Id: <Pine.GSO.4.02.9808051244030.14291-100000@user2.teleport.com>

On Wed, 5 Aug 1998 elektrobank@mailexcite.com wrote:

> I'd like to actually receive the text in my e-mail messages from a
> perl script.

If you mean that you want your script to be run once as each message comes
in, see your mail system's documentation to find out how to do that (and,
in fact, whether it's even possible on your system). If you mean that you
want your program to poll your mail system to see whether there's mail
available, and if so to deal with it, find out what protocol your mail
system uses for doing that and see whether there's a module available on
CPAN to implement that protocol. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 05 Aug 1998 15:06:38 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: hiding user input
Message-Id: <pudge-0508981506380001@192.168.0.3>

In article <35C8674C.B93736CB@interactive.ibm.com>,
johnc@interactive.ibm.com wrote:

# We were told by you directly and some others directly and indirectly that
# the bashing over FAQs would stop when .moderated came around. That was a
# promise from you to us. Why the change of minds now? I hope this doesn't
# come across sarcasticly but as a sincere question.
# 
# [...]
# 
# As I stated before, there is a .moderated group now. If you don't want FAQs
# then that is the place to be. I'm not asking anyone to leave but I am
# asking (not telling) everyone to be a little more patient and
# understanding.

I have never thought this, seen it, or agreed to it.  FAQs are not allowed
here just because there is a moderated group.  FAQs suck in any forum. 
There is never any excuse for routinely asking FAQs of any Usenet group. 
perlfaq is big, and even I and others who know it well occasionally ask a
FAQ, because we forget it is a FAQ.  But if you have time to bother
others, you have time to grep the FAQ.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: 5 Aug 1998 19:17:54 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: hiding user input
Message-Id: <6qab52$2m9$1@info.uah.edu>

In article <35C8674C.B93736CB@interactive.ibm.com>,
	John Call <johnc@interactive.ibm.com> writes:
: We were told by you directly and some others directly and indirectly that
: the bashing over FAQs would stop when .moderated came around. That was a
: promise from you to us. Why the change of minds now? I hope this doesn't
: come across sarcasticly but as a sincere question.

I would certainly never ever make a promise on someone else's behalf.  I
have no more control over anyone who participates here than anyone else
(much though that I wish I did :-).  I offer my most sincere apology if
you thought I was speaking on Abigail's (or anyone else's behalf).  I
can only take responsibility for and make promises about my own
behavior.

You'll witness that I haven't bashed anyone for posting a FAQ here.

: Also, if this isn't a thread about just this group but about newsgroups in
: general then why are we (not just Greg but all of us) having it in here?

Which group would be better?

: My
: answer to that is that I intended the original posts to be about just here.
: The other groups I visit are so much better in atmosphere and I wanted to
: get that kind of attitude in here.

FAQs are irritating to see, especially after people have burned so many
hours working to make them better.  The atmosphere would be much more
pleasant if we weren't so inundated with FAQ traffic.  You say the
atmosphere is nicer elsewhere, but what is a typical ratio of FAQ to
non-FAQ posts in those groups?

: As I stated before, there is a .moderated group now. If you don't want FAQs
: then that is the place to be. I'm not asking anyone to leave but I am
: asking (not telling) everyone to be a little more patient and
: understanding.

The moderated group doesn't replace this group!  Being a *.misc group
makes it the catchall for topics related to Perl that don't quite fit
in the other groups (or topics for which no one can agree on the proper
group).  This group is not obsolete.  This group still needs to be
useful.  FAQ flooding and usefulness are forces in opposing directions.

Greg


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

Date: 5 Aug 1998 19:31:31 GMT
From: gebis@noble.ecn.purdue.edu (Michael J Gebis)
Subject: Re: hiding user input
Message-Id: <6qabuj$l2e@mozo.cc.purdue.edu>

pudge@pobox.com (Chris Nandor) writes:
}I have never thought this, seen it, or agreed to it.  FAQs are not allowed
}here just because there is a moderated group.  FAQs suck in any forum. 
}There is never any excuse for routinely asking FAQs of any Usenet group. 
}perlfaq is big, and even I and others who know it well occasionally ask a
}FAQ, because we forget it is a FAQ.  But if you have time to bother
}others, you have time to grep the FAQ.

I think most people agree with the point: FAQs suck.  

I think that the argument is about: It's ok to insult FAQ askers, or post
reponses that provoke flames, or be generally pedantic about it to the
detrement to all the goodly, non-faq-askin' folk like myself.

After all, nobody complains when FAQs are answered with, "See the faq,
look for 'Exporter'."  It's only when people mix in a personal attack
with their answer that things get out of control.  

I do think that the argument has now digressed from these points.  (Although
I am responding to Chris "Xor" Nandor's message, I don't think he bears
any particular responsiblity for this digression.)

-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: Wed, 05 Aug 1998 18:57:37 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: IPC semaphores in Perl under FreeBSD
Message-Id: <Pine.GSO.4.02.9808051153460.14291-100000@user2.teleport.com>

On 5 Aug 1998, Vladimir I. Kulakov wrote:

> Newsgroups: comp.lang.perl, comp.lang.perl.misc, comp.lang.perl.modules,
>     comp.lang.perl.tk, comp.unix.bsd.freebsd.misc, comp.unix.programmer

That's way excessive! comp.lang.perl doesn't even exist anymore! But if
you must cross-post, please try to set followups, as I've done.

> Trying to use 'semget', 'semctl' and the like syscalls in Perl 5 for
> FreeBSD 2.2.5 I've got the message "IPC system V is not supported
> on this mashine" ;(

> So, I've rebuilded the kernel, turning the "SEMAPHORES" option on,
> but the problem is still the same ;(

When you configure and compile perl, the ./Configure program tries to tell
whether those calls are supported. If it guesses wrong, you can override
it, but you still have to recompile. See the release notes which come with
the perl source. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 5 Aug 1998 19:34:12 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Newbie: Objects
Message-Id: <6qac3k$ipg$1@client3.news.psi.net>

Matt Knecht (hex@voicenet.com) wrote on MDCCC September MCMXCIII in
<URL: news:8l1y1.1328$NJ5.6013659@news2.voicenet.com>:
++ 
++ I've hit a stumbling block pretty early on:
++ 
++ $a = TEST::new('Foo');
++ $b = TEST->new('Foo');
++ $c = new TEST ('Foo');
++ 
++ After looking through perlbot and perlobj (To be honost, I haven't read
++ these as thoroughly as I should.), I'm not sure why I get:
++ 
++ a: Foo
++ b: TEST
++ c: TEST
++ Can't locate object method "test" via package "Foo" at ./tst line 12.
++ 
++ When I comment out the direct notation $a = TEST::new('Foo'); I get the
++ expected results.  Why doesn't the direct notation work?  What's going
++ on?


Because the direct notation is indeed direct. It doesn't magically
insert the object/class as the first argument. So.... if you use

        $a = TEST::new ('Foo')

@_ in TEST::new equals

        ('Foo')

Hence, $a will be an object of class 'Foo'.


In both other notations, the classname will be the first argument of
TEST::new, so @_ will be:

        ('TEST', 'Foo')

and hence, $b and $c will be of class 'TEST'.


And since there isn't a package "Foo", you get the results.




Abigail
-- 
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")\n-> define ("foldoc", "perl")) [0] -> print'


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

Date: Wed, 05 Aug 1998 15:07:14 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Perl guru FAR *PLEASE MAKE SURE YOU READ*
Message-Id: <linberg-0508981507140001@projdirc.literacy.upenn.edu>

Interesting document.  Why don't you sign it so you can take proper
credit?  An editing pass or two, and you may have something here.
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: Wed, 5 Aug 1998 18:53:50 GMT
From: Peter A Fein <p-fein@uchicago.edu>
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <opglnp3uuo1.fsf@harper.uchicago.edu>

Scratchie <upsetter@ziplink.net> writes:

> 
> Peter A Fein <p-fein@uchicago.edu> wrote:
> : WTF was that?!?  Thanks, I've already got my own copy of the man
> : pages.
> 
> In case you're new to Usenet, it is common practice in most groups to post
> the actual FAQ regularly, rather than simply posting a pointer to it. I'd
> say that this will increase the liklihood of newbies seeing (if not
> actually reading)  the FAQ, and is thus a good thing. Anyone who doesn't
> want to see these postings in their own newsreader can easily killfile
> them. 

I'm not, but thanks for the trip back to grade school.  Usually
though, the FAQ is for the newsgroup itself, not the topic of the
newsgroup.  We've already got one such FAQ, posted twice weekly. ;)

-- 
Peter A Fein                                           Summering in SF!
Home: 650-571-6476                                   Work: 650-628-2172
p-fein@uchicago.edu                             pfein@us.checkpoint.com
Gilette's Razor: The best a man can get.


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

Date: Wed, 5 Aug 1998 18:57:52 GMT
From: Peter A Fein <p-fein@uchicago.edu>
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <opgk94nuuhb.fsf@harper.uchicago.edu>

Jonathan Feinberg <jdf@pobox.com> writes:

> 
> Peter A Fein <p-fein@uchicago.edu> writes:
> 
> > WTF was that?!?  Thanks, I've already got my own copy of the man
> > pages.
> 
> Following is an excerpt from a message I received today, thanking me
> for some help I'd provided in this froup.  In my message I'd suggested
> that the asker consult perlfaq6 and perlre.
> 
>    I didn't even realize that perlfaq6 existed until I saw Tom
>    Christiansen's post of it this morning (I knew about the regular
>    documentation and the faq that's on CPAN.)
> 
> Does this answer your question about WTF that was?

I guess it's ok (like I'm some authority or something? Sheesh).  I
would have thought a pointer to those docs (in the form of see 'man
perlfaq') would have been sufficient. But hey if it works, whatever.

-- 
Peter A Fein                                           Summering in SF!
Home: 650-571-6476                                   Work: 650-628-2172
p-fein@uchicago.edu                             pfein@us.checkpoint.com
Gilette's Razor: The best a man can get.


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

Date: 5 Aug 1998 19:23:58 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: perlfaq - frequently asked questions about Perl (part 0 of 9)
Message-Id: <6qabgf$2m9$2@info.uah.edu>

In article <35C8A732.CBF97F95@dead.end.com>,
	no.unsoliciteds@dead.end.com writes:
: Greg Bacon wrote:
: > Such is the cost of catering to the LCD. :-(
:  
: Greg you learned the wrong language, try python it's not used on the web :)

Maybe we should start an all-out anti-Perl FUD war on bugtraq.

Would comp.lang.perl.www and comp.lang.perl.cgi be sufficiently shiny
bait?

Greg


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

Date: Wed, 05 Aug 1998 15:02:37 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: simple regexp
Message-Id: <linberg-0508981502370001@projdirc.literacy.upenn.edu>

In article <35C8AA58.17B573F6@horizonlive.com>, Rasan Rasch
<rasan@horizonlive.com> wrote:

> Can anyone tell me what is wrong with
> 
> @matches = /http.*(com|edu)/g;
> 
> in trying to extract a url from a line?  All I can seem to fill @matches
> with is the subdomain "edu."

See the Camel, 2nd edition, page 70, 4th paragraph.  If you want to
capture output into a list, you have to put what you want in parenthesis.
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: Wed, 05 Aug 1998 19:03:46 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: simple regexp
Message-Id: <Pine.GSO.4.02.9808051158480.14291-100000@user2.teleport.com>

On Wed, 5 Aug 1998, Rasan Rasch wrote:

> Subject: simple regexp

Please check out this helpful information on choosing good subject
lines. It will be a big help to you in making it more likely that your
requests will be answered.

    http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post

> Can anyone tell me what is wrong with
> 
> @matches = /http.*(com|edu)/g;
> 
> in trying to extract a url from a line?  

Well, that's not a very good pattern for matching a URL, but I don't think
that's what you're asking. (Why the /g option? Are you expecting multiple
URLs on the same line? It's possible, but not likely with that pattern.)

> All I can seem to fill @matches with is the subdomain "edu."

Or 'com'? Well, that's what m//g does in a list context. As perlop says:

    In a list context, it returns a list of all the substrings matched by
    all the parentheses in the regular expression.

You may want to recode that to work differently. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Wed, 05 Aug 1998 15:09:12 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: simple regexp
Message-Id: <comdog-ya02408000R0508981509120001@news.panix.com>
Keywords: from just another new york perl hacker

In article <35C8AA58.17B573F6@horizonlive.com>, Rasan Rasch <rasan@horizonlive.com> posted:

>Can anyone tell me what is wrong with
>
>@matches = /http.*(com|edu)/g;
>
>in trying to extract a url from a line?  All I can seem to fill @matches
>with is the subdomain "edu."

that's the only thing that you are capturing though!  (remember what
a global match does in a list context? :)

perhaps you wanted (?:com|edu).

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>


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

Date: Wed, 05 Aug 1998 15:12:06 -0400
From: Rasan Rasch <rasan@horizonlive.com>
Subject: Re: simple regexp
Message-Id: <35C8AE86.1D49D045@horizonlive.com>

I don't think this is the cause of the problem?  The fact that I use the array
@matches already puts the match operator in a list context.  If I have the
statement

@matches = /http.*edu/g;  # it works
@matches = /http.*(com|edu)/g;   # it doesn't work

I seems like it has something to do with the "()"

Steve Linberg wrote:

> In article <35C8AA58.17B573F6@horizonlive.com>, Rasan Rasch
> <rasan@horizonlive.com> wrote:
>
> > Can anyone tell me what is wrong with
> >
> > @matches = /http.*(com|edu)/g;
> >
> > in trying to extract a url from a line?  All I can seem to fill @matches
> > with is the subdomain "edu."
>
> See the Camel, 2nd edition, page 70, 4th paragraph.  If you want to
> capture output into a list, you have to put what you want in parenthesis.
> _____________________________________________________________________
> Steve Linberg                       National Center on Adult Literacy
> Systems Programmer &c.                     University of Pennsylvania
> linberg@literacy.upenn.edu              http://www.literacyonline.org
>



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

Date: Wed, 05 Aug 1998 19:17:02 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: simple regexp
Message-Id: <Pine.GSO.4.02.9808051216040.14291-100000@user2.teleport.com>

On Wed, 5 Aug 1998, Rasan Rasch wrote:

> @matches = /http.*edu/g;  # it works
> @matches = /http.*(com|edu)/g;   # it doesn't work
> 
> I seems like it has something to do with the "()"

Yes, it does. See perlop's entry on m//g. And maybe perlre's entry on
non-memory parens. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 5 Aug 1998 19:46:39 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: simple regexp
Message-Id: <6qacqv$qhf$2@marina.cinenet.net>

Rasan Rasch (rasan@horizonlive.com) wrote:
: I don't think this is the cause of the problem?  The fact that I use the array
: @matches already puts the match operator in a list context.  If I have the
: statement
: 
: @matches = /http.*edu/g;  # it works
: @matches = /http.*(com|edu)/g;   # it doesn't work
: 
: I seems like it has something to do with the "()"

It has everything to do with the ().  Those are capturing parens, and they
make @matches fill with the parts of the string that match inside the
parens, not the entire match (see perlre).  Rewrite that piece at
'(?:com|edu)' (non-capturing parens) and see what happens.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: Wed, 05 Aug 1998 19:51:24 GMT
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: Teaching Perl
Message-Id: <6qacct$4ci$1@rand.dimensional.com>

I have been asked by my boss to teach a one day perl
course to a group of C, C++, and Powerbuilder
developers.  I have never taught anyone Perl before,
though, and would like some input about my classroom
plan.

Since I only have one day, and since none of the people
I will be working with have any knowledge of perl
at all, I am going to try to present a broad overview
of the basics of programming in perl.  I'm currently
planning on presenting the following topics-

1.  Data types
      This will cover scalars, arrays, and hashes (I don't
      think I'll try to explain typeglobs, though).  I
      will also focus on the difference between a list and
      an array.

2.  References
      Since I will be dealing with C and C++ guys I don't
      expect many difficulties explaining perl's equivalent
      of pointers.

3.  Context
      The difference between scalar and list context.  From
      everything I've read about Chip's and Tom's teaching
      experiences this is one of the most important things
      to impart.

4.  Subroutine semantics
      The semantic and syntactic differences between calling
      C<some_sub()> and C<&some_sub()>.  I will also cover
      @_ and the issues to be aware of when passing complex
      datatypes.  I will not cover prototypes.

5.  Where to find more
      I intend to spend some time familiarizing the class
      with where the perl documentation can be found, how
      to search it effectively, and what it contains.  My
      thought is that if I can provide my students with
      the basic knowledge and understanding of the available
      resources I will be doing them a greater favor than
      if I just tried to explain everything about perl 
      in 8 hours.

I am wondering if I am setting myself up for problems with
the above course-plan.  I'd really like to get some input,
especially from people who have taught perl classes before.
In particular, I am afraid that the above topic group
may miss something important.

Regards,
dgris
-- 
Daniel Grisinger           dgris@perrin.dimensional.com
"No kings, no presidents, just a rough consensus and
running code."
                           Dave Clark


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

Date: 5 Aug 1998 19:02:26 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: unravelling (?=...), but what's the frog's motivation?
Message-Id: <6qaa82$iha$1@client3.news.psi.net>

F.Quednau (quednauf@nortel.co.uk) wrote on MDCCC September MCMXCIII in
<URL: news:35C87491.B9F96FD3@nortel.co.uk>:
++ 
++                 What stops the whole thing ever matching the whole
++ sentence for doing a split?


That's explained very clearly in the documentation related to split.




Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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 3369
**************************************

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