[17821] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5241 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 4 20:16:47 2001

Date: Thu, 4 Jan 2001 17:16:21 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <978657381-v9-i5241@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 4 Jan 2001     Volume: 9 Number: 5241

Today's topics:
        Perl Strange Output <CHRISVAL@bigpond.com.au>
    Re: Perl Strange Output <bwalton@rochester.rr.com>
    Re: Perl Strange Output (Richard Zilavec)
    Re: Perl Strange Output <CHRISVAL@bigpond.com.au>
    Re: Perl Strange Output <samuel@knm-e.se>
    Re: Perl Strange Output <CHRISVAL@bigpond.com.au>
    Re: Perl Strange Output <zenja@home.com>
    Re: Perl Strange Output <CHRISVAL@bigpond.com.au>
        Perl style AskJeeves? <webmaster@1360squadron.co.uk>
    Re: Perl style AskJeeves? (Chris Fedde)
    Re: Perl style AskJeeves? (Abigail)
    Re: Perl style AskJeeves? <webmaster@1360squadron.co.uk>
        perl variable length <rjmagyar@unix.amherst.edu>
    Re: Perl's BigInts/BigFloats <mischief@velma.motion.net>
    Re: Perl's BigInts/BigFloats (Peter J. Acklam)
    Re: Perl's BigInts/BigFloats (Ilya Zakharevich)
    Re: Perl's BigInts/BigFloats <mischief@velma.motion.net>
    Re: Perl's BigInts/BigFloats (Peter J. Acklam)
        Perl, NNTP & Threading <greg@nolle.co.uk>
        perl.com document could be WRONG  <edd@texscene.com>
    Re: perl.com document could be WRONG  (Garry Williams)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 31 Dec 2000 14:56:37 +1100
From: "Chris" <CHRISVAL@bigpond.com.au>
Subject: Perl Strange Output
Message-Id: <sxI36.168324$e5.151304@newsfeeds.bigpond.com>

Hi everyone, got Apache installed and working
at least I think it is: Here's what's happening .....
------------------------------------------------
This is my code in the CGI script called test.pl
------------------------------------------------
#!c:\perl\bin\perl.exe

print "Content-type:text/html\n\n";

print "<html><head><title>Test Page</title></head>\n";
print "<body>\n";
print "<h2>Hello, World!</h2>\n";
print "</body></html>\n";
------------------------------------------------
And below is the output in the browser, where
Hello, World! prints out with no problem at all.
Why do I get the other lines printing out as well
above and below hello world.
------------------------------------------------
#!c:\perl\bin\perl.exe print "Content-type:text/html\n\n"; print "\n"; print
"\n"; print "
Hello, World!
\n"; print "\n";
------------------------------------------------
They are part of  the code, and should not be there
any help greatly appreciated as I'm close to finally
being able to do something.

Thanks Everyone!
Chris Val





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

Date: Sun, 31 Dec 2000 16:22:37 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Perl Strange Output
Message-Id: <3A4F5DB2.68057AD2@rochester.rr.com>

Chris wrote:
> 
> Hi everyone, got Apache installed and working
> at least I think it is: Here's what's happening .....
> ------------------------------------------------
> This is my code in the CGI script called test.pl
> ------------------------------------------------
> #!c:\perl\bin\perl.exe
> 
> print "Content-type:text/html\n\n";
> 
> print "<html><head><title>Test Page</title></head>\n";
> print "<body>\n";
> print "<h2>Hello, World!</h2>\n";
> print "</body></html>\n";
> ------------------------------------------------
> And below is the output in the browser, where
> Hello, World! prints out with no problem at all.
> Why do I get the other lines printing out as well
> above and below hello world.
> ------------------------------------------------
> #!c:\perl\bin\perl.exe print "Content-type:text/html\n\n"; print "\n"; print
> "\n"; print "
> Hello, World!
> \n"; print "\n";
> ------------------------------------------------
> They are part of  the code, and should not be there
> any help greatly appreciated as I'm close to finally
> being able to do something.
> 
> Thanks Everyone!
> Chris Val
You don't have things configured correctly.  The Perl script is being
displayed as a text file, and is not being executed.  You probably need
to add a content-type for Perl to your server.  See your server docs, as
this isn't a Perl problem.
-- 
Bob Walton


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

Date: Sun, 31 Dec 2000 20:44:46 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: Perl Strange Output
Message-Id: <3a4f9a54.516872422@news.tcn.net>

On Sun, 31 Dec 2000 14:56:37 +1100, "Chris" <CHRISVAL@bigpond.com.au>
wrote:

>------------------------------------------------
>And below is the output in the browser, where
>Hello, World! prints out with no problem at all.
>Why do I get the other lines printing out as well
>above and below hello world.
>------------------------------------------------
>#!c:\perl\bin\perl.exe print "Content-type:text/html\n\n"; print "\n"; print
>"\n"; print "
>Hello, World!
>\n"; print "\n";
>------------------------------------------------

You mostlikely need to add this to your apache configuration file, I
think the default is .cgi.  Try renaming the script to end with cgi
instead of pl.

AddHandler cgi-script .pl


--
 Richard Zilavec
 rzilavec@tcn.net


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

Date: Tue, 2 Jan 2001 12:52:19 +1100
From: "Chris" <CHRISVAL@bigpond.com.au>
Subject: Re: Perl Strange Output
Message-Id: <RUk46.169414$e5.155147@newsfeeds.bigpond.com>

Hi Everyone, I got Apache installed and it works on it's own 'OK'.
When I type localhost in the URL it provides me with the
correct server directory and I get the "IT WORKED APACHE PAGE"
Perl is also installed and works properly from the dos prompt, even when
I use [Ping Localhost] from the prompt it works 'OK'.Programs also work.

[CGI SCRIPT'S]
Now I have tried editing the [ httpd.conf and the srm.conf ] Files but still
cannot get Apache to work with perl, all I keep gettig is the source code
returned in the browser window. I have followed a couple of tutorials that
I found very closely on editing these files and it looks straight forward
enough
but when I try to run a script called from the web page the return is only
my
source code. I have even tried accociating the script files to be opened by
Perl
and I have also tried .CGI and .PL extentions, still without luck.
With the file accociations when the script is called I get asked whether I
want
to open this file or run it from it's current location, if I choose to run
it all I get
is the dos window saying (offline mode: enter name=value pairs on standard
input),
if I don't accociate the filename extension with perl.exe all I get is the
source code
returned to the browser window.
If anyone can help me I'm willing to re-install it give it another try [5th
in fact] I need
all the help I can get and thank everyone who has helped me to date.
I am running Windows 98SE, PIII 500MHz, and 2 Partitions C and D Drives.
Thanks Again!
Chris VAl


"Chris" <CHRISVAL@bigpond.com.au> wrote in message
news:sxI36.168324$e5.151304@newsfeeds.bigpond.com...
> Hi everyone, got Apache installed and working
> at least I think it is: Here's what's happening .....
> ------------------------------------------------
> This is my code in the CGI script called test.pl
> ------------------------------------------------
> #!c:\perl\bin\perl.exe
>
> print "Content-type:text/html\n\n";
>
> print "<html><head><title>Test Page</title></head>\n";
> print "<body>\n";
> print "<h2>Hello, World!</h2>\n";
> print "</body></html>\n";
> ------------------------------------------------
> And below is the output in the browser, where
> Hello, World! prints out with no problem at all.
> Why do I get the other lines printing out as well
> above and below hello world.
> ------------------------------------------------
> #!c:\perl\bin\perl.exe print "Content-type:text/html\n\n"; print "\n";
print
> "\n"; print "
> Hello, World!
> \n"; print "\n";
> ------------------------------------------------
> They are part of  the code, and should not be there
> any help greatly appreciated as I'm close to finally
> being able to do something.
>
> Thanks Everyone!
> Chris Val
>
>
>




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

Date: Tue, 2 Jan 2001 16:34:47 +0100
From: "Samuel Rydén" <samuel@knm-e.se>
Subject: Re: Perl Strange Output
Message-Id: <Rzm46.483$Wo1.1150@nntpserver.swip.net>

*snip*
> [CGI SCRIPT'S]
> Now I have tried editing the [ httpd.conf and the srm.conf ] Files but
still
> cannot get Apache to work with perl, all I keep gettig is the source code

Richard gave you a very good pointer that you should have considered before
reposting your question.
As previously stated, the "Addhandler .cgi *" line you manually had to
uncomment in one of your apache .conf files is what's being wrong here.
Either rename your .pl files to .cgi, or copy the Addhandler line and place
another one under it, changing only ".cgi" to ".pl".
The latter way enables you to run scripts with both the .cgi and the .pl
extension.

Additionally, you should set Options +ExecCGI to your cgi-bin library (also
in the conf files, or if you choose allow override and provide it in a
 .htaccess file for your cgi-bin library), but this should have been well
covered by the tutorials.
Give it another try. Open all your conf files again, read them through and
see what you can do. The comments are *very* informative and there may be a
line somewhere that has intentionally been commented for you to uncomment
yourself. And I too suspect this Addhandler (or Add-handler) to be the issue
in question.


> returned in the browser window. I have followed a couple of tutorials that
> I found very closely on editing these files and it looks straight forward
> enough [...]

*snip*

regards,


- Samuel




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

Date: Tue, 2 Jan 2001 14:44:11 +1100
From: "Chris" <CHRISVAL@bigpond.com.au>
Subject: Re: Perl Strange Output
Message-Id: <Jxm46.169437$e5.155021@newsfeeds.bigpond.com>

Thyank's for the reply Samuel,
I just want to confirm
that I have tried editing all the those lined in the httpd.conf
file that you and Richard speek of that's why I re-posted
I am at a total loss.

Chris Val



"Samuel Rydén" <samuel@knm-e.se> wrote in message
news:Rzm46.483$Wo1.1150@nntpserver.swip.net...
> *snip*
> > [CGI SCRIPT'S]
> > Now I have tried editing the [ httpd.conf and the srm.conf ] Files but
> still
> > cannot get Apache to work with perl, all I keep gettig is the source
code
>
> Richard gave you a very good pointer that you should have considered
before
> reposting your question.
> As previously stated, the "Addhandler .cgi *" line you manually had to
> uncomment in one of your apache .conf files is what's being wrong here.
> Either rename your .pl files to .cgi, or copy the Addhandler line and
place
> another one under it, changing only ".cgi" to ".pl".
> The latter way enables you to run scripts with both the .cgi and the .pl
> extension.
>
> Additionally, you should set Options +ExecCGI to your cgi-bin library
(also
> in the conf files, or if you choose allow override and provide it in a
> .htaccess file for your cgi-bin library), but this should have been well
> covered by the tutorials.
> Give it another try. Open all your conf files again, read them through and
> see what you can do. The comments are *very* informative and there may be
a
> line somewhere that has intentionally been commented for you to uncomment
> yourself. And I too suspect this Addhandler (or Add-handler) to be the
issue
> in question.
>
>
> > returned in the browser window. I have followed a couple of tutorials
that
> > I found very closely on editing these files and it looks straight
forward
> > enough [...]
>
> *snip*
>
> regards,
>
>
> - Samuel
>
>




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

Date: Wed, 03 Jan 2001 05:17:54 GMT
From: "Zenja Ivkovic" <zenja@home.com>
Subject: Re: Perl Strange Output
Message-Id: <6Cy46.22383$IE2.1122814@news1.sshe1.sk.home.com>

I've noticed that in both you examples you have:
print "Content-type:text/html\n\n";
It needs to read exactly "Content-type: text/html\n\n".  You forgot the
space in between the : and the text/html.  This may have just been an error
in your posting but it just might be your solution.


Chris <CHRISVAL@bigpond.com.au> wrote in message
news:Jxm46.169437$e5.155021@newsfeeds.bigpond.com...
> Thyank's for the reply Samuel,
> I just want to confirm
> that I have tried editing all the those lined in the httpd.conf
> file that you and Richard speek of that's why I re-posted
> I am at a total loss.
>
> Chris Val
>
>
>
> "Samuel Rydén" <samuel@knm-e.se> wrote in message
> news:Rzm46.483$Wo1.1150@nntpserver.swip.net...
> > *snip*
> > > [CGI SCRIPT'S]
> > > Now I have tried editing the [ httpd.conf and the srm.conf ] Files but
> > still
> > > cannot get Apache to work with perl, all I keep gettig is the source
> code
> >
> > Richard gave you a very good pointer that you should have considered
> before
> > reposting your question.
> > As previously stated, the "Addhandler .cgi *" line you manually had to
> > uncomment in one of your apache .conf files is what's being wrong here.
> > Either rename your .pl files to .cgi, or copy the Addhandler line and
> place
> > another one under it, changing only ".cgi" to ".pl".
> > The latter way enables you to run scripts with both the .cgi and the .pl
> > extension.
> >
> > Additionally, you should set Options +ExecCGI to your cgi-bin library
> (also
> > in the conf files, or if you choose allow override and provide it in a
> > .htaccess file for your cgi-bin library), but this should have been well
> > covered by the tutorials.
> > Give it another try. Open all your conf files again, read them through
and
> > see what you can do. The comments are *very* informative and there may
be
> a
> > line somewhere that has intentionally been commented for you to
uncomment
> > yourself. And I too suspect this Addhandler (or Add-handler) to be the
> issue
> > in question.
> >
> >
> > > returned in the browser window. I have followed a couple of tutorials
> that
> > > I found very closely on editing these files and it looks straight
> forward
> > > enough [...]
> >
> > *snip*
> >
> > regards,
> >
> >
> > - Samuel
> >
> >
>
>




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

Date: Wed, 3 Jan 2001 10:58:22 +1100
From: "Chris" <CHRISVAL@bigpond.com.au>
Subject: Re: Perl Strange Output
Message-Id: <ZjE46.169994$e5.157651@newsfeeds.bigpond.com>

Thank's to everyone who helped. I finaly
got it working. I downloaded the latest
version's of Perl and Apache and installed them
edited the httpd.conf file and all is well.

Thak's again to all that posted to help me out
now I can finaly start writing and testing script's.

Chris Val





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

Date: Mon, 1 Jan 2001 17:52:26 -0000
From: "Terence Cooling" <webmaster@1360squadron.co.uk>
Subject: Perl style AskJeeves?
Message-Id: <ar346.28043$Yy.631095@news2-win.server.ntlworld.com>

Hi,
I'm a bit of a newbie but have a small knowledge of perl. I have set up and
understand other search engines but was wondering if it is possible to
customise a perl search engine to recorgnise a question from a database of
questions then suggest a file with a possible answer, as well as normal
serach functions??
If anyone does have any ideas if would most appreciate it - tez@post.com

Cheers
Tez





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

Date: Tue, 02 Jan 2001 00:31:31 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Perl style AskJeeves?
Message-Id: <Dj946.566$B9.170601984@news.frii.net>

In article <ar346.28043$Yy.631095@news2-win.server.ntlworld.com>,
Terence Cooling <webmaster@1360squadron.co.uk> wrote:
>Hi,
>I'm a bit of a newbie but have a small knowledge of perl. I have set up and
>understand other search engines but was wondering if it is possible to
>customise a perl search engine to recorgnise a question from a database of
>questions then suggest a file with a possible answer, as well as normal
>serach functions??
>If anyone does have any ideas if would most appreciate it - tez@post.com
>

IIRC most "natural language processors" for typed text questions perform no
better than keyword searching with "noise" word removal. 
-- 
    This space intentionally left blank


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

Date: 3 Jan 2001 15:16:38 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Perl style AskJeeves?
Message-Id: <slrn956gim.f94.abigail@tsathoggua.rlyeh.net>

Terence Cooling (webmaster@1360squadron.co.uk) wrote on MMDCLXXX
September MCMXCIII in <URL:news:ar346.28043$Yy.631095@news2-win.server.ntlworld.com>:
:) Hi,
:) I'm a bit of a newbie but have a small knowledge of perl. I have set up and
:) understand other search engines but was wondering if it is possible to
:) customise a perl search engine to recorgnise a question from a database of
:) questions then suggest a file with a possible answer, as well as normal
:) serach functions??

Well, yes. 

Do you have a real question too?


Abigail
-- 
# Perl 5.6.0 broke this.
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


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

Date: Wed, 3 Jan 2001 20:54:22 -0000
From: "Terence Cooling" <webmaster@1360squadron.co.uk>
Subject: Re: Perl style AskJeeves?
Message-Id: <LhM46.34949$Yy.809281@news2-win.server.ntlworld.com>

> Well, yes.
>
> Do you have a real question too?

Yes - Examples? Where to find? clues on how to acheive it?

Tez

"Abigail" <abigail@foad.org> wrote in message
news:slrn956gim.f94.abigail@tsathoggua.rlyeh.net...
> Terence Cooling (webmaster@1360squadron.co.uk) wrote on MMDCLXXX
> September MCMXCIII in
<URL:news:ar346.28043$Yy.631095@news2-win.server.ntlworld.com>:
> :) Hi,
> :) I'm a bit of a newbie but have a small knowledge of perl. I have set up
and
> :) understand other search engines but was wondering if it is possible to
> :) customise a perl search engine to recorgnise a question from a database
of
> :) questions then suggest a file with a possible answer, as well as normal
> :) serach functions??
>

>
>
> Abigail
> --
> # Perl 5.6.0 broke this.
>
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)(
(.)
> (.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of
Hanoi




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

Date: Fri, 29 Dec 2000 19:32:34 GMT
From: RUDOLPH JOHN MAGYAR  <rjmagyar@unix.amherst.edu>
Subject: perl variable length
Message-Id: <3a4ce839$1@amhnt2.amherst.edu>



-- 
Rudolph J. Magyar
rjmagyar@amhux4.amherst.edu
Web Address: www.amherst.edu/~rjmagyar


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

Date: Fri, 29 Dec 2000 17:26:21 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Perl's BigInts/BigFloats
Message-Id: <t4pi9t7h9phb69@corp.supernews.com>

Peter J. Acklam <jacklam@math.uio.no> wrote:
> Speaking of big numbers -- why does this happen:

>     perl -we "$a = 1e9999; print $a/$a"
>     -1.#IND

>     perl -we "print 1e9999/1e9999"
>     -2147483648

> I assume the former quotient is computed at run-time and the
> latter at compile time.  Still, I shouldn't get different results,
> I think?

Here's a hint:

    2147483648 = ( 2 ** 31)

    You happen to be working on a 32-bit machine.

    Perl uses the native representation of numbers on the machine
    most of the time.

    print() has slightly different data to work with in the instance
    of printing an expression with variables and printing a constant
    expression. Why it is this much different would be a question
    for someone wi more knowledge of the core than I.


> (perl v5.6.0 built for MSWin32-x86-multi-thread, ActiveState build 613)



Chris

-- 
Christopher E. Stith

Disclaimer: Actual product may not resemble picuture in ad in any way.



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

Date: 29 Dec 2000 20:38:02 +0100
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: Perl's BigInts/BigFloats
Message-Id: <wk4rznow6d.fsf@math.uio.no>

Peter J. Acklam <jacklam@math.uio.no> wrote:

> Speaking of big numbers -- why does this happen:

>     perl -we "$a = 1e9999; print $a/$a"
>     -1.#IND

>     perl -we "print 1e9999/1e9999"
>     -2147483648

Chris Stith <mischief@velma.motion.net> writes:

> print() has slightly different data to work with in the instance
> of printing an expression with variables and printing a constant
> expression. Why it is this much different would be a question
> for someone wi more knowledge of the core than I.

I don't think print() is guilty for what happens.  The following

    #!perl -w

    use strict;
    my $foo = 1e9999/1e9999;        # compile time

    my $num = 1e9999;
    my $bar = $num/$num;            # run time

    print $foo, "\n";
    print $bar, "\n";

prints

    -2147483648
    -1.#IND

So it seems that `1e9999/1e9999' evaluates to different values
depending on whether it is evalutated at compile time or run time.

Peter

-- 
$\="\n";$_='The quick brown fox jumps over the lazy dog';print +(split
//)[20,5,24,31,3,36,14,12,31,1,2,11,9,23,33,29,35,15,32,36,7,8,28,29];


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

Date: 29 Dec 2000 21:00:34 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl's BigInts/BigFloats
Message-Id: <92iu1i$5ij$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Peter J. Acklam
<jacklam@math.uio.no>],
who wrote in article <wkelyrmkeo.fsf@math.uio.no>:
>     perl -we "$a = 1e9999; print $a/$a"
>     -1.#IND
> 
>     perl -we "print 1e9999/1e9999"
>     -2147483648
> 
> I assume the former quotient is computed at run-time and the
> latter at compile time.  Still, I shouldn't get different results,
> I think?

What happens with 

  print int $a/$a

?  If it prints -2147483648, then it may be a bug in a compile-time
detection of integer constants.  If not, it is a bug in a different
place.  Please report to perlbug anyway.

Ilya


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

Date: Fri, 29 Dec 2000 21:19:20 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Perl's BigInts/BigFloats
Message-Id: <t4pvuof1j7b2d6@corp.supernews.com>

Peter J. Acklam <jacklam@math.uio.no> wrote:
> Peter J. Acklam <jacklam@math.uio.no> wrote:

>> Speaking of big numbers -- why does this happen:

>>     perl -we "$a = 1e9999; print $a/$a"
>>     -1.#IND

>>     perl -we "print 1e9999/1e9999"
>>     -2147483648

> Chris Stith <mischief@velma.motion.net> writes:

>> print() has slightly different data to work with in the instance
>> of printing an expression with variables and printing a constant
>> expression. Why it is this much different would be a question
>> for someone wi more knowledge of the core than I.

> I don't think print() is guilty for what happens.  The following

Hence why I said it has different data to work with. Garbage In,
Garbage Out. It can't print the same thing with two different
values for input. printf() can do some rounding on floating point
values, but that's another issue entirely.

[snip]

> So it seems that `1e9999/1e9999' evaluates to different values
> depending on whether it is evalutated at compile time or run time.

True. Pay attention to Ilya. Ilya knows much better than I.

Chris


-- 
Christopher E. Stith

Disclaimer: Actual product may not resemble picuture in ad in any way.



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

Date: 29 Dec 2000 23:15:37 +0100
From: jacklam@math.uio.no (Peter J. Acklam)
Subject: Re: Perl's BigInts/BigFloats
Message-Id: <wk66k2naba.fsf@math.uio.no>

ilya@math.ohio-state.edu (Ilya Zakharevich) writes:

> What happens with 
> 
>   print int $a/$a
> 
> ? If it prints -2147483648, then it may be a bug in a compile-
> time detection of integer constants. If not, it is a bug in a
> different place.

Huh...it does...

    perl -we "$a = 1e9999; print $a/$a"
    -1.#IND

    perl -we "$a = 1e9999; print int $a/$a"
    -2147483648

> Please report to perlbug anyway.

I will.

Peter

-- 
$\="\n";$_='The quick brown fox jumps over the lazy dog';print +(split
//)[20,5,24,31,3,36,14,12,31,1,2,11,9,23,33,29,35,15,32,36,7,8,28,29];


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

Date: Thu, 4 Jan 2001 15:31:39 -0000
From: "Greg Nolle" <greg@nolle.co.uk>
Subject: Perl, NNTP & Threading
Message-Id: <978622082.18097.0.nnrp-09.3e31cb62@news.demon.co.uk>

Dear all,

After spending two days trying to come up with a decent solution to my
problem, I'm on the verge of giving up but I thought that I'd post here to
see if anyone else can give me a hand or push me in the right direction...

I'm trying to write a NNTP client in Perl using the Net::NNTP module. Now, I
have no problems using the module and I know how I'm going to code the
various features that I want to include, except the threaded article
listings. I know that I have to use the References line and after some work
I got a very simple algorithm that threaded messages providing that messages
didn't have more than one reply. That's obviously not the most practical
solution so I hunted around for other scripts that might give me some ideas.
I found none in Perl and the odd few I found in PHP were no help (I don't
really know PHP). The best thing I found was Jamie Zawinski's article on
message threading (http://www.jwz.org/doc/threading.html) where he described
a suitable algorithm. However, it made me even more confused and I haven't
the foggiest idea how to implement it.

So...can anyone help me with either examples of how to use the algorithm,
perhaps a module/library that will do it for me or even a Perl script that
does what I want?

Thanks in advance,

Greg Nolle.




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

Date: Tue, 2 Jan 2001 15:48:36 -0000
From: "Edd" <edd@texscene.com>
Subject: perl.com document could be WRONG 
Message-Id: <3a51f622@news-uk.onetel.net.uk>



Many thanks to Gary T. Williams for pointing out my obvious error
to do with my DBI code related to statement handle.

However if this is the case (and certainly it is!), then there is a
mistake in the DBI document which I copied from.
This document is from www.perlfaq/faqs/id/197.

The line they published there as below must be wrong.

my $sth = $dbh->do(qq{SELECT...

And they should be informed. I haven't done this because
I don't feel knowledgeable enough to make such a claim.

Having settled this issue, I now have a stranger problem.
With code changes accordingly, I get no
error messages but this time, the program doesn't print to
the browser but prints to the command line on the server.
All I get is "Content-type: text/html\n" printed at
the shell command line while I am on an SSH2 connection to the server.
It is a unix server. On the browser,
the web page comes out as not found.

What could be the reason for this. Is this to do with the server
configuration?
But my other cgi codes worked OK before. Is this DBI related?

---------The code is below ---------------------------------------

#!/usr/bin/perl -w

use DBI;
use strict;
use diagnostics;
print "Content-type: text/html\n"; # this line gets printed
my $string = "dbi:mysql:db1";
my $database = 'db1';
my $user = 'user1';
my $password = 'pass1';
my $dbh = DBI->connect($string,$user,$password);
my $sth = $dbh->prepare("SELECT name , owner FROM pet WHERE sex=?");
$sth->execute (my $sex);
while (my @row = $sth->fetchrow_array) {

#The below two lines don't get printed.
print "Check if this prints";
print "@row\n";
}
$dbh->disconnect;







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

Date: Tue, 02 Jan 2001 19:37:50 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: perl.com document could be WRONG 
Message-Id: <i6q46.876$Dm5.28334@eagle.america.net>

On Tue, 2 Jan 2001 15:48:36 -0000, Edd <edd@texscene.com> wrote:
[snip]
>With code changes accordingly, I get no
>error messages but this time, the program doesn't print to
>the browser but prints to the command line on the server.
[snip]
>What could be the reason for this. Is this to do with the server
>configuration?
>But my other cgi codes worked OK before. Is this DBI related?

No.  No.  

>#!/usr/bin/perl -w
>
>use DBI;
>use strict;
>use diagnostics;
>print "Content-type: text/html\n"; # this line gets printed
>my $string = "dbi:mysql:db1";
>my $database = 'db1';
>my $user = 'user1';
>my $password = 'pass1';
>my $dbh = DBI->connect($string,$user,$password);
>my $sth = $dbh->prepare("SELECT name , owner FROM pet WHERE sex=?");
>$sth->execute (my $sex);

The SELECT will only retrieve rows with a null value for the column
sex since the value of $sex is null.  

>while (my @row = $sth->fetchrow_array) {
>
>#The below two lines don't get printed.
>print "Check if this prints";
>print "@row\n";
>}
>$dbh->disconnect;

It's perfectly valid for a SELECT to result in an empty result set.
Specify selection criteria that will match rows in the database and
the fetchrow_array() method will return them.  

By the way, it was already pointed out that you should either check
the results of calls to DBI methods (and their friends) or set
RaiseError.  

-- 
Garry Williams


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

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


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