[23773] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5977 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 24 09:05:42 2003

Date: Wed, 24 Dec 2003 06:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 24 Dec 2003     Volume: 10 Number: 5977

Today's topics:
    Re: \r disappear even in binary mode <bart.lateur@pandora.be>
    Re: Accounting, Database Problem <nospam.hciss@yahoo.com>
    Re: Accounting, Database Problem (nus)
    Re: Accounting, Database Problem <jwillmore@remove.adelphia.net>
    Re: Accounting, Database Problem (Sara)
        effecient software engineering (Aaron)
    Re: effecient software engineering (Sara)
        How to write a script that takes input from the screen  (Poppy Gerard)
    Re: How to write a script that takes input from the scr <gnari@simnet.is>
        Install Perl module on Windows <stephane.metais-pourriel@laposte.net>
    Re: Install Perl module on Windows <tom@nosleep.net>
    Re: Install Perl module on Windows <DSX@comcast.net>
    Re: LWP with proxy problem (Sara)
    Re: newbie: Terminating while($line=<stdin>) on Windows <mgjv@tradingpost.com.au>
        SOLVED:: HTML::Form->Parse (Perl) not working under Fed (Jeffrey J. Kosowsky)
    Re: SOLVED:: HTML::Form->Parse (Perl) not working under <jwillmore@remove.adelphia.net>
    Re: Why does Perl use more resource than Php? ctcgag@hotmail.com
    Re: Why does Perl use more resource than Php? <nospam@bigpond.com>
    Re: Why does Perl use more resource than Php? <test@test.com>
    Re: Why does Perl use more resource than Php? (Sam Holden)
    Re: Why does Perl use more resource than Php? <noreply@gunnar.cc>
    Re: Why does Perl use more resource than Php? <jwillmore@remove.adelphia.net>
        would someone tell me why this didn't work? <shelton@NOoSPnAMr.com>
    Re: would someone tell me why this didn't work? (Sam Holden)
    Re: would someone tell me why this didn't work? <mgjv@tradingpost.com.au>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 24 Dec 2003 06:58:58 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: \r disappear even in binary mode
Message-Id: <l3eiuv01e3ek4937akoj99ai5fk9of7tq1@4ax.com>

noone wrote:

>I wrote the following perl script test.pl which generates another perl
>script:
>
>  binmode(STDOUT);
>  print "binmode(STDOUT);print \'\r\n\';"
>
>When I run the generated perl script, it only prints the \n:
>
>  $ perl test.pl | perl - | hexdump -c
>  0000000  \n
>  0000001
>
>Is it a bug or a feature? How to avoid it?

You forgot to show the generated script. (indented:)

	binmode(STDOUT);print '
	';

This is, considered in text mode, just plain (DOS) text.

If you want to keep the symbolic representation, swap the quote types:

	binmode(STDOUT);
	print 'binmode(STDOUT);print "\r\n";'

which looks like:

	binmode(STDOUT);print "\r\n";
which now will print both the CR and the LF.

-- 
	Bart.


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

Date: Wed, 24 Dec 2003 00:17:20 -0600
From: "Matt" <nospam.hciss@yahoo.com>
Subject: Re: Accounting, Database Problem
Message-Id: <vuibq4ks13bj1d@corp.supernews.com>

I update all users once an hour.  I guess I did not make that clear.  It
will only be run every hour on the hour or where ever I set the cronjob at.

I don't think file locking will be an issue.  This script will be the only
one to write to this file.  I would like to put together a couple other
scripts down the road but they will only read it.

I appreciate all the pointers here.  Looking into array of array and how
MRTG works.

Matt

> I have 100 too 300 usernames.  Every hour I want to add an accounting
value
> to each user.
>
> 1st-hour> user1 1245
> 2nd-hour changes too > user1 1245,13456
>
> This goes on until the user has 500 values then the oldest value is
deleted
> to keep it at no more then 500 values at any time.  This is sort of a
> scrolling window.  I also need to add up the values to get a total for
each
> user every hour as well.
>
> Is approaching this with a text file like this a bad way to go?  I like
text
> files, I understand them.  Does perl have any tools to make this easier
for
> me?




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

Date: 24 Dec 2003 03:23:38 -0800
From: cheem_ng@yahoo.com.sg (nus)
Subject: Re: Accounting, Database Problem
Message-Id: <a5c7657f.0312240323.6f0ec82b@posting.google.com>

"Matt" <nospam.hciss@yahoo.com> wrote in message news:<vuibq4ks13bj1d@corp.supernews.com>...
> I update all users once an hour.  I guess I did not make that clear.  It
> will only be run every hour on the hour or where ever I set the cronjob at.
> 
> I don't think file locking will be an issue.  This script will be the only
> one to write to this file.  I would like to put together a couple other
> scripts down the road but they will only read it.
> 
> I appreciate all the pointers here.  Looking into array of array and how
> MRTG works.
> 
> Matt
> 
> > I have 100 too 300 usernames.  Every hour I want to add an accounting
>  value
> > to each user.
> >
> > 1st-hour> user1 1245
> > 2nd-hour changes too > user1 1245,13456
> >
> > This goes on until the user has 500 values then the oldest value is
>  deleted
> > to keep it at no more then 500 values at any time.  This is sort of a
> > scrolling window.  I also need to add up the values to get a total for
>  each
> > user every hour as well.
> >
> > Is approaching this with a text file like this a bad way to go?  I like
>  text
> > files, I understand them.  Does perl have any tools to make this easier
>  for
> > me?

I've used flat files to maintain a small web site. Typical operations
are add, update and delete entries. Most of the code used to perform
those operations involves linearly scanning through line after line of
record. I have not encountered any serious problems. But, I've since
made a switch to mysql and I'm amazed how easy it is to perform those
operations.

So I would say go for a proper database system even though it's not
that big a number of users. The knowledge you gain from using a
database could be harnessed in the future when the user base expands
or when it's needed in other projects.


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

Date: Wed, 24 Dec 2003 13:02:12 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Accounting, Database Problem
Message-Id: <20031224080211.1f4e2751.jwillmore@remove.adelphia.net>

On Tue, 23 Dec 2003 00:53:39 -0600
"Matt" <nospam.hciss@yahoo.com> wrote:

> I have a weird need for a database of sorts.
> 
> I have 100 too 300 usernames.  Every hour I want to add an
> accounting value to each user.
> 
> 1st-hour> user1 1245
> 2nd-hour changes too > user1 1245,13456
> 
> This goes on until the user has 500 values then the oldest value is
> deleted to keep it at no more then 500 values at any time.  This is
> sort of a scrolling window.  I also need to add up the values to get
> a total for each user every hour as well.
> 
> Is approaching this with a text file like this a bad way to go?  I
> like text files, I understand them.  Does perl have any tools to
> make this easier for me?

I'd use the DBI module and either the DBD::SQLite or DBD::Sprite
modules.  The advantage of using SQLite or Sprite is that they act
like other RDBMS's without all the overhead.  This is a good solution
if the web site in question gets less than, say, 500 to a thousand
hits a days.  If you have a higher volume site (say 7 thousand hits a
day), you're a lot better off using a "real" RDBMS (like MySQL,
PostgreSQL, Oracle, etc.).

Text files (or "flat file" databases) are only good if you don't have
heavy access to them or only a few users accessing at any given time. 
They tend to be slower than "real" databases and have a high
maintenence cost. associated with them.

HTH

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
Everyone talks about apathy, but no one does anything about it. 



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

Date: 24 Dec 2003 05:58:11 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: Accounting, Database Problem
Message-Id: <776e0325.0312240558.7dcbc2b4@posting.google.com>

"Matt" <nospam.hciss@yahoo.com> wrote in message news:<vuibq4ks13bj1d@corp.supernews.com>...
> I update all users once an hour.  I guess I did not make that clear.  It
> will only be run every hour on the hour or where ever I set the cronjob at.
> 
> I don't think file locking will be an issue.  This script will be the only
> one to write to this file.  I would like to put together a couple other
> scripts down the road but they will only read it.
> 
> I appreciate all the pointers here.  Looking into array of array and how
> MRTG works.
> 
> Matt
> 
> > I have 100 too 300 usernames.  Every hour I want to add an accounting
>  value
> > to each user.
> >
> > 1st-hour> user1 1245
> > 2nd-hour changes too > user1 1245,13456
> >
> > This goes on until the user has 500 values then the oldest value is
>  deleted
> > to keep it at no more then 500 values at any time.  This is sort of a
> > scrolling window.  I also need to add up the values to get a total for
>  each
> > user every hour as well.
> >
> > Is approaching this with a text file like this a bad way to go?  I like
>  text
> > files, I understand them.  Does perl have any tools to make this easier
>  for
> > me?

Perhaps you misunderstood:

  "I don't think file locking will be an issue"

"tieing" to a file and "locking" a file are entirely different things.
Locking is used to gain exclusive use of a file, or to methodically
share it with other users.

Tie-ing, on the other hand, creates a realtime association between an
Perl Varaiable (scalar, array, and perhaps most often a hash) and a
special kind of file(s)  created by the program itself. Since the file
persists after the program executes, so does the associated var.

But they are definitely NOT the same thing.

G


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

Date: 23 Dec 2003 23:08:14 -0800
From: afriedman111@hotmail.com (Aaron)
Subject: effecient software engineering
Message-Id: <a038b5c9.0312232308.1a1ca321@posting.google.com>

I read that scripting is very useful in software engineering.  I
picked up some video game programming books and they mention that
scripting can be used to  seperate the code that is likely to change
from the core game engine.

I have heard that Perl is widely used in the game programming
industry. Can perl scripting used for this?  If not, what is it used
for?  If it is used for this, how does Perl communicate with the main
game engine? Can some one explain how this works?  For example: are
there two executables that run and communicate back and forth, or is
there only one executable?  Is there a Perl interpreter that reads in
scripts into your main program?


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

Date: 24 Dec 2003 05:52:40 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: effecient software engineering
Message-Id: <776e0325.0312240552.183bd210@posting.google.com>

afriedman111@hotmail.com (Aaron) wrote in message news:<a038b5c9.0312232308.1a1ca321@posting.google.com>...
> I read that scripting is very useful in software engineering.  I
> picked up some video game programming books and they mention that
> scripting can be used to  seperate the code that is likely to change
> from the core game engine.
> 
> I have heard that Perl is widely used in the game programming
> industry. Can perl scripting used for this?  If not, what is it used
> for?  If it is used for this, how does Perl communicate with the main
> game engine? Can some one explain how this works?  For example: are
> there two executables that run and communicate back and forth, or is
> there only one executable?  Is there a Perl interpreter that reads in
> scripts into your main program?

Listen dude I'm not one to say "read the FQA" or "don't post there
here" because basically I believe in Free Speech, and there are more
than enough of those parrots here, but in your case I have to make an
exception. Try

   http://www.perl.com

for starters. There are lots of Perl stories and anecdotal uses for
perl. perl.org/advocacy is usually pretty good too but it appears to
have either been hacked or some jolly joker is pranking us right now
over there.

Your question is sort of like writing to General Motors and saying
"I've heard these cars of yours are useful for driving to the grocery
store. What other uses do they have?". Sort of a tough question to
really answer isn't it?

Happy Holodaze!


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

Date: 24 Dec 2003 03:22:47 -0800
From: poppy2173@hotmail.com (Poppy Gerard)
Subject: How to write a script that takes input from the screen and writes a number to a text file?
Message-Id: <dc7a50cc.0312240322.2150c515@posting.google.com>

24/12/03 - am

Hi there.  I am not sure if PERL is the right way to do this - but I
am trying to generate a simple script that will run at a Website and
accept a numerical input typed in on the screen, and write the number
to a simple ASCII text file.

Does anyone know how one can do this with PERL, or is there a better /
easier way to generate such a program on-line?

I would be grateful for any help / advice that people may be able to
offer.

With many thanks,
and Seasons Greetings,


Poppy Gerard
poppy2173@hotmail.com


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

Date: Wed, 24 Dec 2003 12:00:12 -0000
From: "Ragnar Hafstað" <gnari@simnet.is>
Subject: Re: How to write a script that takes input from the screen and writes a number to a text file?
Message-Id: <bsbv4q$5vd$1@news.simnet.is>

"Poppy Gerard" <poppy2173@hotmail.com> wrote in message
news:dc7a50cc.0312240322.2150c515@posting.google.com...
> 24/12/03 - am
>
> Hi there.  I am not sure if PERL is the right way to do this - but I
> am trying to generate a simple script that will run at a Website and
> accept a numerical input typed in on the screen, and write the number
> to a simple ASCII text file.
>
> Does anyone know how one can do this with PERL, or is there a better /
> easier way to generate such a program on-line?
>
> I would be grateful for any help / advice that people may be able to
> offer.

I am sorry, but it really sounds like your best option is to get someone to
do it for you , because your question seems to indicate that you have no
idea what you are talking about.

That said, assuming I am decoding your question correctly and you want
a html form page on the website and a script to process whatever the user
entered into it and submitted, then yes, Perl is a way to do it.
You can use the CGI module to interface with the webserver.

gnari






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

Date: Wed, 24 Dec 2003 08:29:45 +0100
From: =?ISO-8859-1?Q?St=E9phane_M=E9tais?= <stephane.metais-pourriel@laposte.net>
Subject: Install Perl module on Windows
Message-Id: <3fe94069$0$1158$636a55ce@news.free.fr>

Hello,

I need to add a few PERL modules to my ActivePerl 5.6.1 distribution.
Some of them require a c-compiler
Since my hosts are not dev stations, they don't have any C-compiler.

Could you please advise me for a "light weight" c-compiler which could 
be easyly installed before perl modules ?

TIA

Merry Christmas

--
Stéphane
please remove -pourriel in my address for response



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

Date: Tue, 23 Dec 2003 23:43:44 -0800
From: "Tom" <tom@nosleep.net>
Subject: Re: Install Perl module on Windows
Message-Id: <3fe94fa0$1@nntp0.pdx.net>


"Stéphane Métais" <stephane.metais-pourriel@laposte.net> wrote in message
news:3fe94069$0$1158$636a55ce@news.free.fr...
> Hello,
>
> I need to add a few PERL modules to my ActivePerl 5.6.1 distribution.
> Some of them require a c-compiler
> Since my hosts are not dev stations, they don't have any C-compiler.
>
> Could you please advise me for a "light weight" c-compiler which could
> be easyly installed before perl modules ?

Borland has a free C compiler at www.borland.com
They used to, anyway.

Tom




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

Date: Wed, 24 Dec 2003 08:05:25 GMT
From: "Nick Santos" <DSX@comcast.net>
Subject: Re: Install Perl module on Windows
Message-Id: <9NbGb.633176$HS4.4610538@attbi_s01>

http://www.bloodshed.net

free compiler called dev C++; uses the mingw32 compiler (I think) and has a
nice little workspace
If you like linux style environments, http://www.cygwin.com - that can give
you a lot more than a c compiler too
both can be fairly simpel or fairly complex

"Stéphane Métais" <stephane.metais-pourriel@laposte.net> wrote in message
news:3fe94069$0$1158$636a55ce@news.free.fr...
> Hello,
>
> I need to add a few PERL modules to my ActivePerl 5.6.1 distribution.
> Some of them require a c-compiler
> Since my hosts are not dev stations, they don't have any C-compiler.
>
> Could you please advise me for a "light weight" c-compiler which could
> be easyly installed before perl modules ?
>
> TIA
>
> Merry Christmas
>
> --
> Stéphane
> please remove -pourriel in my address for response
>




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

Date: 24 Dec 2003 05:59:53 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: LWP with proxy problem
Message-Id: <776e0325.0312240559.613c4dd4@posting.google.com>

kent_zunker@bmc.com (Woogie) wrote in message news:<4a31f52f.0312231243.25828446@posting.google.com>...
> When running the sample code below without a proxy the GET returns the
> expected data.  When run with the $proxy uncommented the GET returns
> the content of the login page for the site being accessed.  The site
> in the code is valid for ease of testing.  I also am including the LWP
> debug info for each attempt.
> 
> Can anyone explain this behavior and what can I do to correct it?
> 
> Thanks in advance
> 
> Trace without proxy:
> 
> LWP::UserAgent::new: ()
> LWP::UserAgent::request: ()
> LWP::UserAgent::send_request: GET
> https://squid.servebeer.com/getservices.do?user=Guest&password=JustLooking&format=csv
> LWP::UserAgent::_need_proxy: Not proxied
> LWP::Protocol::http::request: ()
> LWP::Protocol::collect: read 28 bytes
> LWP::UserAgent::request: Simple response: OK
> 
> Home
> PE
> 
> 
> Trace with proxy:
> 
> LWP::UserAgent::new: ()
> LWP::UserAgent::proxy: https http://148.245.207.85:8080
> LWP::UserAgent::request: ()
> LWP::UserAgent::send_request: GET
> https://squid.servebeer.com/getservices.do?user=Guest&password=JustLooking&format=csv
> LWP::UserAgent::_need_proxy: Proxied to http://148.245.207.85:8080
> LWP::Protocol::http::request: ()
> LWP::Protocol::collect: read 236 bytes
> LWP::Protocol::collect: read 594 bytes
> LWP::Protocol::collect: read 416 bytes
> LWP::Protocol::collect: read 450 bytes
> LWP::Protocol::collect: read 1017 bytes
> LWP::Protocol::collect: read 443 bytes
> LWP::Protocol::collect: read 643 bytes
> LWP::UserAgent::request: Simple response: OK
> 
> <html lang="en">
> 
> <!-- Start Head -->
> <head>
>   <title>
> 
>     Error
> 
>   </title>
>   <script language="JavaScript">
> ...
> 
> 
> 
> Here is the sample code:
> 
> 
> #!/usr/bin/perl -w
> 
> use LWP::UserAgent; 
> use HTTP::Request; 
> use HTTP::Response; 
> use Crypt::SSLeay;
> 
> LWP::Debug::level('+');
> 
> $url = "https://squid.servebeer.com/getservices.do?user=Guest&password=JustLooking&format=csv";
> #$proxy="http://xxx.xxx.xxx.xxx:8080";
> 
> $ua = LWP::UserAgent->new(); 
> 
> if (defined $proxy) 
>  {
>  $ENV{HTTPS_PROXY} = $proxy;
>  
>   # initialize from environment variables
>  $ua->env_proxy;
>  }
>  
> $req = HTTP::Request->new(GET => $url);
> $response = $ua->request($req);
> if ($response->is_error()) 
>  {
>  printf " %s\n", $response->status_line;
>  } 
>  
> else 
>  {
>  $content = $response->content();
>  print $content;
>  } 
> 
> exit;

might want to try on one of the cgi groups or even comp.perl.modules ?


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

Date: Wed, 24 Dec 2003 16:10:14 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: newbie: Terminating while($line=<stdin>) on Windows
Message-Id: <slrnbui7tm.qbf.mgjv@martien.heliotrope.home>

On 23 Dec 2003 19:03:57 -0800,
	John Deuf <google@spongers.com> wrote:
> "Madhur" <a_madhur@vsnl.net> wrote in message news:<bsa11g$b8aej$1@ID-81175.news.uni-berlin.de>...
>> Hello
>> while($line==<stdin>)
>> {
>> 
>> }
>> How would this be terminated. It is terminated by  ^D on Unix system I
>> think.
>> But on windows It doesnt work.
> 
> Hi,
> 
> maybe the line should be read as
> 
>    while($line eq <stdin>)
> 
> But it is certainly not what you want.
> If the initial line was 
> 
>    while($line = <stdin>)
> 
> you expect maybe that the while stops when STDIN becomes false.

Not really. Thw loop would exit when <stdin> becomes undefined (not
false, but specifically undefined, see perlop documentation), and that
happens when there are no more lines to be read from the handle stdin
(not STDIN, Perl is case sensitive), i.e. when end-of-file is reached.

> With a PC you may have to face the ^M ending char, the irritating
> carriage-return char added to line-feed. I.e. on PC, 2 chars to end
> the line.

Huh?

If you're on an operating system where in a file the end of line is
represented by more than one character, then inside of Perl, the end of
line is still a simple "\n". End of line is always "\n", irrespective of
what the representation in the external file is.

If you transport such files between platforms, and don't correctly
convert the end-of-line sequences, then you could end up reading
spurious characters, but that simply means that you're not reading a
regular text file for the platform you're on.

I am, of course, assuming that you're reading this file in text mode,
since end-of-line makes no sense in any other context.

> To cope with that problem, I propose this, but I'm sure there are
> better algorithms, using $_ for instance :)
> 
>    while (<STDIN>)          # get line in $_ { chomp;              #
>    removes the unix LF char s/\015//;           # removes the PC CR

If, on windows, you would actually see a \015 there, then that would
mean that the external file had a \015 before its normal end-of-line,
and there would have been a byte sequence of \015\015\012 in the file.
That's not really a text file, and indicates a problem with the file,
rather than with the program or programmer. Or it indicates that the
originator of the file wanted to have that extra \015 in there, for
whatever sick reason.

BTW, the end-of-line character (yes, a single one only) on Unix is \012,
not \015. Macs use a single \015, and windows uses \015\012. Also see
the perlport documentation for more information.

If oyu want to remove newlines, use chomp(). If you need to read broken
files, write specific routines to deal with that, but please, don't
advocate the use of this sort of code for regular text files. it is not
necessary, and in fact, broken.

You should not have to worry about what your machine uses as the
end-of-line indicator. In Perl it will be \n, and chomp will remove it.

>    char $line = $_;         # if you really want the $line var...

And if you really want the "$line var", then you should simply use it,
and not $_:

while (my $line = <STDIN>)
{
    chomp $line; # to remove the newline
    # blahblah
}

Why use $_ at all? And why not scope the variable appropriately?

Martien
-- 
                        | 
Martien Verbruggen      | We are born naked, wet and hungry. Then
                        | things get worse.
                        | 


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

Date: Wed, 24 Dec 2003 06:25:14 GMT
From: kosowsky@consult.pretender (Jeffrey J. Kosowsky)
Subject: SOLVED:: HTML::Form->Parse (Perl) not working under Fedora Core 1
Message-Id: <m2r7yuwx4n.fsf@consult.pretender>

kosowsky@consult.pretender (Jeffrey J. Kosowsky) writes:

> I have been having trouble getting the HTML::Form library to work
> under Fedora Core 1 (perl 5.8.1-92 with perl-libwww-perl-5.65-6). For
> some reason, the function HTML::Form->Parse doesn't return any forms
> for me.
> 
> For example, the following simple perl script:
> 	#! /usr/bin/perl
> 	
> 	use HTML::Form;
> 	use HTTP::Request;
> 	use LWP;
> 	
> 	my $ua = new LWP::UserAgent;
> 	my $uri="http://www.google.com";
> 	my $req = HTTP::Request->new(GET => $uri);
> 	my $res = $ua->request($req);
> 	print $res->content;
> 	my $form = HTML::Form->parse($res->content, $res->base());
> 	print "Form: ${form}\n";
> 
> Returns the source of the www.google.com page but fails to return the
> obvious embedded form.
> 
> The only potential problem I see is that the library Form.pm is stored
> under: /usr/lib/perl5/vendor_perl/5.8.0/HTML/Form.pm (rather than 5.8.1)
> 
> I did not have any problems with this previously under RH8.0 with perl
> 5.8.0-88 and perl-libwww-perl-5.65-2.noarch.rpm)

The cause of the problem is as follows:

The function report_tags in the Perl module HTML::Parser does not give
the right result when using the current
perl-HTML-Parser-3.26-18.i386.rpm package which apparantly was
compiled against an earlier version of Perl. (Among other things, this
causes the Perl function, HTML::Form->Parse to fail as noted in my
original posting).

It appears that the problem is due to a binary incompatibility between
Perl 5.8.0 and 5.8.1 caused by the introduction of hash randomization
in Perl 5.8.1. (Note that the report_tags function is defined as an
HV*).

The solution is to simply rebuild the src rpm under Fedora Core 1/Perl
5.8.1.

I am not sure if this binary incompatibility between Perl 5.8.0 and
5.8.1 affects any other Perl modules, but it might be a good idea to
check this out and see whether any of the other Perl packages need to
be rebuilt for Fedora Core 1.

I am surprised though that no one else has noticed this bug yet, since
it seems to affect a pretty fundamental Perl module...


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

Date: Wed, 24 Dec 2003 13:12:51 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: SOLVED:: HTML::Form->Parse (Perl) not working under Fedora Core 1
Message-Id: <20031224081251.2b3d4c99.jwillmore@remove.adelphia.net>

On Wed, 24 Dec 2003 06:25:14 GMT
kosowsky@consult.pretender (Jeffrey J. Kosowsky) wrote:
> kosowsky@consult.pretender (Jeffrey J. Kosowsky) writes:
> The cause of the problem is as follows:
> 
> The function report_tags in the Perl module HTML::Parser does not
> give the right result when using the current
> perl-HTML-Parser-3.26-18.i386.rpm package which apparantly was
> compiled against an earlier version of Perl. (Among other things,
> this causes the Perl function, HTML::Form->Parse to fail as noted in
> my original posting).
> 
> It appears that the problem is due to a binary incompatibility
> between Perl 5.8.0 and 5.8.1 caused by the introduction of hash
> randomization in Perl 5.8.1. (Note that the report_tags function is
> defined as an HV*).
> 
> The solution is to simply rebuild the src rpm under Fedora Core
> 1/Perl 5.8.1.
> 
> I am not sure if this binary incompatibility between Perl 5.8.0 and
> 5.8.1 affects any other Perl modules, but it might be a good idea to
> check this out and see whether any of the other Perl packages need
> to be rebuilt for Fedora Core 1.
> 
> I am surprised though that no one else has noticed this bug yet,
> since it seems to affect a pretty fundamental Perl module...

No offense, but I don't bother with RPM's when it comes to Perl
modules.  In fact, given your position (a new install of Fedora), the
*first* thing I'd do is use the CPAN shell and start updating *all*
the modules.  Because the *most* of the Perl modules that come with
*most* distros are horribly out of date "out of the box".  And the
RPM's are usually not much better.  

I'd get used to using the CPAN shell instead of using the RPM's - but
that's just my opinion :-)

HTH

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
To iterate is human, to recurse, divine. 



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

Date: 24 Dec 2003 05:54:02 GMT
From: ctcgag@hotmail.com
Subject: Re: Why does Perl use more resource than Php?
Message-Id: <20031224005402.506$h3@newsreader.com>

"I Report, You Decide" <test@test.com> wrote:
> A hosting service lungcapage has banned yabb, because it takes too much
> CPU/memory, but phpBB is fine. Is that perl/php or the script itself? why
> perl sucks more resource of a server than php? i thought only mod-perl
> will suck not regular perl.

use Blatant::Liar;
print "yabb was so much better that many more people were using it\n";
print "so it consumed lots of resources\n";
__END__

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service              New Rate! $9.95/Month 50GB


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

Date: Wed, 24 Dec 2003 17:04:09 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Why does Perl use more resource than Php?
Message-Id: <2152714.EQIoAXye0M@gregs-web-hosting-and-pickle-farming>

It was a dark and stormy night, and I Report, You Decide managed to scribble:

> A hosting service lungcapage has banned yabb, because it takes too much
> CPU/memory, but phpBB is fine. Is that perl/php or the script itself? why
> perl sucks more resource of a server than php? i thought only mod-perl
> will suck not regular perl.
> 

Do like I do - run user mode linux with root access for about the same price as a virtual ISP. Run whatever you like.

See http://user-mode-linux.sourceforge.net/uses.html for a list of UML ISPs.

gtoomey


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

Date: Wed, 24 Dec 2003 09:15:47 GMT
From: "I Report, You Decide" <test@test.com>
Subject: Re: Why does Perl use more resource than Php?
Message-Id: <7PcGb.234161$Ec1.8274391@bgtnsc05-news.ops.worldnet.att.net>

> "I Report, You Decide" <test@test.com> wrote in message
> news:Ln4Gb.232551$Ec1.8219387@bgtnsc05-news.ops.worldnet.att.net...
> > A hosting service lungcapage has banned yabb, because it takes too much
> > CPU/memory, but phpBB is fine. Is that perl/php or the script itself?
>
> yabb != perl.  Did the hosting service "ban" perl?  That should answer
your
> question.
>
>

the hosting corp does not bann perl, but banns yabb, because saying it takes
TOO MUCH CPU/memory. i just wnat to know if the yabb problme is a perl
problem or the problme of the yabb script only




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

Date: 24 Dec 2003 10:55:25 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Why does Perl use more resource than Php?
Message-Id: <slrnbuis4t.is0.sholden@flexal.cs.usyd.edu.au>

On Wed, 24 Dec 2003 09:15:47 GMT, I Report, You Decide <test@test.com> wrote:
>> "I Report, You Decide" <test@test.com> wrote in message
>> news:Ln4Gb.232551$Ec1.8219387@bgtnsc05-news.ops.worldnet.att.net...
>> > A hosting service lungcapage has banned yabb, because it takes too much
>> > CPU/memory, but phpBB is fine. Is that perl/php or the script itself?
>>
>> yabb != perl.  Did the hosting service "ban" perl?  That should answer
> your
>> question.
>>
>>
> 
> the hosting corp does not bann perl, but banns yabb, because saying it takes
> TOO MUCH CPU/memory. i just wnat to know if the yabb problme is a perl
> problem or the problme of the yabb script only

If it was a perl problem they would ban perl, yes?

But they don't ban perl, they ban a specific application that is too
resource intensive for their machines.

What that application is written in is irrelevant (if it was they would
ban that language and not just the application).

-- 
Sam Holden


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

Date: Wed, 24 Dec 2003 12:13:51 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Why does Perl use more resource than Php?
Message-Id: <bsbsa8$bm7fo$1@ID-184292.news.uni-berlin.de>

Sam Holden wrote:
> What that application is written in is irrelevant (if it was they
> would ban that language and not just the application).

I'm not following you, Sam. A Perl app that means a large number of
new processes, which I suppose is the case with a bulletin board, may
well reach the limit as regards how much CPU a web host accepts,
without the host necessarily having to ban Perl for smaller
applications. And there may be other languages that require less CPU
for a similar app, so the language may well be relevant.

(mod_perl is sometimes useful in cases like this, but very few web
hosts offer that option.)

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Wed, 24 Dec 2003 12:48:10 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Why does Perl use more resource than Php?
Message-Id: <20031224074810.22758994.jwillmore@remove.adelphia.net>

On Wed, 24 Dec 2003 09:15:47 GMT
"I Report, You Decide" <test@test.com> wrote:

> > "I Report, You Decide" <test@test.com> wrote in message
> > news:Ln4Gb.232551$Ec1.8219387@bgtnsc05-news.ops.worldnet.att.net.
> > ..
> > > A hosting service lungcapage has banned yabb, because it takes
> > > too much CPU/memory, but phpBB is fine. Is that perl/php or the
> > > script itself?
> >
> > yabb != perl.  Did the hosting service "ban" perl?  That should
> > answer
> your
> > question.
> >
> >
> 
> the hosting corp does not bann perl, but banns yabb, because saying
> it takes TOO MUCH CPU/memory. i just wnat to know if the yabb
> problme is a perl problem or the problme of the yabb script only

This all sounds like yabb problem :-)

Seriously .... if you want to find out where the "problems" are with
yabb, then run some benchmarks and find out.  You could, if using a
*NIX system, use the 'time' command to see which is using more cpu
time.  For a strictly Perl look at the situation, check out the
various Devel modules to aid in finding out where yabb  "bottlenecks"
are.

In general, this really isn't a Perl issue - it's one you're having
with your host and is based upon what *they* have told you.  Find out
for yourself and then decide if *they* are right :-)

HTH

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
Bugs, pl. n.:  Small living things that small living boys throw
on small living girls. 


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

Date: Wed, 24 Dec 2003 11:01:15 GMT
From: johnny <shelton@NOoSPnAMr.com>
Subject: would someone tell me why this didn't work?
Message-Id: <%leGb.86256$HH.13388@fe1.texas.rr.com>

I wrote a script to process text in a bunch of files.
While working on it, I would test it on one file, just to 
see how it was going. BUT, when i tried to run it on all 
the input files, it wouldn't work. It would only do the 
first file found in the input directory. After I 
commented out "reset $t;" the script processed all files 
in the input directory.

What I don't understand is why ?????
Come to think of it, I don't even remember why I put the 
line in there in the first place.

Thanks!
~johnny


#!/usr/bin/perl -w
use strict;
foreach (@ARGV) {
    my $infile = $_;
    print "Now parsing $infile\n";
    my $outfile = $infile;
    $outfile =~ s/lists/data/;

    open IN, '<'.$infile || die "Error: $!\n";
    open OUT, '>'.$outfile || die "Error: $!\n";

    $/ = "\n\n";
    while(defined ( my $t = <IN>)) {
       #do stuff here with $t
       $t =~ s/\n\t//g;
       $t =~ s/\t/ /g;
       my @card = split /\n/m,$t;
       foreach(@card) {
          print OUT $_."\n";
          if( $_ =~ /^Rar/) {
             print OUT "\n";
          }
       } #foreach(@card)
#######################################
###  THIS LINE HERE
#     reset $t;
###  STUPID LINE x(
#######################################
    } #while(defined (my $t = <IN>))

    close OUT;
    close IN;
} #foreach(@ARGV)



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

Date: 24 Dec 2003 11:37:57 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: would someone tell me why this didn't work?
Message-Id: <slrnbuiukl.j9a.sholden@flexal.cs.usyd.edu.au>

On Wed, 24 Dec 2003 11:01:15 GMT, johnny <shelton@NOoSPnAMr.com> wrote:
> I wrote a script to process text in a bunch of files.
> While working on it, I would test it on one file, just to 
> see how it was going. BUT, when i tried to run it on all 
> the input files, it wouldn't work. It would only do the 
> first file found in the input directory. After I 
> commented out "reset $t;" the script processed all files 
> in the input directory.

What does $t contain at the time? And why are you resetting those
variables?

Does it happen to contain 'A' - which I suspect would break the forach 
(as it wiped out @ARGV)?

I have *never* used reset (I use my variables for which is does nothing),
why do you think you need it?

> What I don't understand is why ?????
> Come to think of it, I don't even remember why I put the 
> line in there in the first place.

Maybe you could try commenting you code so that you do remember why
you decided to use reasonably obscure features.

[snip code]

-- 
Sam Holden


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

Date: Wed, 24 Dec 2003 23:04:26 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: would someone tell me why this didn't work?
Message-Id: <slrnbuj06a.qbf.mgjv@martien.heliotrope.home>

On Wed, 24 Dec 2003 11:01:15 GMT,
	johnny <shelton@NOoSPnAMr.com> wrote:
> I wrote a script to process text in a bunch of files.
> While working on it, I would test it on one file, just to 
> see how it was going. BUT, when i tried to run it on all 
> the input files, it wouldn't work. It would only do the 
> first file found in the input directory. After I 
> commented out "reset $t;" the script processed all files 
> in the input directory.
> 
> What I don't understand is why ?????
> Come to think of it, I don't even remember why I put the 
> line in there in the first place.

> #######################################
> ###  THIS LINE HERE
> #     reset $t;
> ###  STUPID LINE x(
> #######################################

Do you know what reset() does? It resets all variables and arrays
beginning with the letters in $t. So, if $t contains "A", for example,
it would reset @ARGV, which you use (this is specifically mentioned in
the documentation for reset, with the "A-Z" example.

Maybe you were trying to "reset" $t itself, but reset() does not work
for lexical variables. Besides that, $t would be fresh on every
iteration of the loop anyway, so even if it could be reset, it'd be
useless.

If you really think you need to "reset" $t, just undef() it.

I've been writing stuff in Perl since the early 90s, and I can't recall
ever having used or needed reset().

I'd say you probably put it in there in the mistaken belief that it did
something useful, and you're now finidng out it doesn't, and, in fact,
that it's dangerous.

Martien
-- 
                        | 
Martien Verbruggen      | Useful Statistic: 75% of the people make up
                        | 3/4 of the population.
                        | 


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

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.  

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


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