[27918] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9282 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 11 11:06:00 2006

Date: Sun, 11 Jun 2006 08:05:04 -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           Sun, 11 Jun 2006     Volume: 10 Number: 9282

Today's topics:
    Re: I received eBay Star Developer Award <ritaberk2O04 @aol.com>
    Re: I received eBay Star Developer Award <Agent-C-hates-spam@nyc.rr.com>
        memory efficiency - for loop with reverse list <tuser3@gmail.com>
        Writing a "Hello world" HTML page from perl script ? (Thomas Blabb)
    Re: Writing a "Hello world" HTML page from perl script  <abigail@abigail.nl>
    Re: Writing a "Hello world" HTML page from perl script  <dorward@yahoo.com>
    Re: Writing a "Hello world" HTML page from perl script  <jkorpela@cs.tut.fi>
    Re: Writing a "Hello world" HTML page from perl script  <dan@tobias.name>
    Re: Writing a "Hello world" HTML page from perl script  <flavell@physics.gla.ac.uk>
    Re: Writing a "Hello world" HTML page from perl script  dan@tobias.name
    Re: Xah Lee network abuse <max@alcyone.com>
    Re: Xah Lee network abuse <max@alcyone.com>
    Re: Xah Lee network abuse <flippa@flippac.org>
    Re: Xah Lee network abuse <max@alcyone.com>
    Re: Xah Lee network abuse <flippa@flippac.org>
    Re: Xah Lee network abuse <max@alcyone.com>
    Re: Xah Lee network abuse <esmond.not.pitt@not.bigpond.com>
    Re: Xah Lee network abuse <mscottschilling@hotmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 11 Jun 2006 06:36:35 -0400
From: =?iso-8859-1?Q?Rita_=C4_Berkowitz?= <ritaberk2O04 @aol.com>
Subject: Re: I received eBay Star Developer Award
Message-Id: <128nsq2hbgqto4b@news.supernews.com>

pkstore2 wrote:

>> Apparently, I am one of about 8 or so people who received the award
>> this year.
>
> Wow! 8 people from India got an Ebay award. Anything to make the
> experience better! Keep it up.

It would have been awesome if they treated him to some Tandoori chicken. 
Anyway, congrats on the award.  Hopefully they showed you a few tricks to 
get around some of the nuisances these latest "improvements" gave us?







Rita



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

Date: Sun, 11 Jun 2006 08:38:46 -0400
From: Agent_C <Agent-C-hates-spam@nyc.rr.com>
Subject: Re: I received eBay Star Developer Award
Message-Id: <ac3o825h6tdi8kuouj98g0jgmjkvs40v84@4ax.com>

On Sat, 10 Jun 2006 19:32:37 GMT, Ignoramus14786
<ignoramus14786@NOSPAM.14786.invalid> wrote:

>I am at eBay developers conference right now, and they gave me a Star
>Developer Award for writing a Net::eBay perl module. That perl module
>allows developers to send queries to eBay API by making very simple
>perl calls. Useful for website developers or people like me who like
>to ist stuff on ebay without going to their website. 
>
>Apparently, I am one of about 8 or so people who received the award
>this year.
>
>Pictures will be provided after I get back home from conference.
>
>This module is described at my site www.net-ebay.org.


Congratulations! Perhaps you could use your new clout to get the eBay
development team to improve their configuration management and change
control procedures. 

That way we'd have fewer broken, untested web functions to deal with.

A_C


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

Date: 11 Jun 2006 06:28:42 -0700
From: "tuser" <tuser3@gmail.com>
Subject: memory efficiency - for loop with reverse list
Message-Id: <1150032522.472561.176700@h76g2000cwa.googlegroups.com>

I am reading Damian Conways "Perl Best Practices", in chapter 8
(Built-in Functions), paragraph "reversing lists", he discusses coding
a down-iterating for loop:

I quote from the book
===========================
>> instead of writing:
>>  for (my $remaining=$MAX; $remaining>=$MIN; $remaining--) {
 ...

>> write:
>>  for my $remaining (reverse $MIN..$MAX) {
 ...
===========================

I understand the benefits of the second loop and Damian states that the
difference in iteration speed is usually not even noticable.

But I can't find any statement about memory efficiency, so my question
is this:

In the second for-loop (the one with the reverse-function):

would the entire list ($MIN..$MAX) be constructed first, then reversed
and iterated over ?

 ...or...

is there some optimizer which internally would translate the for-loop
into a memory efficient for (my $remaining=$MAX; $remaining>=$MIN;
$remaining--) ?



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

Date: 11 Jun 2006 08:00:43 GMT
From: t.blabb@gmail.com (Thomas Blabb)
Subject: Writing a "Hello world" HTML page from perl script ?
Message-Id: <448bcdaa$0$4501$9b4e6d93@newsread2.arcor-online.net>

Sorry for this question but how do I write a simple "Hello world" HTML page from a
perl script?

In other words if I click in an already existing html page on a link like:

 ...
<a href="/export/home/aaa/cgi-bin/writehello.pl" target="_top">Click on this link</A>
 ...

a html page with the following stuff should be written and displayed in the browser:

<HTML>
<HEAD>
  <TITLE>Test</TITLE>
</HEAD>
<BODY>
Hello World
</BODY>
</HTML>

How should the perl script look like ?

Do I have to change the perl script if I use the domain name instead of the internal path name?

<a href="http://www.mydomain.com/cgi-bin/writehello.pl" target="_top">Click on this link</A>

Tom



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

Date: 11 Jun 2006 09:43:47 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Writing a "Hello world" HTML page from perl script ?
Message-Id: <slrne8npei.n1.abigail@alexandra.abigail.nl>

Thomas Blabb (t.blabb@gmail.com) wrote on MMMMDCLXVII September MCMXCIII
in <URL:news:448bcdaa$0$4501$9b4e6d93@newsread2.arcor-online.net>:
<>  Sorry for this question but how do I write a simple "Hello world" HTML page from a
<>  perl script?

    #!/usr/bin/perl

    use strict;
    use warnings;
    no  warnings 'syntax';

    print <<'--';
    
    Your HTML code goes here.

    --


Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'


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

Date: Sun, 11 Jun 2006 10:46:04 +0100
From: David Dorward <dorward@yahoo.com>
Subject: Re: Writing a "Hello world" HTML page from perl script ?
Message-Id: <e6gotl$32h$1$8300dec7@news.demon.co.uk>

Thomas Blabb wrote:

> Sorry for this question but how do I write a simple "Hello world" HTML
> page from a perl script?

> <a href="/export/home/aaa/cgi-bin/writehello.pl" target="_top">Click on
> this link</A> ...

First thing to note is that something has to execute the Perl script - and
your browser isn't going to do that.

You need to run a webserver and then have the webserver run the script via
CGI (or FastCGI, or Apache::Registry, etc).

It is also possible to write Apache Modules in Perl using mod_perl. The
approach taken for them is somewhat different, I'll leave you to google up
some resources if you want to take that route.

> How should the perl script look like ?

http://search.cpan.org/~lds/CGI.pm-3.20/CGI.pm has examples.

The basics are that the script should output some HTTP headers, at a minimum
the Content-Type header, followed by a blank line, followed by the
document.

Template-Toolkit is a decent choice for producing the actual content. Other
options exist, such as HTML::Template.

> Do I have to change the perl script if I use the domain name instead of
> the internal path name?

As I said earlier, you can't typically persuade a browser to execute a Perl
script on your filesystem. As far as through a webserver it concerned, it
makes no difference if a link to the resource is relative or absolute.

-- 
David Dorward       <http://blog.dorward.me.uk/>   <http://dorward.me.uk/>
                     Home is where the ~/.bashrc is


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

Date: Sun, 11 Jun 2006 15:12:47 +0300
From: "Jukka K. Korpela" <jkorpela@cs.tut.fi>
Subject: Re: Writing a "Hello world" HTML page from perl script ?
Message-Id: <GMTig.1212$pR.1042@reader1.news.jippii.net>

Thomas Blabb <t.blabb@gmail.com> scripsit:

> Sorry for this question but how do I write a simple "Hello world"
> HTML page from a perl script?

It's a good question, but why did you crosspost it to an HTML group too, 
without mentioning that you had set followups?

Using CGI.pm, you would write

use CGI qw(:standard);
print start_html('Test'), p('Hello world'), end_html;

Unfortunately, CGI.pm generates XHTML markup by default. XHTML is not 
suitable for use (as a distribution format) on the WWW now or in the next 
few years. If you do just simple things, you might have your XHTML 
interpreted as good old HTML, though.

CGI.pm might have some switch to generated HTML 4.01, but personally I 
prefer just writing it myself so that I know what I get, as opposite to what 
different versions of CGI.pm on the server might generate this week,

-- 
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/ 



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

Date: 11 Jun 2006 05:52:39 -0700
From: "Dan" <dan@tobias.name>
Subject: Re: Writing a "Hello world" HTML page from perl script ?
Message-Id: <1150030359.194414.233210@g10g2000cwb.googlegroups.com>


Thomas Blabb wrote:
> <a href="/export/home/aaa/cgi-bin/writehello.pl" target="_top">Click on this link</A>

That would only be the proper URL reference if, beneath the HTTP-served
document root of your Web server, the CGI scripts were found in a
subdirectory "export/home/aaa/cgi-bin", which is not a common
situation.  Perhaps that "/export/...." stuff is intended as the full
path from the root of your machine?  That's not what would be used in a
URL, whether it be to a script or a static HTML document.  More likely,
the correct URL relative to your server document root is
"/cgi-bin/writehello.pl".

> a html page with the following stuff should be written and displayed in the browser:

This can be done lots of ways; one would be:

print qq~
<HTML>
<HEAD>
  <TITLE>Test</TITLE>
</HEAD>
<BODY>
Hello World
</BODY>
</HTML>
~;

> Do I have to change the perl script if I use the domain name instead of the internal path name?

The script doesn't know or care what form of URL you used to access it.
 The matter of whether you used a relative or absolute URL is known
only to the browser, as the server itself gets a request with a fully
qualified URL.

-- 
Dan



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

Date: Sun, 11 Jun 2006 14:38:56 +0100
From: "Alan J. Flavell" <flavell@physics.gla.ac.uk>
Subject: Re: Writing a "Hello world" HTML page from perl script ?
Message-Id: <Pine.LNX.4.64.0606111422050.32657@ppepc20.ph.gla.ac.uk>

On Sun, 11 Jun 2006, Jukka K. Korpela wrote:

> CGI.pm might have some switch to generated HTML 4.01,

 ...it does...  http://search.cpan.org/dist/CGI.pm/CGI.pm#PRAGMAS

> but personally I prefer just writing it myself so that I know what I 
> get, as opposite to what different versions of CGI.pm on the server 
> might generate this week,

But that's because *you* know what you are doing.  Most folks who try 
to hand-code - instead of using an appropriate module - succeed in 
getting something wrong in their HTTP and/or their HTML.  Sometimes it 
will be sufficiently wrong that the effects will be obvious, which is 
OK and then they can fix it; but other times the effects are more
insidious, aren't evident to the programmer, and only come to light 
when their script turns out to be an open gateway for spamming or 
other forms of abuse, and their IP is already blacklisted at the 
anti-abuse services.

Furthermore, if things change, or bugs are discovered, the module is 
likely to get updated accordingly, and anyone who is tracking changes 
will get the benefit of the improvements, without having to re-design 
their hand-knitted code.

CGI.pm is not without problems, but I would not choose to recommend 
hand-coding to someone whose level of expertise is not known (well, 
other than for tutorial or experimental reasons).


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

Date: 11 Jun 2006 07:12:16 -0700
From: dan@tobias.name
Subject: Re: Writing a "Hello world" HTML page from perl script ?
Message-Id: <1150035136.151338.255850@y43g2000cwc.googlegroups.com>


Dan wrote:
> This can be done lots of ways; one would be:
>
> print qq~
> <HTML>
> <HEAD>
>   <TITLE>Test</TITLE>
> </HEAD>
> <BODY>
> Hello World
> </BODY>
> </HTML>
> ~;

But of course, as I forgot to note, this must be preceded by sending an
appropriate content-type header:

print "Content-type: text/html; charset=iso-8859-1\n\n"

(end with an extra newline to show that the headers are finished and
the main content begins).

As others have noted, it might be better to use a standard library
module to generate the HTTP and/or HTML, though I'm one of the
curmudgeonly types who is more used to "rolling my own".

-- 
Dan



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

Date: Sun, 11 Jun 2006 00:11:01 -0700
From: Erik Max Francis <max@alcyone.com>
Subject: Re: Xah Lee network abuse
Message-Id: <l-idnbgjgdmVXxbZnZ2dnUVZ_sSdnZ2d@speakeasy.net>

EJP wrote:

> Many states have criminal as well as civil libel. 
> http://en.wikipedia.org/wiki/Slander_and_libel

The idea of using Wikipedia to back up a legal point is rather amusing 
 ... but still, none of the relevant parties involved live in countries 
which have any form of criminal libel.

-- 
Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   To perceive is to suffer.
   -- Aristotle


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

Date: Sun, 11 Jun 2006 00:11:28 -0700
From: Erik Max Francis <max@alcyone.com>
Subject: Re: Xah Lee network abuse
Message-Id: <l-idnbsjgdm_XxbZnZ2dnUVZ_sSdnZ2d@speakeasy.net>

Philippa Cowderoy wrote:

> It is. However, the onus is on the defendant to show that it's true, 
> rather than on the claimant to show that it's false.

That also depends on the jurisdiction.

> I assume the "he" 
> refers to Brandon?

No, I was referring to the person who he was replying to, i.e., you.

-- 
Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   Twenty-four hours a day, three-hundred sixty-five days a year as
   Secretary of Defense, I lived the Cold War. -- Robert S. McNamara


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

Date: Sun, 11 Jun 2006 08:25:54 +0100
From: Philippa Cowderoy <flippa@flippac.org>
Subject: Re: Xah Lee network abuse
Message-Id: <Pine.WNT.4.61.0606110825000.1652@SLINKY>

On Sun, 11 Jun 2006, Erik Max Francis wrote:

> Philippa Cowderoy wrote:
> 
> > It is. However, the onus is on the defendant to show that it's true, rather
> > than on the claimant to show that it's false.
> 
> That also depends on the jurisdiction.
> 

Hrmm, does that one differ in Scotland?

> > I assume the "he" refers to Brandon?
> 
> No, I was referring to the person who he was replying to, i.e., you.
> 

Wrong pronoun, then.

-- 
flippa@flippac.org

Society does not owe people jobs. 
Society owes it to itself to find people jobs.


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

Date: Sun, 11 Jun 2006 00:55:34 -0700
From: Erik Max Francis <max@alcyone.com>
Subject: Re: Xah Lee network abuse
Message-Id: <5smdnb3j67LkURbZnZ2dnUVZ_qydnZ2d@speakeasy.net>

Philippa Cowderoy wrote:

> Hrmm, does that one differ in Scotland?

I don't believe so.

> Wrong pronoun, then.

Well, your comment was challenged, and I offered a reasonable 
interpretation of what you might have meant (which indicated a more 
general point in any case, namely that libel law is not quite as simple 
as the original poster was making it out to be).  If you don't wish to 
defend your position, that's fine, but pointing fingers is kind of weird 
at this stage.

-- 
Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   To perceive is to suffer.
   -- Aristotle


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

Date: Sun, 11 Jun 2006 09:01:54 +0100
From: Philippa Cowderoy <flippa@flippac.org>
Subject: Re: Xah Lee network abuse
Message-Id: <Pine.WNT.4.61.0606110857110.1652@SLINKY>

On Sun, 11 Jun 2006, Erik Max Francis wrote:

> Philippa Cowderoy wrote:
> 
> > Hrmm, does that one differ in Scotland?
> 
> I don't believe so.
> 

My statement was intended in the context of UK law - I have to admit to 
not knowing too much about what's different north of the border beyond the 
infamous verdict though.

> > Wrong pronoun, then.
> 
> Well, your comment was challenged, and I offered a reasonable interpretation
> of what you might have meant (which indicated a more general point in any
> case, namely that libel law is not quite as simple as the original poster was
> making it out to be).  If you don't wish to defend your position, that's fine,
> but pointing fingers is kind of weird at this stage.
> 

I'd still appreciate being referred to as "she" rather than "he" though.

-- 
flippa@flippac.org

'In Ankh-Morpork even the shit have a street to itself...
 Truly this is a land of opportunity.' - Detritus, Men at Arms


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

Date: Sun, 11 Jun 2006 01:12:52 -0700
From: Erik Max Francis <max@alcyone.com>
Subject: Re: Xah Lee network abuse
Message-Id: <Q5ednWpUkecbTRbZnZ2dnUVZ_vadnZ2d@speakeasy.net>

Philippa Cowderoy wrote:

> I'd still appreciate being referred to as "she" rather than "he" though.

Oops, my bad.  Never occurred to me after all these years, which is kind 
of embarrassing, actually :-).

-- 
Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   Isn't jumping of a bridge / Free fallin'
   -- Sandra St. Victor


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

Date: Sun, 11 Jun 2006 10:49:22 GMT
From: EJP <esmond.not.pitt@not.bigpond.com>
Subject: Re: Xah Lee network abuse
Message-Id: <SySig.7406$ap3.7106@news-server.bigpond.net.au>

Erik Max Francis wrote:
> EJP wrote:
> 
>> Many states have criminal as well as civil libel. 
>> http://en.wikipedia.org/wiki/Slander_and_libel
> 
> The idea of using Wikipedia to back up a legal point is rather amusing 
> ... but still, none of the relevant parties involved live in countries 
> which have any form of criminal libel.

OK, OK, just proffered as information, not a conclusive proof. It's the 
*courts* that back up legal points of course, not anything said or found 
here.



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

Date: Sun, 11 Jun 2006 15:04:58 GMT
From: "Mike Schilling" <mscottschilling@hotmail.com>
Subject: Re: Xah Lee network abuse
Message-Id: <uiWig.43582$fb2.29909@newssvr27.news.prodigy.net>


"Erik Max Francis" <max@alcyone.com> wrote in message 
news:qKmdnUvjhOZZKRbZnZ2dnUVZ_r-dnZ2d@speakeasy.net...
> Mike Schilling wrote:
>
>> If I were to write, say, that Tony Blair's tax policy will lead to higher 
>> deficits, I could be convicted of libel?  Even if that's true, it's not a 
>> priori provable.
>
> I think what he was getting at is that, unlike many jurisdictions, writing 
> something factually true is _not_ in and of itself a defense against a 
> libel suit in the UK.
>
> As for the reverse side of the issue, in jurisdictions where it _is_ a 
> defense, if one were to accuse him of being a pedophile but couldn't prove 
> it, that would certainly be an actionable offense.

In the U.S, for instance, you wouldn't have to prove it.  It would be 
sufficent to demonstrate that there's enough evidence supporting it that you 
weren't reckless in writing it. 




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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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