[16834] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4246 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 7 06:05:30 2000

Date: Thu, 7 Sep 2000 03:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <968321110-v9-i4246@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 7 Sep 2000     Volume: 9 Number: 4246

Today's topics:
    Re: A Challenge <bart.lateur@skynet.be>
    Re: A Challenge (Martien Verbruggen)
    Re: calling a script without POST or GET (David Efflandt)
    Re: Generate Graphics by Perl <David.Hiskiyahu@alcatel.be>
    Re: Good companion book to Programming Perl? <bart.lateur@skynet.be>
    Re: Help needed - regexp (Martien Verbruggen)
    Re: Help needed - regexp (Daniel Chetlin)
    Re: Help needed - regexp mexicanmeatballs@my-deja.com
        help newbie <lishi1972@sina.com>
    Re: help newbie <bcaligari@my-deja.com>
    Re: help with a hash? (Daniel Chetlin)
    Re: Help with looping through code needed (Martien Verbruggen)
    Re: how could I convert a string to a hex ASCII <Peter.Dintelmann@dresdner-bank.com>
    Re: How to get my IP address as a string mexicanmeatballs@my-deja.com
    Re: How to get my IP address as a string (Martien Verbruggen)
    Re: HTML::parse bug <T.Cockle@staffs.ac.uk>
    Re: HTML::parse bug <T.Cockle@staffs.ac.uk>
    Re: HTML::parse bug <T.Cockle@staffs.ac.uk>
    Re: Is this a bug or a feature? <christopher_j@uswest.net>
    Re: Newbie - windows directory location <Peter.Dintelmann@dresdner-bank.com>
    Re: Newbie - windows directory location nobull@mail.com
    Re: newbie: redirect problem (Randal) <godzilla@stomp.stomp.tokyo>
        Perl and Cobalt Qube2 <info@ezboo.com.xx>
        Perl and Qube2 <info@ezboo.com.xx>
        Regards CGI.pm <kenn_mar@hotmail.com>
    Re: Regards CGI.pm (Eric Bohlman)
        Some question in using Perl Cookie from a PERL beginner <2kman@lovecat.com>
    Re: Sorting again. <bcaligari@my-deja.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 07 Sep 2000 08:48:04 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: A Challenge
Message-Id: <5dlersk4p9g9ts7qndtfpqp3k5k236qlfr@4ax.com>

James Bond wrote:

>I did not realize  that you were all here to SELL your services as
>expert developers. 

They're not. In fact, it is against the charter of newsgroups like this
one to explicitely advertise.

But, if something feels like it is just a job (i.e. no fun at all), they
feel like it should be treated as one. It's like asking amateur
Photoshoppers to resize 400 images for you. Simple task, maybe, but no
fun at all, and something people have every right to be expected to be
payed for it.

-- 
	Bart.


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

Date: Thu, 7 Sep 2000 19:44:56 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: A Challenge
Message-Id: <slrn8relc8.dgd.mgjv@martien.heliotrope.home>

On Wed, 06 Sep 2000 22:20:43 GMT,
	James Bond <got1toomany@trojans.com> wrote:
> On 3 Sep 2000 19:44:46 -0500, logan@cs.utexas.edu (Logan Shaw) wrote:
> 
> Sorry, I guesss I missunderstood the purpose of this group. I THOUGHT
> it was a place where an inexperienced person who is TRYING to learn
> Perl might get some USEFUL advise from those who are more experienced.

The _purpose_ of the group is to provide a place where people can
discuss Perl issues. Inexperienced people learning from this group is a
nice by-product, but not the purpose. This group is not a classroom or
helpdesk. People getting help from this group is something that is nice,
and is always _given_ by the group, and not _demanded_ or _expected_ by
the recipient.

Your question missed the purpose of the group, and it obviously wasn't
worth being given serious attention. If it was, it would have got it.

> I did not realize  that you were all here to SELL your services as
> expert developers. I thought people here actually enjoyed what they
> did, and pehaps enjoyed sharing thier knowlegde. 

No one is here to sell anything. But no one should be here begging for
freebies either. In case you didn't know, the offers for quotations and
rate cards were given as part of a package that also had a good dose of
sarcasm in it. I know it's hard to grasp the related concepts of irony
and sarcasm, but if you get yourself a good dictionary, you might be
able to just understand what went on.

> Oh, and BTW, to me, this was a challenge. As well, no need to insult
> the writer of this script. It does exactly what it claims to, and
> quite effectively.

If it was a challenge to _you_, then you would have felt compelled to
solve the problem. You presented it as if it was a challenge to us. And
I suppose it is clear that that was not right. You were posing it as a
challenge to _us_. Not as one to you.

> As I realize the kind of responce this is likely to generate, I won't
> bother checking back in.

Ok. Even if you do, I won't notice. Your original post was bad enough,
but this response has earned you a nice spot in my score file somewhere
on the far side of the line that says 'References: la.znet.com'.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | +++ Out of Cheese Error +++
Commercial Dynamics Pty. Ltd.   | Reinstall Universe and Reboot +++
NSW, Australia                  | 


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

Date: Thu, 7 Sep 2000 08:40:37 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: calling a script without POST or GET
Message-Id: <slrn8rel41.7kk.efflandt@efflandt.xnet.com>

On Wed, 6 Sep 2000, Christopher M. Jones <christopher_j@uswest.net> wrote:
>
>"Francois Bilodeau" <frabilod@lino.com> wrote:
>> If I call a PERL script with a POST action on a form I can easily access
>> all the form's content by using:
>> $query = <STDIN>
>>
>> But if I call this same script by a URL in a browser:
>> http://myserver.com/cgi-bin/myscript.pl?myvariable=1234&var2=whatever
>> the script is call OK but $ENV{'CONTENT_LENGTH'} = 0 and STDIN is empty!
>>
>> How can I access the parameter? What is wrong? The way to pass the
>> parameter or the way to acces them or both?
>
>Nothing is wrong, you're just doing more work than is
>necessary.  Of _course_ STDIN is empty, why wouldn't it be?
>You're not posting to the script are you?  If you want to
>get the query string from a GET, you _could_ use
>
>$query = $ENV{'QUERY_STRING'};
>
>But, unless you want to get the whole query string all in one
>big blob (which it doesn't seem like that's what you want it from
>the example you gave) you want to use cgi-lib.pl (or somesuch).
(snip)
>cgi-lib.pl is really a must have for any serious cgi program.

You are kidding aren't you?  cgi-lib.pl is an old unsupported perl 4
module.  Perl 5 comes with a CGI.pm module that is currently supported and
more capable.  It will grab both GET and POST variables.  In a terminal or
DOS window of a system with Perl type:  perldoc CGI.

But CGI questions should be directed to the *.cgi newgroup, since they are
often general questions that have roughly the same answer for any
scripting or programming language.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: Thu, 07 Sep 2000 09:23:52 +0200
From: David Hiskiyahu <David.Hiskiyahu@alcatel.be>
Subject: Re: Generate Graphics by Perl
Message-Id: <39B74288.5DE70CAB@alcatel.be>

Hi Sean,

Thanks for suggestion - I did think in the beginning in
that direction.

However, once I found the GD module, there is no reason
to cheat anymore ... this simple module is easy to cheat,
creates neat graphics and gives enough means to make any
Excel-like chart in e.g. a GIF format:
http://stein.cshl.org/WWW/software/GD/GD.html

And I have also lines, which cannot be made with an HTML,
and easily controlled text inside the image.

Thanks for the suggestion!


My next challenge is:

How to send the GIF file produced by the script as an inline
part of the HTML output?  Is this feasible at all?

A typical WWW Perl script will spit in the beginning something
like 'Content-type: text/html' or 'Content-type: graphics/gif'.

Can a program do this more than once? This needs some understanding
of the nitty-gritty's of HTTP, working on it.



David.

Sean Malloy wrote:
> 
> David Hiskiyahu <David.Hiskiyahu@alcatel.be> wrote:
> 
> >I have a Perl script, called via a CGI form.
> >
> >The script reads user input from the CGI parameter list, scans
> >some data on the server and generates a table as a result, a
> >rather classical use of Perl with CGI.
> >
> >In addition to the table, I would like to present a bar-chart.
> >
> >Does someone have an example of Perl doing such graphics?
> >Lines, bars, text - that's what I need to have in he chart.
> 
> Bar charts are easy -- cheat.
> 
> 1) Create as many NxN GIF images as you have different-colored bars
>    (if they're solid color, you can make them 1x1).
> 
> 2) Have your Perl script manipulate its data and produce a table. For
>    each bar in the chart -- either a row or column in the table -- you
>    put an <IMG> tag with the bar image resized to make it the right
>    size for that bar. For example, if you wanted percentages as
>    horizontal bars ten pixels high, and the space for the bars gave
>    you 400 pixels, then you would have your Perl script compute the
>    percentage, multiply it by four, and use that as the WIDTH
>    attribute of the <IMG> tag.
> 
> For an example of this kind of bar-graph image manipulation, go to
> 
>     http://www-nmcsd.med.navy.mil/stats/index.html
> 
> The access statistics HTML file for the current month is generated
> nightly by a Perl script that reads the access log of the webserver.
> It's a minor modification to the wwwstat Perl script (available on the
> Net); I hacked it to produce bar graphs as well as numbers.
> 
> I have a more complicated example that is interactive -- the user
> specifies what data they want through three levels of forms, and then
> the Perl script extracts the data from an Access database and draws
> bargraphs -- but that program is 31 pages long and is on our intranet
> behind a firewall. I can send you the code, however, if you're
> interested in seeing it.
> 
> --
> Sean R. Malloy               | American Non Sequitur
>     Naval Medical Center     |       Society
>     San Diego, CA 92134-5000 |
> srmalloy@home.net            | "We may not make sense,
> srmalloy@nmcsd.med.navy.mil  |  but we do like pizza"
> FORMAL NOTICE: unsolicited commercial email will be read
> at a charge of $500 per item. Receipt of such email shall
> be considered to constitute acceptance of contract, and
> will be billed immediately.

-- 
***   David Hiskiyahu, Alcatel SRD, 1 Fr.Wellesplein,  Antwerp  ***
***    Phone/Fax: +32 3 240 7965/9820, private +32 3 290 0912   ***

Man's mind stretched to a new idea never goes back to its original dimensions.
- Oliver Wendell Holmes


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

Date: Thu, 07 Sep 2000 08:43:16 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Good companion book to Programming Perl?
Message-Id: <c5lerscihv7mrisaghlra6l8gbs6kgsd55@4ax.com>

sysnovice wrote:

>because even the dummy book is not condesending enough for a
>novice Sysad like me.

You really should read MJD's critique, at the link mentioned somewhere
else in this thread. It's not you. It's painted as a bad book, which
looks rather like it was written BY a dummy, and not just FOR dummies.

It takes a very good teacher to teach dummies. This author apparently is
not one.

-- 
	Bart.


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

Date: Thu, 7 Sep 2000 19:51:42 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Help needed - regexp
Message-Id: <slrn8relou.dgd.mgjv@martien.heliotrope.home>

On Thu, 07 Sep 2000 03:00:42 GMT,
	Mark-Jason Dominus <mjd@plover.com> wrote:
> 
> In the original poster's example, both expressions are correct, but
> this is not always the case and there is no way for Perl to know it.
> For example:
> 
>         "foo>bar>" =~ /^(.*?)>$/;
> 
> is not at all the same as 
> 
>         "foo>bar>" =~ /^([^>]*)>$/;
> 
> The first one matches and the second does not.

Am I misunderstanding what you are saying here? As far as I can tell,
they both match, and they both should.

# perl -w
"foo>bar>" =~ /^(.*?)>$/;
print "$1 from $&\n";
"foo>bar>" =~ /^([^>]*)>$/;
print "$1 from $&\n";
__END__
foo>bar from foo>bar>
foo>bar from foo>bar>

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Think of the average person. Half of
Commercial Dynamics Pty. Ltd.   | the people out there are dumber.
NSW, Australia                  | 


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

Date: Thu, 07 Sep 2000 09:24:34 GMT
From: daniel@chetlin.com (Daniel Chetlin)
Subject: Re: Help needed - regexp
Message-Id: <m9Jt5.1532$p8.173262@news-west.usenetserver.com>

On Thu, 7 Sep 2000 19:51:42 +1100,
 Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
>On Thu, 07 Sep 2000 03:00:42 GMT,
>	Mark-Jason Dominus <mjd@plover.com> wrote:
>> 
>> In the original poster's example, both expressions are correct, but
>> this is not always the case and there is no way for Perl to know it.
>> For example:
>> 
>>         "foo>bar>" =~ /^(.*?)>$/;
>> 
>> is not at all the same as 
>> 
>>         "foo>bar>" =~ /^([^>]*)>$/;
>> 
>> The first one matches and the second does not.
>
>Am I misunderstanding what you are saying here? As far as I can tell,
>they both match, and they both should.
>
># perl -w
>"foo>bar>" =~ /^(.*?)>$/;
>print "$1 from $&\n";
>"foo>bar>" =~ /^([^>]*)>$/;
>print "$1 from $&\n";
>__END__
>foo>bar from foo>bar>
>foo>bar from foo>bar>

Oops, nope -- you're not checking whether the match succeeds or not. Try
it in reverse:

  [~] $ perl -w
  "foo>bar>" =~ /^([^>]*)>$/;
  print "$1 from $&\n";
  "foo>bar>" =~ /^(.*?)>$/;
  print "$1 from $&\n";
  __END__
  Use of uninitialized value in concatenation (.) or string at - line 2.
  Use of uninitialized value in concatenation (.) or string at - line 2.
   from
  foo>bar from foo>bar>

You're getting the $1 and $& carried over from the first match.

If it makes you feel any better, I stared at that for about five minutes
trying to figure out what the bloody hell was going on... :-)

-dlc




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

Date: Thu, 07 Sep 2000 09:53:23 GMT
From: mexicanmeatballs@my-deja.com
Subject: Re: Help needed - regexp
Message-Id: <8p7oig$2tb$1@nnrp1.deja.com>

In article <slrn8relou.dgd.mgjv@martien.heliotrope.home>,
  mgjv@tradingpost.com.au wrote:
> On Thu, 07 Sep 2000 03:00:42 GMT,
> 	Mark-Jason Dominus <mjd@plover.com> wrote:
> >
> > In the original poster's example, both expressions are correct, but
> > this is not always the case and there is no way for Perl to know it.
> > For example:
> >
> >         "foo>bar>" =~ /^(.*?)>$/;
> >
> > is not at all the same as
> >
> >         "foo>bar>" =~ /^([^>]*)>$/;
> >
> > The first one matches and the second does not.
>
> Am I misunderstanding what you are saying here? As far as I can tell,
> they both match, and they both should.
>
> # perl -w
> "foo>bar>" =~ /^(.*?)>$/;
> print "$1 from $&\n";
> "foo>bar>" =~ /^([^>]*)>$/;
> print "$1 from $&\n";
> __END__
> foo>bar from foo>bar>
> foo>bar from foo>bar>
>

Err.. nope..

$ perl -e 'print "foo>bar>" =~ /^(.*?)>$/, "\n";'
foo>bar
$ perl -e 'print "foo>bar>" =~ /^([^>]*)>$/,"\n";'

$

The second print in your code displays the resutls
of the first regexp's match:

$ perl -e '
> "meat>balls>" =~ /^(.*?)>$/;
> print "$1 from $&\n";
> "foo>bar>" =~ /^([^>]*)>$/;
> print "$1 from $&\n";'
meat>balls from meat>balls>
meat>balls from meat>balls>

--
Jon
perl -e 'print map {chr(ord($_)-3)} split //, "MrqEdunhuClqdph1frp";'


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 7 Sep 2000 03:27:47 +0800
From: "lishi" <lishi1972@sina.com>
Subject: help newbie
Message-Id: <8p7fuo$skp$1@info.sta.net.cn>

In order to install ActivePerl-5.5.650.607 , I must install DCOM for Windows
98 first. It is a microsoft product, I search it on microsoft, and it told
me that this software should be here:
http://download.microsoft.com/msdownload/dcom/98/x86/en/dcom98.exe
But I found that it is empty when I click on this URL, Sir/madam, Can you
help me ? Where can I found this one? thanks!

Best regards






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

Date: Thu, 07 Sep 2000 09:14:28 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
Subject: Re: help newbie
Message-Id: <8p7m9a$km$1@nnrp1.deja.com>

In article <8p7fuo$skp$1@info.sta.net.cn>,
  "lishi" <lishi1972@sina.com> wrote:
> In order to install ActivePerl-5.5.650.607 , I must install DCOM for
Windows
> 98 first. It is a microsoft product, I search it on microsoft, and it
told
> me that this software should be here:
> http://download.microsoft.com/msdownload/dcom/98/x86/en/dcom98.exe
> But I found that it is empty when I click on this URL, Sir/madam, Can
you
> help me ? Where can I found this one? thanks!
>
> Best regards
>
>

your best bet is to install IE5
i believe that dcom is an integral part

brendon


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 07 Sep 2000 08:06:07 GMT
From: daniel@chetlin.com (Daniel Chetlin)
Subject: Re: help with a hash?
Message-Id: <P%Ht5.1425$p8.168801@news-west.usenetserver.com>

On Wed, 6 Sep 2000 23:34:10 -0700,
 Christopher M. Jones <christopher_j@uswest.net> wrote:
>Yes, people should use the modules and HTML::Parser, but someone's
>gotta write those.

*sigh*

>Now, here's a much better snippet of code for the original task.

Don't take this the wrong way, because I know that you're well-meaning
here, but mightn't you check your code before you post it?

>    $params = s/\s+\=\s+/=/g;
              ^ missing something rather important here

>        my ($pname, pval) = split(/\=/, $_);
                    ^ and here

>        $pname =~ s/^\s*(\S|\b)/\1/s; $pname =~ s/(\S|\b)\s*$/\1/s;
>        $pval =~ s/^\s*(\S|\b)/\1/s; $pval =~ s/(\S|\b)\s*$/\1/s;

>            $pval =~ s/^"//; $pval =~ s/^'//;
>            $pval =~ s/"$//; $pval =~ s/'$//;

Those sure are a waste of a lot of substitutions.

And just in case you thought you got it, other than the minor typos and
"unusual" coding style:

<a href="http://www.foo.com/bar?baz=blarch">Oops!</a>

-dlc




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

Date: Thu, 7 Sep 2000 20:07:08 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Help with looping through code needed
Message-Id: <slrn8remls.dgd.mgjv@martien.heliotrope.home>

On Wed, 06 Sep 2000 15:50:03 GMT,
	kevin@oldcommunications.com <kevin@oldcommunications.com> wrote:
> Hello,
> 
> In the following code, I need to get the text from between both sets of
> <type></type> tags.  I thought maybe a while loop looking for the
> newline character would do it, but that was just a shot in the dark.
> The output should probably look something like:
> 
> String: COOL Kevin
> String: COOL Kevin2
> 
> This is just a test for a bigger script I'm writing and basically I am
> reading in a file and everything is in one line and I can't separate it
> into lines.  I need to parse through it and pull out the data between
> the XML tags.  That is going fine, but only for the first set of tags.
> I need it to be recursive.

This is a bit vague. You say 'recursive'. Do you mean that these things
can be nested? And if so, which part of the text between the outermost
tags do you want?

If you didn't really mean recursive, but repetitive, then a non-greedy
match may be successful. (Also see some other threads concurrent with
this one).

> $String = 'This is a <type>COOL Kevin</type> <type>COOL
> Kevin2</type>string!';

while ($String =~ m#<type>(.*?)</type>#g)
{
	print "Got '$1'\n";
}

If you did mean recursive, then using XML::Parser would be my advice.
You'll still have to work out which bits you want to treat when and how.

<type>text1<type>inner text</type>text2</type>

That would be 'recursive' I think. You'll have to decide then whether
the outermost tags contain 'text1<type>inner text</type>text2', or maybe
just 'text1 text2', or maybe something altogether different. I don't
know what you had in mind when this data structure was invented.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | For heaven's sake, don't TRY to be
Commercial Dynamics Pty. Ltd.   | cynical. It's perfectly easy to be
NSW, Australia                  | cynical.


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

Date: Thu, 7 Sep 2000 09:30:54 +0200
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: how could I convert a string to a hex ASCII
Message-Id: <8p7g7m$1c1@intranews.bank.dresdner.net>

    Hi Lucas,

Lucas Tsoi schrieb in Nachricht <8p7100$8b845@imsp212.netvigator.com>...
>how could I convert a string to a hex ASCII?

    it is not quite clear to me what you
    want to do.
    Assuming you want to turn 'ABC' into '414243'

        print join '', unpack 'H*', 'ABC';

    will do the job.

    Regards,

        Peter Dintelmann





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

Date: Thu, 07 Sep 2000 09:04:07 GMT
From: mexicanmeatballs@my-deja.com
Subject: Re: How to get my IP address as a string
Message-Id: <8p7llu$s$1@nnrp1.deja.com>

In article <kRvt5.2366$Xq2.196739@news.uswest.net>,
  "Christopher M. Jones" <christopher_j@uswest.net> wrote:
>

<snip>

> If you are running a plain old standalone perl script, you can
> use gethostbyname(), but remember that the address is packed
> (IOW it returns the 32-bit integer version of the ip).  Use
>
> $addy = join '.', unpack('C4', gethostbyname());
>
> For an address in a more familiar form.

This also might be of use, since gethostbyname relies on some form of
DNS lookup and if you don't have DNS or don't have the hostname:

#!/usr/bin/perl -w
use strict;
use Socket;

my $proto = getprotobyname("udp");
socket(SOCKET, PF_INET, SOCK_DGRAM, $proto);
connect(SOCKET, sockaddr_in(0, inet_aton('10.10.10.10')));
my ($port, @addr) = unpack_sockaddr_in(getsockname(SOCKET));
print join("\n", map {inet_ntoa($_)} @addr),"\n";

Will extract the IP address that is associated with a connection
heading toward the ip address you give it (in this case 10.10.10.10).
If you have multiple adapters then which address you get back depends
on which route is associated with the IP address you give it
e.g.
127.0.0.1 will return 127.0.0.1 assuming you have loopback.

The IP address doesn't have to be valid, no connection is actually
made (despite the connect command suggesting otherwise).

(Apologies to those who've already seen this in a past thread.)

--
Jon
perl -e 'print map {chr(ord($_)-3)} split //, "MrqEdunhuClqdph1frp";'


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 7 Sep 2000 20:14:15 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: How to get my IP address as a string
Message-Id: <slrn8ren37.dgd.mgjv@martien.heliotrope.home>

[Please for future reference, post your reply _after_ the suitably
trimmed down quoted text you reply to. it makes the posts much more
readable, as it respects the natural flow of time. Thank you for your
cooperation]

On Thu, 7 Sep 2000 00:04:13 -0400,
	Joe DiAdamo <jdiadamo@cisco.com> wrote:
> "Christopher M. Jones" <christopher_j@uswest.net> wrote in message
> news:eKvt5.2328$Xq2.193168@news.uswest.net...
> 
> SERVER_ADDR?  Is this new?  Can't find it in any of the CGI references I
> have access to...

All of this is terribly offtopic, and I would urge everyone to cease
participating in this thread.

To the posters: If you want to discuss CGI, go to
comp.infosystems.www.authoring.cgi, or read some of the documentation on
www.cgiresources.com.

Now shoo!

Note followups.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | +++ Out of Cheese Error +++
Commercial Dynamics Pty. Ltd.   | Reinstall Universe and Reboot +++
NSW, Australia                  | 


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

Date: Thu, 07 Sep 2000 10:29:23 +0100
From: Tim Cockle <T.Cockle@staffs.ac.uk>
To: "Randal L. Schwartz" <merlyn@stonehenge.com>
Subject: Re: HTML::parse bug
Message-Id: <39B75FF3.1D6C83CF@staffs.ac.uk>

Hi,

The crashes appears to happen consistently inside the get_token call of
HTML::TokeParser. Now I have look into this and the crash occurs constantly at
this point:
     $self->parse($buf);

Look in to HTML::Parser it crash at different parts of parse().

The odd thing is that it will do the first file but always crash on the second!

Surely if it is crashing at the same point it can not be a signal problem?

Tim

"Randal L. Schwartz" wrote:

> >>>>> "Tim" == Tim Cockle <T.Cockle@staffs.ac.uk> writes:
>
> Tim> I have found a bug somwwhere in HTML::parse. I have written a simple
> Tim> server wich works fine. However if I convert it into a forking server it
> Tim> crashes out.
>
> And further down in this thread, you post code that shows something in
> a SIG handler other than $SIG{WHATEVER} = 'IGNORE'.
>
> You *will* experience crashes then.  Get used to it.  Signals
> are not reliable, and this is the unreliablity. :)
>
> The bug is not in HTML::Parse.  Nothing to see here.  Move along. :)
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mr. T. P. Cockle M.Sc. B.Sc. (hons) Pg.D.                 Ph.D. Representative

Research (Distributed Computer Systems)
School of Computing,
Staffordshire University,
Stafford ST18 0DG.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




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

Date: Thu, 07 Sep 2000 10:36:22 +0100
From: Tim Cockle <T.Cockle@staffs.ac.uk>
To: Gisle Aas <gisle@ActiveState.com>
Subject: Re: HTML::parse bug
Message-Id: <39B76196.7CE9D19C@staffs.ac.uk>

Sorry for the flood of e-mails but this code is smaller and highlights the problem,

As I said before the crashes appears to happen consistently inside the get_token
call of HTML::TokeParser at the line:
     $self->parse($buf);

Hope you can help!

Tim

use diagnostics;
use HTML::TokeParser;
use POSIX qw(:sys_wait_h);

my $token;
my $i = 1;

while  ($i < 5) {

   $SIG{CHLD} = \&REAPER;
   next if $pid = fork;
   die "fork: $!" unless defined $pid;

   my $fileName = "menu$i.html";
   my $p = HTML::TokeParser->new($fileName);
   while ($token = $p->get_tag("a")) {}

   print "done $fileName\n";


   exit();

} continue {

   $i++;

}

sub REAPER {
    1 until (-1 == waitpid (-1, WNOHANG) );
    $SIG{CHLD} = \&REAPER;
}

Gisle Aas wrote:

> Tim Cockle <T.Cockle@staffs.ac.uk> writes:
>
> > I don't use it directly there is a reference from HTML::TokeParser.
> >
> > But I have looked at the TokeParser (get_token) and the failure occurs in the
> > HTML::Parse code.
>
> How does it crash?  Are you able to reduce it to a little test program
> that you can share?
>
> > jason wrote:
> >
> > > Tim Cockle <T.Cockle@staffs.ac.uk> wrote ..
> > > >I have found a bug somwwhere in HTML::parse. I have written a simple
> > > >server wich works fine. However if I convert it into a forking server it
> > > >crashes out.
> > > >
> > > >Does this sound fermular to anyone?
> > > >
> > > >If no one has seen this problem don't worry. I going to restart my
> > > >investigation into the bug so will be able to proved a much better
> > > >description shortly.
> > >
> > > before you start .. you should be aware that HTML::Parse is deprecated
> > > .. you should be using HTML::Parser
>
> --
> Gisle Aas

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mr. T. P. Cockle M.Sc. B.Sc. (hons) Pg.D.                 Ph.D. Representative

Research (Distributed Computer Systems)
School of Computing,
Staffordshire University,
Stafford ST18 0DG.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




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

Date: Thu, 07 Sep 2000 10:37:34 +0100
From: Tim Cockle <T.Cockle@staffs.ac.uk>
Subject: Re: HTML::parse bug
Message-Id: <39B761DE.59699A74@staffs.ac.uk>

I am very new to perl as you can probable tell!!!

Is there an alternative to SIG when forking?

Tim

"Randal L. Schwartz" wrote:

> >>>>> "Tim" == Tim Cockle <T.Cockle@staffs.ac.uk> writes:
>
> Tim> I have found a bug somwwhere in HTML::parse. I have written a simple
> Tim> server wich works fine. However if I convert it into a forking server it
> Tim> crashes out.
>
> And further down in this thread, you post code that shows something in
> a SIG handler other than $SIG{WHATEVER} = 'IGNORE'.
>
> You *will* experience crashes then.  Get used to it.  Signals
> are not reliable, and this is the unreliablity. :)
>
> The bug is not in HTML::Parse.  Nothing to see here.  Move along. :)
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Mr. T. P. Cockle M.Sc. B.Sc. (hons) Pg.D.                 Ph.D. Representative

Research (Distributed Computer Systems)
School of Computing,
Staffordshire University,
Stafford ST18 0DG.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




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

Date: Thu, 7 Sep 2000 00:14:04 -0700
From: "Christopher M. Jones" <christopher_j@uswest.net>
Subject: Re: Is this a bug or a feature?
Message-Id: <UeHt5.2039$Ok5.435074@news.uswest.net>


<elliotfinley@my-deja.com> wrote:
> I expected it to be:
> One
> One
> One
> One
> One
> Two
> Two
> Two
> Two
> Two

If you want that, then just do:

print "One\n" x 5;
print "Two\n" x 5;


or, I could try cleaning up your code (ugh!)


#!/usr/bin/perl -w

use strict;

main();
exit;

sub main
    {
    my $v = 10;

    while($v > 0)
        {
        if ($v > 5)
            { print "One\n"; }
        elsif ($v > 0)
            { print "Two\n"; }
        $v--;
        }
    }

###########

What's with all the nexts and lasts?  Were they really necessary?
Use nexts and lasts sparingly, the vast majority of the time you
don't need them.  And why do you need a main()?  This isn't C
ya know?  Perl is easy as pie, don't complicate it with junk from
other idiosyncratic programming languages.




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

Date: Thu, 7 Sep 2000 09:53:59 +0200
From: "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com>
Subject: Re: Newbie - windows directory location
Message-Id: <8p7hj1$3a2@intranews.bank.dresdner.net>

    Hi,

scottfreez@my-deja.com schrieb in Nachricht
<8p6ljm$rue$1@nnrp1.deja.com>...

    [snip]

>What's happening is that unless I give the full path from the root of
>the web server (in this case, the root I assigned in IIS), it looks for
>the filename in the root rather than the current location.

    [snip]

>Is there a way to get the file's location into a variable, and then
>simply append the filename onto that variable? Sure there is.

    1. Use the FindBin module to find out about yourself.

        use FindBin;
        print $FindBin::Bin;    # directory your prog is in

    (but I did not get it working with Apache/mod_perl).

    2. Use the environment variable PATH_TRANSLATED in your CGI
    script

        use File::Basename;
        print dirname( $ENV{PATH_TRANSLATED} );    # dir your script is
in

    3. Create a module containing all platform specific issues
    (path names etc.) and use it. When changing the platform you
    only have to change one file and can be sure that everything
    will work.

    Regards,

        Peter Dintelmann






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

Date: 07 Sep 2000 08:53:08 +0100
From: nobull@mail.com
To: scottfreez@my-deja.com writes:
Subject: Re: Newbie - windows directory location
Message-Id: <u9pumg39ob.fsf@wcl-l.bham.ac.uk>

scottfreez@my-deja.com writes:

> I want to have the config file in the same directory as the .pl file.

FAQ: "How do I add the directory my program lives in to the
module/library search path?"

OK it's not _exactly_ the same question but it's close enough that the
answer will also answer your question.

In future please consult the FAQ _before_ you post.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 07 Sep 2000 00:59:08 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: newbie: redirect problem (Randal)
Message-Id: <39B74ACC.C9E006D7@stomp.stomp.tokyo>

"Godzilla!" wrote:
> "Godzilla!" wrote:
 
> ( still more snippage )
 
> > "Randal L. Schwartz" wrote:
> > > > Godzilla! writes:
 
> > > Godzilla!> specialized nph-client, a type of script, which


Previously Randal, I provided incorrect information
by stating an incorrect flow of header data:

quote:


My output would appear:

HTTP/1.0 200 OK
Server: Chahta Chat via CERN/3.0
Content-Type: text/html

HTTP/1.1 302 Redirected
Location: <url goes here>

(blank line above)


end quote.


In this large program of mine, some four-thousand
lines, right off my program takes care of proxy
servers and those who are 'banished' from this
program. I love having my androids give 'em the
boot. BOOM! Bye Bye! Anyhow, took me a bit to
to follow data flow through subroutines and
branching to realize what is truly taking place.

So, as is my habit, I reviewed certain sections of
my program to be sure of my facts. In reality, 
people are given the boot before,

HTTP/1.0 200 OK
Server: Chahta Chat via CERN/3.0
Content-Type: text/html

 ... is ever printed. Looking at a content type
in there, just didn't settle well with me, leading
me to look things over again; it doesn't look right.

What actually happens for a redirect is this is
printed and only this:

HTTP/1.1 302 Redirected
Location: <url goes here>

(blank line above)


Where an nph-client style script fails is use
of print Location: ... ONLY. This makes sense
because the HTTP type would be missing leading
a server to treat it as a default document of
sorts, in this case, a browser presents it as
an html document although no html tags are
present. You simply see,

Location: <url goes here>

 ...in your browser default background color
and default font face, html style.

Rather interesting. No error and an html
like page displayed, despite no html tags.

So, my error. Problem with nph-client style
is you must have an http type, then a location
print, not just a location print.

I have made those changes based on what you
posted Randal. I am now running my master
script as a standard cgi script. So far,
all is running quite smoothly. If I could
only get my android, Roberta, to shut up
for a change. She talks more than myself.

Godzilla!

--
print "file:///%43|%2f";


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

Date: Thu, 7 Sep 2000 10:34:08 +0200
From: "Thierry" <info@ezboo.com.xx>
Subject: Perl and Cobalt Qube2
Message-Id: <8p7kg1$82t$1@reader1.fr.uu.net>

sorry for last post (mistake, was not finished)

Perl5 is installed on my Cobalt Qube2, but how to execute a simple Perl
script ?
like:
###################################
#!/usr/bin/perl
 print "Content-type: text/html\n\n";
 print "toto\n";
###################################

If I save this file as toto.pl and I chmod 755 I get an error message at
execution.

Thanks a lot for your help

Thierry




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

Date: Thu, 7 Sep 2000 10:30:41 +0200
From: "Thierry" <info@ezboo.com.xx>
Subject: Perl and Qube2
Message-Id: <8p7k9j$80h$1@reader1.fr.uu.net>

Hi,

Perl is installed on my Cobalt Qube2 but how can execute a simple script
like,





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

Date: Thu, 07 Sep 2000 20:35:15 +1200
From: Ken <kenn_mar@hotmail.com>
Subject: Regards CGI.pm
Message-Id: <39B75343.72865830@hotmail.com>

Hi gurus,

   In the following code, I just could not display the three images
beside the corresponding upload fields of the multipart form. Please
tell me what's wrong.
===========code==========
#!/usr/bin/perl
#file: upload.pl

use CGI qw/:standard/;

print header,
    start_html('file upload'),
    h1('file upload');
print_form()    unless param;
print_results() if param;
print end_html;

sub print_form {
    print start_multipart_form(),
 img{src=>'first.gif'},

       filefield(-name=>'upload',-size=>30),br,
 img{src=>'second.gif'},

       filefield(-name=>'upload1',-size=>30),br,
 img{src=>'third.gif'},

       filefield(-name=>'upload2',-size=>30),br,
 br,
       submit(-label=>'Upload File'),
       end_form;
}

sub print_results {
    my $length;
    my $file = param('upload');
    if (!$file) {
        print "No file uploaded.";
        return;
    }
    print h2('File name'),$file;
    print h2('File MIME type'),
    uploadInfo($file)->{'Content-Type'};
    while (<$file>) {
        $length += length($_);
    }
    print h2('File length'),$length;
}
====end of code========

   All I get is 3 broken images indicating failure to locate the
graphics resource. I tried put the gifs in the cgi-bin, the server
document root, etc, but still couldn't fix problem :(

   Also, is there a way to restore the uploaded file names instead of
the default CGItemp-1234567890 names given by CGI.pm?

   Thanks in advance.

-Ken



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

Date: 7 Sep 2000 08:32:08 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Regards CGI.pm
Message-Id: <8p7jq8$dfu$2@slb7.atl.mindspring.net>

Ken (kenn_mar@hotmail.com) wrote:
: Hi gurus,
: 
:    In the following code, I just could not display the three images
: beside the corresponding upload fields of the multipart form. Please
: tell me what's wrong.

[snip]

:    All I get is 3 broken images indicating failure to locate the
: graphics resource. I tried put the gifs in the cgi-bin, the server
: document root, etc, but still couldn't fix problem :(

You'll need to specify absolute paths for your images.  Your problem is 
that when you use the bare names, the browser interprets them as relative 
to your script's name.



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

Date: Thu, 07 Sep 2000 16:34:23 +0800
From: Kit <2kman@lovecat.com>
Subject: Some question in using Perl Cookie from a PERL beginner
Message-Id: <39B7530F.33286DE5@lovecat.com>

Dear all, I am beginner of using Perl and have some question when using
cookie.  Hope you can help me to solve it.

Firstly, I pass value "apple" to aa.cgi through index.html.  When going
to bb.cgi, it would load the value (i.e. 'apple') in cookie 'aaa' and do

something. When going to cc.cgi, the value in cookie 'aaa' ( ie 'apple')

would be reset.  The coding is described as following:-

# In aa.cgi >>
#!/usr/bin/perl
$in1=new CGI;
$cookie=$in1->cookie(-name=>'aaa', -value=>"$var1");
print $in1->header(-cookie=>$cookie);


# In bb.cgi >>
#!/usr/bin/perl
$get1=new CGI;
$var1=$get1->cookie(-name=>"aaa");

# In cc.cgi >>
#!/usr/bin/perl
$out=new CGI;
$cookie=$out->cookie(-name=>'aaa', -value=>"");
print $out->header(-cookie=>$cookie);

1.    Would it either create new cookie in browser or add the value into

current portal cookie?

2.    Since I don't set the expiry date, I assume the cookie would be
deleted once closing browser. If someone has stolen the cookies before
closing browser, would the guy can copy the cookie file to her/his PC
and then directly type the path of bb.cgi with getting the value 'apple'

without calling aa.cgi or index.html?

3.    When access cc.cgi, I assume the value of cookie (i.e. aaa) would
be clear.  But I found that if the guy has not access cc.cgi to clear
the value but access aa.cgi with re-type new value such as 'orange'.
When the guy access bb.cgi, it seems to use the previous value 'apple'
not 'orange'. Why ?

4.  How do I set more secure for avoiding someone to get the value in
cookie "aaa' ?

5.  Would Perl have allowed to use Session ID rather than cookie?

Regards










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

Date: Thu, 07 Sep 2000 09:18:46 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
Subject: Re: Sorting again.
Message-Id: <8p7mha$uf$1@nnrp1.deja.com>

In article <slrn8raabo.tjm.abigail@alexandra.foad.org>,
  abigail@foad.org wrote:
>
> Recently, I posted a benchmark comparing how well Perls sort does on
> various inputs. But now, perl 5.7.0 uses merge sort instead of quick
sort.
> (Thanks to the work of John Linderman and Peter McIlroy).
>
> A comparison is in order.
>

I'm probably talking rubbish....but does this mean that sorting a
massivish array will result in heavy memory depletion?

Brendon
++++


Sent via Deja.com http://www.deja.com/
Before you buy.


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

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


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