[13085] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 495 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 13 00:17:21 1999

Date: Thu, 12 Aug 1999 21:10:13 -0700 (PDT)
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, 12 Aug 1999     Volume: 9 Number: 495

Today's topics:
    Re: Some help needed (Abigail)
    Re: ssi passing params with exec (elephant)
    Re: String Matching html with indents (Abigail)
    Re: Testing (Please disregard) (Abigail)
    Re: Tom Christiansen "Perl Cookbook" (elephant)
    Re: Tom Christiansen "Perl Cookbook" (elephant)
    Re: Vanishing Windows (elephant)
    Re: Why doesn't this Pass by Reference work? (Larry Rosler)
    Re: Why use Perl when we've got Python?! (Abigail)
    Re: Why use Perl when we've got Python?! (Abigail)
    Re: Why use Perl when we've got Python?! (Matthew Bafford)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 12 Aug 1999 22:58:11 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Some help needed
Message-Id: <slrn7r75u0.e7v.abigail@alexandra.delanet.com>

S.Berezin (bsv@mega.kemerovo.su) wrote on MMCLXXI September MCMXCIII in
<URL:news:7or5q0$e2m@jumbo.cyberp.kemerovo.su>:
?? Hello all!
?? I need counter for web pages. It must works without any other programms and
?? providers.


This works for me, and stops when an error occurs.

    {local $_; ++ $_ while print;}


HTH. HAND.


Abigail
-- 
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
                                      print } sub __PACKAGE__ { &
                                      print (     __PACKAGE__)} &
                                                  __PACKAGE__
                                            (                )


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 13 Aug 1999 13:26:27 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: ssi passing params with exec
Message-Id: <MPG.121e3b6e849ec5ee989c1c@news-server>

Paul Alcock writes ..
>Anyone know a solution to this?

yes .. the web server documentation for whatever web server you're using 
and/or the FAQs for the appropriate newsgroup - most likely

  comp.infosystems.www.servers.unix

followup set

-- 
 jason - elephant@squirrelgroup.com -


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

Date: 12 Aug 1999 23:00:43 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: String Matching html with indents
Message-Id: <slrn7r762p.e7v.abigail@alexandra.delanet.com>

Tom Phoenix (rootbeer@redcat.com) wrote on MMCLXXII September MCMXCIII in
<URL:news:Pine.GSO.4.10.9908121054580.7774-100000@user2.teleport.com>:
"" On Thu, 12 Aug 1999, Vox wrote:
"" 
"" > Subject: String Matching html with indents
"" 
"" You can't properly parse HTML with just a simple pattern. Sounds as if you
"" need HTML::Parser, from CPAN. Have fun with it!


You can parse HTML with HTML::Parser? Only if you do lots of work yourself. ;-)



Abigail
-- 
perl -wleprint -eqq-@{[ -eqw+ -eJust -eanother -ePerl -eHacker -e+]}-


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 12 Aug 1999 22:06:58 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Testing (Please disregard)
Message-Id: <slrn7r72u0.e7v.abigail@alexandra.delanet.com>

Chris (chrisl@tourneyland.com) wrote on MMCLXXII September MCMXCIII in
<URL:news:37b06624.5203709@news.swbell.net>:
?? Please disregard this posting


*ploink*


Abigail
-- 
There's no 'test' in comp.lang.perl.misc


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 13 Aug 1999 13:19:34 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Tom Christiansen "Perl Cookbook"
Message-Id: <MPG.121e39d510b2888d989c1a@news-server>

-Sneex- writes ..
>On Date: Thu, 12 Aug 1999 22:24:08 GMT
>support@gethits.com wrote -
>
>> pages 650-3 in "Perl Cookbook" has a recipe 
>> for using the Mail::Mailer module to send email
>> through another machine's mail server.
>
>Hmmm, I don't see that.  Which page is this statement on?

page 652
"
Here's how to use SMTP with the machine mail.myisp.com as the mail 
server:

  $mailer = Mail::Mailer->new( "smtp", "mail.myisp.com");
"

>> Why does the latter work and not the former?
>
>You need to be authenticated to send (relay) mail thru the server in
>question..

you did read the part of the originator's post where they tell you that 
they have it working with

  $mailer = new Mail::Mailer 'smtp', Server => 'gethits.mydomain.com';

didn't you ? .. clearly it has nothing to do with their ability to be 
authenticated .. because they have it working with different syntax

>What Nat & Tom do state, on pg 653, is that WinBlows doesn't normally
>support sending mail from itself, so you have to find a server that is
>-
>
>1)  Configured wrong by the mail admin and allows relaying, or
>2)  Buy a real mail server platform - IE, Unix :)  OR
>3)  Get your upstream provider to allow you to spam the free world...

I suppose we should be grateful that you didn't put quotes around that 
little gem .. the author's meaning on page 653 doesn't come across as 
even closely aligned with your interpretation

"Some ports of Perl (Windows and Mac particularly) don't have sendmail 
or mail to use. In these cases, you should find an SMTP server you can 
send mail through."

which - I assume - most of us have .. and clearly the originator has 
because they were able to get it working with different syntax

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Fri, 13 Aug 1999 13:23:25 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Tom Christiansen "Perl Cookbook"
Message-Id: <MPG.121e3ab6e65cf86e989c1b@news-server>

support@gethits.com writes ..
>$mailer = Mail::Mailer->new("smtp", "gethits.mydomain.com");
-
>$mailer = new Mail::Mailer 'smtp', Server => 'gethits.mydomain.com';
-
>Why does the latter work and not the former?

both methods work for me from both Windows and Linux machines .. there 
should be no difference .. I'm gusesing that you made some other error 
when you originally tried the Cookbook syntax

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Fri, 13 Aug 1999 13:43:39 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: Vanishing Windows
Message-Id: <MPG.121e3f7858987b73989c1f@news-server>

Deane Barker writes ..
>Okay, I downloaded ActivePerl, and installed it.  Smooth as silk.

step one complete

>I wrote the ubiquitous "Hello World!" program (oh yes, I'm on my way...).  I
>have .PL files associated with Windows Explorer, so when I click on the
>icon (what is it -- a lemon?  I can't tell), a window pops up and I just get
>a glimpse of "Hello World!" before it disappears.

this is the expected behaviour .. the Perl applications are NOT window 
applications (well - not without some tickling) .. they run at the 
command line and their output goes to the command line

>I've tried to run programs from the DOS prompt, but no luck.

this is what you're meant to do .. so perhaps you can tell us what "but 
no luck" actually means .. because if you have a program (let's imagine) 
called hello_workd.pl in the directory c:\perl_programs\ then you should 
be able to run it from the command line with

  c:\perl_programs\hello_world.pl

or .. if there are are spaces in the directory or file names (which 
Windows cleverly does by default with the "Program Files" directory) 
then you have to enclose that in double quotes

  "c:\perl_programs\hello_world.pl"

>How do I get the "execute" window to stay up so I can view the results of my
>program?  Is this a Perl thing, or a Windows thing?

you have to open it first .. THEN run the program .. using the "DOS 
Prompt" as explained above .. the reason for this is both a Windows 
thing and a Perl thing .. Perl expects to be run at the command line .. 
and Windows automatically closes windows after running command line 
programs from Windows Explorer

-- 
 jason - elephant@squirrelgroup.com -


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

Date: Thu, 12 Aug 1999 19:12:34 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Why doesn't this Pass by Reference work?
Message-Id: <MPG.121d1eda46048bfc989e4e@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <x7g11o5zuo.fsf@home.sysarch.com> on 12 Aug 1999 19:43:59 -
0400, Uri Guttman <uri@sysarch.com> says...
> >>>>> "PG" == Phil Goetz <goetz@cse.buffalo.edu> writes:
 ...
>   PG>   foreach $i(0 .. $#subcat_array) {
>   PG>     print $subcat_array[$i] . "\n";
>   PG>     if ($subcat_array[$i] eq $element) { return (1); }
> 
> why use indexing? why not just loop over the elements themselves? this
> is c code not perl.
> 
> 	return 1 if $_ eq $element for @subcat_array ;

Sorry, buddy, that's not Perl either.  I'll bet you'll wish you had 
tested it.

On the other hand, the following *is* Perl:

       $_ eq $element and return 1 for @subcat_array ;

Gotcha?

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


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

Date: 12 Aug 1999 21:18:05 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r7029.e7v.abigail@alexandra.delanet.com>

Ian Clarke (I.Clarke@NOSPAM.strs.co.uk) wrote on MMCLXVI September
MCMXCIII in <URL:news:37AAFAD1.A032765B@NOSPAM.strs.co.uk>:
"" I know this sounds like flame-bait, but I am genuinely curious as to
"" what Perl might have to offer that Python doesn't.

Let me answer that in a non-flame-bait way. I read Programming Python
a while ago, and recently I read Learning Python. My opinion was

  "It's a cute language, and if it wasn't for Perl I would probably
   use it. I might even have used it if I knew about Python when I
   started learning Perl. But Python doesn't offer me anything Perl
   doesn't give me, so why use Python?"

I might consider Python if I were to manage a large coding project,
with lots of programmers, many of them medium to low level. But then,
I would also look at Eiffel and Ada, which I would be more likely to pick
than Python. I would also consider Java.

"" I have been using Python for some time now, I have occasionally looked
"" at perl, but was but off by its seemingly counter-intuative, and
"" over-complicated syntax.  I have been searching this newsgroup for a
"" convincing argument as to why someone would use Perl over Python.  I did
"" find some discussions, but the arguments from the Perl side were pretty
"" lame.  For example, one Perl advocate conceeded that Python was a better
"" language, but that people should use Perl because that is what everyone
"" else was using!  This is basically the argument that is always made just
"" before the old is replaced by something better.


I really don't believe in this crap "my language is better than yours".
People are different. Programmers are different. For some programmers,
Perl is the better choice. For others, Python. If you are happy with
Python, by all means, use it. I don't think Perl gives you anything that
Python doesn't give use - except when it comes to certain design issues:
many ways of doing things, dense code, lots of operators/functions.

If you say that Python is easier to learn, I will believe you - that's
my opinion as well. If you think that there are many people coding in
Perl that should code in Python, you are probably right as well. There
are many people coding in Perl that would be better off with C++, Java
or Ada as well.

But does that make Python better than Perl? No. Python is different.
They are useful in the roughly the same domain. I cannot come up with an
area where Perl would be a better choice than Python, or where Python
would be a better choice than Perl. I can imagine many areas where
neither Perl or Python would be a wise choice. Difference is good.
It gives people a choice. Choices give people the opportunity to pick
something that suits them.


Please, don't come with any arguments of the form "Perls syntax is
complicated, hence Python is better". That's an opinion. Yes, it's a fact
that Perls syntax is more complicated than Pythons, but the conclusion
("Python is better") is your opinion. It isn't a fact.




Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 12 Aug 1999 21:55:55 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r7292.e7v.abigail@alexandra.delanet.com>

Bart Lateur (bart.lateur@skynet.be) wrote on MMCLXXII September MCMXCIII
in <URL:news:37b5b272.2670618@news.skynet.be>:
() 
() Regexes in Python are pretty awkward, just like creating Windows
() programs in plain C is.

Huh? Regexes in the current version of Python are identical to regexes
in perl5.004. On purpose. Sure, you can't call them with m// or s///,
but have to use a function instead. That's a bit of a drawback; on the
other hand, it allows them to do things like:

      import re
      matchstr = re.compile (
          r"""\b(red|green)      # Comment
              (\s+               # Comment
               pepper            # Comment
               (?!corn)          # Comment
               (?=.*salad))""",  # Comment
          re.IGNORECASE | re.DOTALL | re.VERBOSE)

instead of /isx. It's more verbose, but certainly cute. And it allows
you to treat regex modifiers as parameters, that you can pass into
functions, modify and inspect. Try doing that in Perl!



Abigail
-- 
perl -we 'print q{print q{print q{print q{print q{print q{print q{print q{print 
               qq{Just Another Perl Hacker\n}}}}}}}}}'    |\
perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w | perl -w


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 13 Aug 1999 03:24:53 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r73bt.16f.*@dragons.duesouth.net>

Abigail:
:                                                         And it allows
: you to treat regex modifiers as parameters, that you can pass into
: functions, modify and inspect. Try doing that in Perl!

#!/usr/bin/perl -lw
use strict;

$/ = "";

while ( <DATA> ) {
    last if /^__END__/;
    chomp;

    my($opts, $re) = split " ", $_, 2;

    print "hello" =~ /^(?$opts)$re$/
        ? "$re Matches" : "$re Doesn't match";
}
__DATA__
i hellO

x he
  ll  # comment
  o

ix hEllo # comment

x hello # even embed a /

__END__

: Abigail

--Matthew


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

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

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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


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