[23407] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5625 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 6 21:05:48 2003

Date: Mon, 6 Oct 2003 18:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 6 Oct 2003     Volume: 10 Number: 5625

Today's topics:
    Re: GD::Graph: "mixed" graph doesn't recognize "area" g (Emilio Mayorga)
    Re: How replace ing2004 to ing-2004 ? please help <REMOVEsdnCAPS@comcast.net>
    Re: Opinions on "new SomeObject" vs. "SomeObject->new() <tore@aursand.no>
    Re: Opinions on "new SomeObject" vs. "SomeObject->new() <uri@stemsystems.com>
    Re: Opinions on "new SomeObject" vs. "SomeObject->new() <REMOVEsdnCAPS@comcast.net>
    Re: Opinions on "new SomeObject" vs. "SomeObject->new() (Randal L. Schwartz)
    Re: Perl::Inline compiling problems <kalinaubears@iinet.net.au>
        require and do - absolute vs relative - let me try agai <wunkalunka@elvis.com>
    Re: require and do - absolute vs relative - let me try  <mbudash@sonic.net>
        require and do - relative vs absolute? <wunkalunka@elvis.com>
    Re: require and do - relative vs absolute? <invalid-email@rochester.rr.com>
    Re: Strange behaviour with '\r' character (i5513)
    Re: Strange behaviour with '\r' character (David Efflandt)
    Re: two regexs <mbudash@sonic.net>
    Re: two regexs (ko)
        Virus, CPU killer, Memory Eater on Sourceforge.net? <test@test.com>
    Re: Virus, CPU killer, Memory Eater on Sourceforge.net? (Sam Holden)
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 6 Oct 2003 17:16:35 -0700
From: e.mayorga@co.snohomish.wa.us (Emilio Mayorga)
Subject: Re: GD::Graph: "mixed" graph doesn't recognize "area" graph type
Message-Id: <faa70e85.0310061616.437e484a@posting.google.com>

Martien Verbruggen <mgjv@tradingpost.com.au> wrote in message news:<slrnbnq1at.d8h.mgjv@martien.heliotrope.home>...
> On 1 Oct 2003 14:42:42 -0700,
> 	Emilio Mayorga <e.mayorga@co.snohomish.wa.us> wrote:
> > Martien Verbruggen <mgjv@tradingpost.com.au> wrote in message news:<slrnbnk7nn.d8h.mgjv@martien.heliotrope.home>...
> >> On 30 Sep 2003 11:55:49 -0700,
> >> 	Emilio Mayorga <e.mayorga@co.snohomish.wa.us> wrote:
> >> > Hi,
> >> > 
> >> > I'm using the GD::Graph module to create some graphs (great module,
> >> > BTW!). Everything works fine. But in a "mixed" graph, "area" graphs
> >> > are not recognized. I get this error message:
> >> > [snip] unknown type area, assuming lines at [snip]
> >> > I am trying to create a chart with two lines and three area graphs.
> >> > The lines work fine. Area graphs work fine when used by themselves
> >> > (not in a mixed graph); I wrote a small program to test this.
> >> 
> >> That's odd. Area charts should work. There's an example (sample61) in
> >> the distribution that uses lines, bars, points, area, and linespoints,
> >> all in one chart. Where is the code you tried?
>  
> > http://www.co.snohomish.wa.us/publicwk/swm/maps/floodwarn2.pl
> > You'll find a sample output graph here:
> > http://www.co.snohomish.wa.us/publicwk/swm/maps/hydrograph_sens585.png
> > The three colored dashed horizontal lines are the ones I'm trying to
> > turn into area graphs. Each one of them is specified as a simple set
> > of two points, the start and end of the line.
> 
> I've had a bit of a look at it, but I can't really see what's wrong with
> it (if anything at all). Would it be possible for you to just fill the
> $sensorgraph{$sensorid} hashes with some decent values, and then run the
> GD::Graph part separately? if you then still see problems, please email
> the result to me, because that probably means there is some bug or
> oddity that I need to have a look at.

Thanks for looking into it. I'll try to do that test, but a deadline
is creeping up on me, so it may be a while. I'll definitely try to
follow up if the problem persists. I expect to make heavy use of
GD::Graph for several projects in the future.

Best,

Emilio


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

Date: Mon, 06 Oct 2003 19:15:56 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: How replace ing2004 to ing-2004 ? please help
Message-Id: <Xns940CCE236C79Dsdn.comcast@206.127.4.25>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

"François" <avril@ece.fr> wrote in news:blrqe4$i6a$1
@s1.read.news.oleane.net:

> I want to replace an expression abc1234 to abc-1234 how can i do
> I 've tried
> 
> s/......./$1$2$3-$4$5$6$7/ but it dont work.
> 
> Please help ?

In order for $1 (etc) to work, the left-hand side of the expression needs 
to have parentheses in it.  For example:

    s/(.)(.)(.)(.)(.)(.)(.)/$1$2$3-$4$5$6$7/

should do the trick for you.

The following:

    s/(...)(....)/$1-$2/

does the same thing (effectively), but is shorter and easier to write.

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP4IFtWPeouIeTNHoEQKECgCgwuDkBaMvCKw/oyw2eo7TCgcd1W4AoM2U
/nwmtz5QEnAVUVQjogosdg0F
=Du8q
-----END PGP SIGNATURE-----


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

Date: Tue, 07 Oct 2003 01:01:25 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: Opinions on "new SomeObject" vs. "SomeObject->new()"
Message-Id: <pan.2003.10.06.22.10.04.899495@aursand.no>

On Mon, 06 Oct 2003 14:36:33 -0700, Patriote wrote:
> Some programmers use the style 
> 
> $objSome = new SomeObject;
> 
> instead of
> 
> $objSome = SomeObject->new();
> 
> What are the penalties for using the former Java-like syntax if any? 
> I've heard that it can cause problems with inheritance, but I've read
> no specifics.

I prefer the latter, but as long as you design your classes to expect them
to be used both ways, there shouldn't be any difference;

  sub new {
      my $proto = shift;
      my $class = ref( $proto ) || $proto;
  }


-- 
Tore Aursand <tore@aursand.no>


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

Date: Tue, 07 Oct 2003 00:39:18 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Opinions on "new SomeObject" vs. "SomeObject->new()"
Message-Id: <x7k77hhoeh.fsf@mail.sysarch.com>

>>>>> "TA" == Tore Aursand <tore@aursand.no> writes:

  >> $objSome = new SomeObject;
  >> $objSome = SomeObject->new();

  TA> I prefer the latter, but as long as you design your classes to
  TA> expect them to be used both ways, there shouldn't be any
  TA> difference;

  TA>   sub new {
  TA>       my $proto = shift;
  TA>       my $class = ref( $proto ) || $proto;
  TA>   }

the way a method is called has no semantic effect on the method
itself. the method is always passed the object or class as the first
argument. the difference between indirect (bad) and direct (good) method
calls is a matter of syntax and possible issues with what sub gets
called. see my other post for info on that.

your code above has nothing to do with how the method is called. rather it
allows it to be called with either an object or a classname.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Mon, 06 Oct 2003 19:39:54 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Opinions on "new SomeObject" vs. "SomeObject->new()"
Message-Id: <Xns940CD233996E9sdn.comcast@206.127.4.25>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

patriote@fastmail.fm (Patriote) wrote in 
news:dced8a08.0310061336.35f80601@posting.google.com:

> Some programmers use the style 
> 
> $objSome = new SomeObject;
> 
> instead of
> 
> $objSome = SomeObject->new();
> 
> What are the penalties for using the former Java-like syntax if any? 
> I've heard that it can cause problems with inheritance, but I've read
> no specifics.

I personally think it makes NO sense to create a new object from an 
existing one unless the new object is somehow a child or otherwise a 
descendant of the existing object.  Thus, I never do:

    $new_object = $old_object->new();

and I never code my new() methods to expect to be called from an existing 
object.

For creating new objects, I think that

    $new_object = new Object;

makes intuitive sense -- "give me a new Object".  It reads like English.  
On the other hand,

    $new_object = Object->new();

makes less sense to me, but at least I don't have to code differently for 
it.  Users of my modules can use either syntax.

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBP4ILUmPeouIeTNHoEQLyywCfTwMFSRzrRgkHfvj4/C2yHD3wF9oAoIew
QOcbChXi6bJH8/rLpl9GRAl7
=w42G
-----END PGP SIGNATURE-----


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

Date: Tue, 07 Oct 2003 00:57:18 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Opinions on "new SomeObject" vs. "SomeObject->new()"
Message-Id: <46b66f20b77de2df240f56f0d283aef8@news.teranews.com>

>>>>> "Patriote" == Patriote  <patriote@fastmail.fm> writes:

Patriote> Some programmers use the style 
Patriote> $objSome = new SomeObject;

Patriote> instead of

Patriote> $objSome = SomeObject->new();

Patriote> What are the penalties for using the former Java-like syntax if any? 
Patriote> I've heard that it can cause problems with inheritance, but I've read
Patriote> no specifics.

"Indirect Object" syntax can sometimes be ambiguous.  Even Simon
Cozens got bit by it <http://blog.simon-cozens.org/bryar.cgi/id_6416>.

I can't recommend it for any normal code now.

-- 
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!


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

Date: Tue, 07 Oct 2003 09:56:10 +1000
From: Sisyphus <kalinaubears@iinet.net.au>
Subject: Re: Perl::Inline compiling problems
Message-Id: <3f8201d2$0$23608$5a62ac22@freenews.iinet.net.au>

Brian K. Michalk wrote:
> michalk@awpi.com (Brian K. Michalk) wrote in message news:<c30723e3.0310060616.78cbc24e@posting.google.com>...
> 
>>I posted this over in perl.inline, but there's not much traffic there.
>>

Yeah - it's generally pretty quiet over there. Got a nice little note 
from ezmlm just this morning, informing me that my mail from that list 
is being bounced by my ISP. (That should help to maintain the 
peacefulness - for me, at least :-)

> 
> 
> Replying to myself here, I want to say that I've managed to resolve
> most of the issues.  I still have some problems though.  When I
> compile the C to test my code, I use the following command:
> 
> gcc -lm -o testnnlibs testnnlibs.c 110in1outa.c nnsn.c
> 
> This pulls in code from two other libraries, and magically makes the
> executable.  It works.
> 
> I have yet to find a way to tell Inline::C how to pull in my other
> source files.

By way of example, this works (code transcribed - beware of typos):

The perl file:
----------------------
#try.pl

use Inline (C => 'test/s1.c');
use Inline (C => 'test/s2.c');
use Inline C => <<'EOC';
void dumb3() {
      printf("Hello from main\n");
      }

EOC

dumb1();
dumb2();
dumb3();
__END__
----------------------

The first C file:
----------------------
/* test/s1.c */

void dumb1() {
      printf("Hello from s1.c\n");
      }
----------------------

The second C file:
----------------------
/* test/s2.c */

void dumb2() {
      printf("Hello from s2.c\n");
      }
----------------------

Running 'perl try.pl' produces:

Hello from s1.c
Hello from s2.c
Hello from main

Caveat:
1) The source file ('s1.c') needs to be in a separate directory from 
'try.pl'. (Or maybe it just needs to be in a directory other than the 
cwd - haven't tested.)

I would think that the 2 opening Config statements in the perl script 
could be combined into one - but I lost interest after my first 2 
attempts to do just that failed :-)

Hope there's something there that helps you find a satisfactory solution.

Incidentally, passing an AV* as an arg to an inline function won't work 
on perl 5.6.0/1. (Just in case it matters.)

Cheers,
Rob


-- 
To reply by email u have to take out the u in kalinaubears.



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

Date: Mon, 06 Oct 2003 22:46:08 GMT
From: Derf <wunkalunka@elvis.com>
Subject: require and do - absolute vs relative - let me try again
Message-Id: <Xns940CB5135666Cwunkalunkaelviscom@24.28.95.190>

I have a file at /path/from/root/cgi-bin/file.pl

and I want to require /path/from/root/cgi-bin/dir/requirefile.pl

the web root would be /cgi-bin/file.pl and the user root would be 
/path/from/root/cgi-bin/file.pl

when i use an absolute path in file.pl:

do "/path/from/root/cgi-bin/dir/requirefile.pl";

or

require "/path/from/root/cgi-bin/dir/requirefile.pl";

i get the error 

***corrected error from previous message:

Can't do: No such file or directory at /path/from/root/cgi-
bin/file.pl line ##.

but if I move file.pl to /path/from/root/cgi-bin/dir/file.pl

and then do a relative call:

require "requirefile.pl";

or 

do "requirefile.pl";


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

Date: Mon, 06 Oct 2003 22:52:43 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: require and do - absolute vs relative - let me try again
Message-Id: <mbudash-52D362.15524306102003@typhoon.sonic.net>

In article <Xns940CB5135666Cwunkalunkaelviscom@24.28.95.190>,
 Derf <wunkalunka@elvis.com> wrote:

> I have a file at /path/from/root/cgi-bin/file.pl
> 
> and I want to require /path/from/root/cgi-bin/dir/requirefile.pl
> 
> the web root would be /cgi-bin/file.pl and the user root would be 
> /path/from/root/cgi-bin/file.pl
> 
> when i use an absolute path in file.pl:
> 
> do "/path/from/root/cgi-bin/dir/requirefile.pl";
> 
> or
> 
> require "/path/from/root/cgi-bin/dir/requirefile.pl";
> 
> i get the error 
> 
> ***corrected error from previous message:
> 
> Can't do: No such file or directory at /path/from/root/cgi-
> bin/file.pl line ##.
> 
> but if I move file.pl to /path/from/root/cgi-bin/dir/file.pl
> 
> and then do a relative call:
> 
> require "requirefile.pl";
> 
> or 
> 
> do "requirefile.pl";

here's what i'd do:

try:

require './dir/requirefile.pl';

if that doesn't work, you'll need to determine what the actual path is 
and use that. assuming unix (and why not?), put in a:

print `pwd`;

to figure it out.

-- 
Michael Budash


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

Date: Mon, 06 Oct 2003 22:41:50 GMT
From: Derf <wunkalunka@elvis.com>
Subject: require and do - relative vs absolute?
Message-Id: <Xns940CB4589784Fwunkalunkaelviscom@24.28.95.190>

I have a file at /path/from/root/cgi-bin/file.pl

and I want to require /path/from/root/cgi-bin/dir/requirefile.pl

the web root would be /cgi-bin/file.pl and the user root would be 
/path/from/root/cgi-bin/file.pl

when i use an absolute path in file.pl:

do "/path/from/root/cgi-bin/dir/requirefile.pl";

or

require "/path/from/root/cgi-bin/dir/requirefile.pl";

i get the error 

Can't do: No such file or directory at /path/from/root/cgi-
bin/dir/requirefile.pl line ##.

but if I move file.pl to /path/from/root/cgi-bin/dir/file.pl

and then do a relative call:

require "requirefile.pl";

or 

do "requirefile.pl";

it works fine

any ideas why?

Thanks for any help

Derf


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

Date: Tue, 07 Oct 2003 00:22:18 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: require and do - relative vs absolute?
Message-Id: <3F820680.403@rochester.rr.com>

Derf wrote:

> I have a file at /path/from/root/cgi-bin/file.pl
> 
> and I want to require /path/from/root/cgi-bin/dir/requirefile.pl
> 
> the web root would be /cgi-bin/file.pl and the user root would be 
> /path/from/root/cgi-bin/file.pl
> 
> when i use an absolute path in file.pl:
> 
> do "/path/from/root/cgi-bin/dir/requirefile.pl";
> 
> or
> 
> require "/path/from/root/cgi-bin/dir/requirefile.pl";
> 
> i get the error 
> 
> Can't do: No such file or directory at /path/from/root/cgi-
> bin/dir/requirefile.pl line ##.
> 
> but if I move file.pl to /path/from/root/cgi-bin/dir/file.pl
> 
> and then do a relative call:
> 
> require "requirefile.pl";
> 
> or 
> 
> do "requirefile.pl";
> 
> it works fine
> 
> any ideas why?
 ... 
> Derf 

Could maybe be because the luser your CGI script is running under (like 
"nobody", perhaps?) doesn't have permissions all the way down the chain 
from root?

CGI debugging is a FAQ, and, as the FAQ mentions, is also off-topic here 
(your question and its answer would be the same if your script was 
written in C, Befunge, etc).  Please see:

    perldoc -q 500

-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl



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

Date: 6 Oct 2003 17:46:02 -0700
From: i5513@hotmail.com (i5513)
Subject: Re: Strange behaviour with '\r' character
Message-Id: <a657ec02.0310061646.13f1b81@posting.google.com>

tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnbo2sra.gec.tadmc@magna.augustmail.com>...
> i5513 <i5513@hotmail.com> wrote:
> 
> > Hi!. I don't understand ...
> 
> 
> It would be easier for us to help you if you actually said
> what it is that you don't understand...
> 
It was my presentation, ok next time I'll be faster asking you.
> 
> > (After get parameters)
> 
> 
> You should use the CGI.pm module for that.
>
Ok I'll look for CGI.pm module. 
> 
> > if ($FORM{"text"} =~ /^(\s|\n|\r)*$/) 
>                              ^^ ^^
>                              ^^ ^^ this part will *never* match
> 
> 
> These will match exactly the same as the above:
> 
>    if ($FORM{"text"} =~ /^\s*$/)
> 
>    if ($FORM{"text"} =~ /^[\r\n\t\f ]*$/)
> 
Ok I didn't remember \s significate
> > with one simple return
> > on textarea. 
> 
> 
> Saying it in Perl is always better than trying to say it in English.
> 
> You say that sentence in Perl like this:
> 
>    my %FORM = ( text => "\r\n" );
> or
>    $FORM{text} = "\r\n";
Ok I don't know english very well, as you can see
> 
> Have you seen the Posting Guidelines that are posted here frequently?
> 
Posting Guidelines, for this group or for any group? I read a bit
about general guidelines.
> > It gives me next result:
> > Hey! It is here!
> > Now it isn't here!
> 
> 
> Those are the expected results.
Ok, I now understand it.

Thanks you very much, and excuse me my post's style


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

Date: Tue, 7 Oct 2003 00:50:51 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Strange behaviour with '\r' character
Message-Id: <slrnbo43fb.d72.efflandt@typhoon.xnet.com>

On 6 Oct 2003 02:02:18 -0700, i5513 <i5513@hotmail.com> wrote:
> Hi!. I don't understand ...
> 
> At a html page:
><form name="form1" method="POST" action="example.cgi" >
><textarea name="text"></textarea>
></form>
> 
> At a cgi script (example.cgi)
> (After get parameters)
> if ($FORM{"text"} =~ /^(\s|\n|\r)*$/) 

matches "\n" (would match even it $FORM{"text"} was undefined, because
you are matching zero or more).

> { 
>   print "<HTML>";
>   if ($FORM{"text"} =~ /\r/)

matches because $FORM{"text"} contains "\r"

>   {
>     print "Hey! It is here! <BR> ";
>   }
>   if ($FORM{"texto_in"} =~ /^(\s|\n)*$/)

matches zero or more whitespaces or newlines (even if $FORM{"texto_in"} is
undefined)

>   {
>     print "Now it isn't here!";
>   }
>   print "</HTML>";
>   exit (1); 
> }
> 
> Well, When I execute (on Windows) this script with one simple return
> on textarea. It gives me next result:
> Hey! It is here!
> Now it isn't here!

In a textarea, the enter key typically returns a CR-LF pair "\015\012"
(regardless of browser OS).  Search for 'Newlines' in 'perldoc perlport'
to see why /\n/ may match "\015\012" in DOS/Win.

-- 
David Efflandt - All spam ignored  http://www.de-srv.com/


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

Date: Mon, 06 Oct 2003 22:21:56 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: two regexs
Message-Id: <mbudash-368714.15215606102003@typhoon.sonic.net>

In article <slrnbo3nc8.h04.tadmc@magna.augustmail.com>,
 tadmc@augustmail.com (Tad McClellan) wrote:

> Matija Papec <perl@my-header.org> wrote:
> > tadmc@augustmail.com (Tad McClellan) wrote:
> 
> >>> Afaik CGI.pm, can't deal with predefined forms
> >>
> >>What is a "predefined form" ?
> > 
> > I have forms stored in html files and need to populate them with user or db
> > input.
> 
> 
> That is client-side then? 
> 
> If so, then the server-side CGI module is of course not the Right Tool.
> 
> The Perl FAQ points to the Right Tool:
> 
>    perldoc -q " form "
> 
>           How do I automate an HTML form submission?
> 
> (despite the fact that the question has nothing to do with HTML...)
> 
> 
> Or are you talking about something else?
> 
> (maybe I still don't know what a "predefined form" is?)

i think the o.p. is simply talking about html templates. HTML::Template 
or Template Toolkit sound appropriate here...

-- 
Michael Budash


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

Date: 6 Oct 2003 17:57:14 -0700
From: kuujinbo@hotmail.com (ko)
Subject: Re: two regexs
Message-Id: <92d64088.0310061657.62c37115@posting.google.com>

Matija Papec <perl@my-header.org> wrote in message news:<l7v2ov8bp775mrtulreb26qc3t9o8oo0k5@4ax.com>...
> X-Ftn-To: Greg Bacon 
> 
> gbacon@hiwaay.net (Greg Bacon) wrote:

[snip]

> >Is there a reason you're not using CGI.pm or another CGI module
> >from the CPAN that doesn't have this limitation?
> 
> Afaik CGI.pm, can't deal with predefined forms, and solutions from cpan seem
> bloated. :!

I'm not sure how you're defining bloated - maybe not loading modules
if its not necessary? If you don't mind looking into HTML::TreeBuilder
(you also need HTML-Parser and HTML-Tagset, maybe that's what you mean
by bloated), the code itself isn't that bad:

====CODE

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

use HTML::TreeBuilder;

my $html;
{
  local $/;
  $html = <DATA>;
}

my $root = HTML::TreeBuilder->new;
$root->parse($html); # parse_file method to pass in file/filehandle
$root->eof;
my @input_tags = $root->look_down('_tag', 'input'); # 'input'/any
other tag
foreach my $tag(@input_tags) {
  if ( $tag->attr('type') =~ /text/i ) {
    $tag->attr('value', 'user input'); # to delete, second argument
undef
  } elsif ( $tag->attr('type') =~ /checkbox/i) {
    # your test to determine whether is checked
    $tag->attr('checked', 'checked');
  } else {
    # other stuff
  }
  print $tag->as_HTML;
}

__DATA__
<form>
<input maxlength=50 name="IME" size=50 type="text" value="Default">
<input name="Q1" type="CHECKBOX" value="A1">A1
<input name="Q1" type="CHECKBOX" value="A2">A2
<input name="Q1" type="CHECKBOX" value="A3">A3
</form>

====END

The attr() method allows you to read/manipulate any tag's attribute.
And it will also work for a group of checkboxes with the same name :)

HTH - keith


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

Date: Mon, 06 Oct 2003 23:54:32 GMT
From: "Public Interest" <test@test.com>
Subject: Virus, CPU killer, Memory Eater on Sourceforge.net?
Message-Id: <Ygngb.171373$3o3.12569897@bgtnsc05-news.ops.worldnet.att.net>

I am not sure it is my problem or a general problem. Last week, there was a
hack on changing your DNS record on your PC via IE. The hackers use banners
on forturncity, a free web hosting company to do that. It seems to me
somebody hacked to sourceforge now. I went to
http://sourceforge.net/projects/ayttm/ or
http://sourceforge.net/projects/miranda-icq/

Then my CPU usage is at 100%. Memory is OK. Can anyone look into this? How
do I know what in IE is killer my CPU? A javascript or something? I found
two scripts doing that online, but not sure if sourceforge is having any of
it. I understand the second trick, but not the first hanging trick


1:hangs IE
<html>
<head>
<title>The Nasty Javascript Tricks: Stop your Browser</title>
</head>
<body onUnload="spawntopfivewindow();"
 background="images/bg1.gif" bgcolor="#000000"
text="#FFFFFF" link="#336699" vlink="#336699" alink="#666666">
<center>
<script language="Javascript">
<!-- hide

document.write('<font size=-3><img
src="http://www.fortunecity.com/banners/track1.gif" height=1 width=1%
border="0" name="FCimg11bnr" hspace=0 vspace=0>');
document.write('<img src="http://www.fortunecity.com/banners/foo.gif"
height=1% width=1 border="0" name="FCimg12bnr" hspace=0 vspace=0><br
clear=all></font>');

// -->
</script>

<script language="Javascript"
src="http://www.fortunecity.com/timstuff/adscript.global.new.js">
</script>

<table id=fcnavbartable style="visibility:hidden" cellpadding=0
cellspacing=0 border=0 width=730>
<tr align=center id=fcnavbartablerow>
<td>
<table cellpadding=0 cellspacing=0 border=0 width="100%">
<form name="searchForm"
action="http://search.fortunecity.com:8080/findwhatSearchBox.jsp"
method="post" onSubmit="return IsEmpty(document.searchForm.searchterm);"
target="_blank">
<input type="hidden" name="css" value="fc">
<tr align=center>
<td width="3%"><a id="fcnavlogo" href="http://www.fortunecity.com"
target="_new"><img
src="http://www.fortunecity.com/images/fclogo_inline_new.gif" alt="web
hosting, domain name, free web site, email address" width="120" height="15"
border="0"></a></td>
<td width="22%"><a id="fcnavhosting" href="http://www.fortunecity.com/"
style="font-family:Verdana,sans-serif;font-size:11px;" target="_new">web
hosting</a></td>
<td width="24%"><a id="fcnavdomains" href="http://www.fortunecity.com/"
style="font-family:Verdana,sans-serif;font-size:11px;" target="_new">domain
names</a></td>
<td width="26%"><a id="fcnavemail" href="http://home.v3.com/"
style="font-family:Verdana,sans-serif;font-size:11px;" target="_new">email
addresses</a></td>
<td width="2%"><img id="fcnavsrchgif"
src="http://www.fortunecity.com/images/nb_search_new.gif" alt="search"
width="55" height="15" border="0"></td>
<td width="21%" id="fcnavsearch"><input type="text" name="searchterm"
maxlength=100 style="border: 1px solid
#000000;width:100%;height:15px;font-family:Verdana, Arial, Helvetica,
Sans-Serif;font-size:11px;" value="-enter search term-"
onfocus="this.value=''; return true;"></td>
<td width="2%" id="fcnavsrchsub"><input type="image"
src="http://www.fortunecity.com/images/nb_go_search.gif" width="30"
height="15" alt="GO"></td></tr>
</form>
</table>
</td>
</tr>
</table>

<script language="Javascript">
<!-- hide

FCLocale = 'unknown';

DefineDefaultVars();


DisplayFCAdBanner();

// -->
</script>

<table id="fcnavbartable2" style="visibility:hidden" cellpadding=0
cellspacing=0 border=0 width="730">
<tr><td><iframe id="fcpopular"
src="http://www.fortunecity.com/banners/popular.html" width="100%"
height="15" align="center" frameborder="no" border="0" scrolling="no"
marginwidth="0" marginheight="0"></iframe></td>
</tr></table>

</center>


<script language="Javascript">
<!--

        fc_color_string = 'bgcolor=' + document.bgColor + '&' +
        'fgcolor=' + document.fgColor + '&' +
        'linkcolor=' + document.linkColor + '&' +
        'alinkcolor=' + document.alinkColor + '&' +
        'vlinkcolor=' + document.vlinkColor;

        document.getElementById('fcpopular').src =
document.getElementById('fcpopular').src + '?' + escape(fc_color_string);

        FCNavbarResize();

// -->
</script>






<!-- BEGIN INTERNET LINK EXCHANGE CODE -->
<p align="center"><a
href="http://ad.linkexchange.com/6/X116511/gotoad.map"
target="_TOP"><img
src="http://ad.linkexchange.com/6/X116511/logoshowad?free"
alt="Internet Link Exchange" align="bottom" border="0" ismap></a> <!--
  END INTERNET LINK EXCHANGE CODE  --><script language="JavaScript"> <!--
{while(true)window.location='http://WW.What.the.fuck.is.this'}
// --></script> </p>
<script language="Javascript">
<!--hide

var my_clientip = '129.1.1.1';

if (document.getElementById('userIP') != null) {

        document.getElementById('userIP').value = my_clientip;
}

setonclickmethods();


// -->
</script>

<center>
<div id="fclinkback" style="visibility:hidden"><p>
<font face="Verdana, Helvetica, Arial, sans-serif" size=1><a
id="fcfootergif" href="http://www.fortunecity.com/" target="_new"><img
src="http://www.fortunecity.com/images/fc_logo_white122x30.gif"
border=0></a><br><a id="fcfooterhosting" href="http://www.fortunecity.com/"
target="_new">web hosting</a> &bull; <a id="fcfooterdomains"
href="http://www.fortunecity.com/" target="_new">domain names</a><br>Powered
by <a href="http://www.ampira.com" target="_new">Ampira</a></font>
</p></div>
</center>

<script language="Javascript">
<!--

if(FrameisBigEnough == 1) {

        document.getElementById('fclinkback').style.visibility = "visible";
 document.getElementById('fcfootergif').search = '?sid=fcfootergif';
 document.getElementById('fcfooterhosting').search = '?sid=fcfooterhosting';
 document.getElementById('fcfooterdomains').search = '?sid=fcfooterdomains';

}

// -->
</script>

</body>
</html>

2:Eating your memory
<html><body onload="hello()">
<script language="JavaScript"><!--
var hi="comp.lang.perl.misc"
function hello()
{hi=hi + hi
window.status=" "
window.setTimeout('hello()',1);}
// --></script>
</body>
</html>





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

Date: 6 Oct 2003 23:58:54 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Virus, CPU killer, Memory Eater on Sourceforge.net?
Message-Id: <slrnbo40du.6j3.sholden@flexal.cs.usyd.edu.au>

On Mon, 06 Oct 2003 23:54:32 GMT, Public Interest <test@test.com> wrote:
> I am not sure it is my problem or a general problem. Last week, there was a
> hack on changing your DNS record on your PC via IE. The hackers use banners
> on forturncity, a free web hosting company to do that. It seems to me
> somebody hacked to sourceforge now. I went to
> http://sourceforge.net/projects/ayttm/ or
> http://sourceforge.net/projects/miranda-icq/

What does this have to do with perl?

[snip lots of drivel, none of which is related to perl]

-- 
Sam Holden



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

Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: 
Message-Id: <3F18A600.3040306@rochester.rr.com>

Ron wrote:

> Tried this code get a server 500 error.
> 
> Anyone know what's wrong with it?
> 
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {

(---^


>     dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
 ...
> Ron

 ...
-- 
Bob Walton



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

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


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