[23111] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5332 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 7 21:06:07 2003

Date: Thu, 7 Aug 2003 18:05:09 -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           Thu, 7 Aug 2003     Volume: 10 Number: 5332

Today's topics:
    Re: Any way to stop a kill? <grazz@pobox.com>
    Re: Any way to stop a kill? <minceme@start.no>
    Re: Can't use "open my" with pipe <REMOVEsdnCAPS@comcast.net>
    Re: Checkbox into an Array ? <GPatnude@HotMail.com>
    Re: Checkbox into an Array ? <andy@andyh.co.uk>
    Re: Checking number of instances running <emschwar@ldl.fc.hp.com>
    Re: Final "Flocking" Script <noreply@gunnar.cc>
    Re: Final "Flocking" Script (Tad McClellan)
        Find Files By Date <member32995@dbforums.com>
    Re: Find Files By Date <ndronen@io.frii.com>
    Re: Find Files By Date <noreply@gunnar.cc>
    Re: Find Files By Date <noreply@gunnar.cc>
    Re: help needed making unicode entities <flavell@mail.cern.ch>
    Re: help with regular expression <member32995@dbforums.com>
    Re: help with regular expression <member32995@dbforums.com>
    Re: help with regular expression <spamblock@junkmail.com>
    Re: help with regular expression (Tad McClellan)
    Re: help with regular expression (Tad McClellan)
    Re: I need GD for Redhat 9 <mgjv@tradingpost.com.au>
    Re: nested HTML parsing <syscjm@gwu.edu>
    Re: Out of memory when reading big file (more question) <GPatnude@HotMail.com>
    Re: using tr and ascii value <REMOVEsdnCAPS@comcast.net>
    Re: very simple question <mgjv@tradingpost.com.au>
    Re:  <bwalton@rochester.rr.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 07 Aug 2003 22:19:37 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: Any way to stop a kill?
Message-Id: <ZfAYa.162$sb4.131@nwrdny01.gnilink.net>

Marshall Dudley <mdudley@execonn.com> wrote:
> After a customer orders something, emails get sent to
> me and the customer by a perl [ed: CGI] script.
>
> Is there any way to keep the process from being killed
> before the emails are sent out?

Not exactly; but you can start a child process that the
webserver doesn't know about.

    sub bg (&) {
        require POSIX;

        defined( my $pid = fork ) or return;
        return $pid if $pid;

        fork and exit;
        POSIX::setsid();

        open STDIN,  "</dev/null"   or warn "STDIN:  $!";
        open STDOUT, ">/dev/null"   or warn "STDOUT: $!";
        chdir "/"                   or warn "chdir:  $!";

        my $code = shift;
        $code->(@_);
        exit;
    }

    bg { sendmail(@args) } or die "whoops: $!";

Trouble is, you don't know what became of the kid.  If you're
going to be honest, the page will have to say something like
"Your mail has been queued for delivery" and provide a way to
check on the status later.

You might also want to tune your sendmail.

-- 
Steve


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

Date: Thu, 7 Aug 2003 22:25:41 +0000 (UTC)
From: Vlad Tepes <minceme@start.no>
Subject: Re: Any way to stop a kill?
Message-Id: <bgujl5$bhb$1@troll.powertech.no>

Marshall Dudley <mdudley@execonn.com> wrote:

> After a customer orders something, emails get sent to me and the
> customer by a perl script.  Lately the server has been loaded more
> heavily than normal, and the sendmail is taking a while to complete and
> for control to return back to perl.  Unfortunatly some customers are
> either browsing elsewhere, or hitting stop while the sendmail is sending
> the email, and a kill is generated which kills the emails to me and the
> customer.
>
> Is there any way to keep the process from being killed before the emails
> are sent out?  This is a rather serious problem for me right now.

[ Untested info from unverified sources, cited by memory,
  in other words:       BEWARE, the following might be bad advice ] 

I've recently heard rumours that apache first sends a SIGTERM, waits
three seconds and then sends SIGKILL when killing cgi's.  SIGKILL will
finish off your program, but SIGTERM is trappable. Creating a handler
for that signal could give you three seconds to figure out something
smart to do. Maybe even just ignoring the signal ($SIG{TERM} = 'IGNORE')
would give you time enough for most mail to be sent.

( Note: It could be smart to use a perl module like Mail::Mailer to send
  mail instead of using sendmail. Maybe it wouldn't fix your immediate
  problem, but your script could be more portable. )

-- 
Vlad


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

Date: Thu, 07 Aug 2003 18:59:57 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Can't use "open my" with pipe
Message-Id: <Xns93D0CB72F82F6sdn.comcast@206.127.4.25>

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

jain@gmx.net (Eric) wrote in news:835c2e5d.0308070457.76803137
@posting.google.com:

> This works:
> 
>   open SOURCE 'gunzip -c test.rdf.gz|' or die $!;
>   my $source = \*SOURCE;

open my $source, 'gunzip -c test.rdf.gz|' or die $!;


 
> This doesn't ("No such file or directory"):
> 
>   open my $source, '<', 'gunzip -c test.rdf.gz|' or die $!;

You're trying to read from a file called 'gunzip -c test.....'
When using the three-argument form of open, the middle argument indicates 
how you want the file (or pipe) to be opened, not any special character in 
the filename string.
 
- -- 
Eric
$_ =  reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print

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

iQA/AwUBPzLn/WPeouIeTNHoEQIVpgCg6TLuIJC3fkyT9LSX5aKi8TYogrQAoMhA
HQIbc52UHmwZGcxaRZK+WYXf
=YsEF
-----END PGP SIGNATURE-----


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

Date: Fri, 08 Aug 2003 00:09:04 GMT
From: "codeWarrior" <GPatnude@HotMail.com>
Subject: Re: Checkbox into an Array ?
Message-Id: <ASBYa.10899$jg.3248101@news1.news.adelphia.net>


"Sylvie Stone" <sylviestone@canada.com> wrote in message
news:181a24a8.0308070516.6e12bc8d@posting.google.com...
> Hi group - I have an html form where users can query the database
> based on a bunch of criteria but I'm having trouble capturing all the
> checked checkboxes to build the select statement. In php I would just
> use implode.
>
> I've been trying to use 'join' but to no avail.
> The checkbox options are generated dynamically:
>
> $dbh->prepare("select id,name from statuslookup where inactive is NULL
> order by id");
> $sth->execute();
> my $ref_allrows = $sth->fetchall_arrayref;
> my $i;
> for $i (0 .. $#{$ref_allrows}) {
>  print "<input type=checkbox name=\"statuscodearray[]\"
> value=\"$ref_allrows->[$i][0]\">$ref_allrows->[$i][0]
> $ref_allrows->[$i][1]";
> }
>
> Then to process the form onsubmit:
>
> <snip>
>
>  my @statuscodearray;
>  my $statuscode = join(" ", @statuscodearray);
>
> <snip>
>
>   if (length($statuscode) > 0) {
>     $build_query = "$build_query and statuslink = '$statuscode'";
>   }
>
>
> The array will hold integers like this:
> select blah from blahblah where statuslink in ('1', '44', '55', '77')
> .... ;
>
> THANK YOU ! This is driving me crazy!
>
> Sylvie.

Here's a working example of the Perl part to process a block of checkboxes
that contain a number -- this assums that you are able to sucessfully create
your checkboxes in your HTML form and that they are part of a checkbox group
(I.E -- All named the same... )

    @ASSIGNPLAN = $capture->param('ASSIGNPLAN');
    $PLANLIST = join(',', @ASSIGNPLAN);

    if ($#ASSIGNPLAN > 0) {

     # THE FOLLOWING ALLOWS PLAN REMOVAL REGARDLESS OF EMPLOYEE ENROLLMENT
STATUS...
     $SQLSTMT = "DELETE FROM cb_person_plan WHERE cb_person_id =
$PARAMS{PERSON_ID} AND cb_plan_id NOT IN ($PLANLIST);";
     $SQL = $DBT->prepare($SQLSTMT);
     $result = $SQL->execute();

    }

HTH....




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

Date: Fri, 08 Aug 2003 01:16:20 +0100
From: Andy Hassall <andy@andyh.co.uk>
Subject: Re: Checkbox into an Array ?
Message-Id: <iep5jvkgn9nl9nbc8r3b0dvrp3mse2bvuh@4ax.com>

On Thu, 07 Aug 2003 15:17:46 -0000, "David K. Wall" <usenet@dwall.fastmail.fm>
wrote:

>> Is it legal to have [] in the name of a form element?
>
>No. See http://www.w3.org/TR/html4/types.html#type-cdata

 Do you have a reference in the specification where it limits the valid
characters for the name attribute of the input element?

http://www.w3.org/TR/html4/interact/forms.html#h-17.4

 ... shows name to be of type CDATA; not of the restricted types ID or NAME.

http://www.w3.org/TR/html4/interact/forms.html#control-name

 ... doesn't appear to have any notes on restrictions not represented by the
DTD. It says to refer to the individual control for any further restrictions;
the notes for INPUT doesn't list any.

http://www.w3.org/TR/html4/interact/forms.html#adef-name-INPUT

 Would be interesting to find something in the specification that explicitly
says that [] is illegal in the name, since PHP uses that for producing arrays
out of sets of checkboxes as in the OP's form, for example.

> which of course has nothing to do with Perl.

 Hm, yes, probably need to take it to comp.infosystems.www.authoring.html or
similar.

--
Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)


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

Date: Thu, 07 Aug 2003 16:46:16 -0600
From: Eric Schwartz <emschwar@ldl.fc.hp.com>
Subject: Re: Checking number of instances running
Message-Id: <etovft9w0g7.fsf@wormtongue.emschwar>

"Rene Scheibe" <Rene.Scheibe@Stud.TU-Ilmenau.de> writes:
>> my $processname = "script.pl";
>> $instances = `ps aux|grep $processname`;
>> exit if $instances;
>
> this exits even if no instance of the script
> is running because "ps aux|grep script.pl"
> itself is shown as process. and using awk
> will slow down things i think.

$instances = `ps aux | grep $processname | grep -v grep | wc -l`
exit if $instances > $limit;

-=Eric
-- 
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
		-- Blair Houghton.


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

Date: Fri, 08 Aug 2003 00:15:37 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Final "Flocking" Script
Message-Id: <bguj0b$sv5sm$1@ID-184292.news.uni-berlin.de>

Alan J. Flavell wrote:
> On Tue, Aug 5, Gunnar Hjalmarsson inscribed on the eternal scroll:
>> Alan J. Flavell wrote:
>>> Of course, it also gives an unprofessional impression if it
>>> happens to a bona fide user. Ideally you should cover all known
>>> failure modes at development time, and supply user-friendly
>>> responses for them, rather than exposing the end-users to what
>>> are _supposed_ to be your internal diagnostics.
>> 
>> I'm distributing a CGI script to largely novise users (mostly on 
>> shared hosting accounts without access to the error logs...),
> 
> I'm afraid you misinterpreted my meaning of the term 'user' here.

Yes, so it seems.

> Naturally, those who are installing the script should get these
> kind of diagnostics until the scripts are working.

Okay, then we are talking about adding the recommendation to the
installation instructions that the fatalsToBrowser() routine is
commented out when the script is up and running. I take it as a
_warning_ to be _considered_. :)

You mentioned the risk for helping possible intruders as a reason to
do so.

I can see two reasons against it:

- Web hosts offering shared accounts often have the bad habit of
changing things without informing their customers. When that happens,
it's useful to see the resulting error messages.

- It would make the installation a little more difficult. (In my case,
fatalsToBrowser() is called from each one of 15+ *.pl scripts.)

So, basically we are talking about security vs. convenience. So far, I
have concluded that - _in my particular case_ - the convenience aspect
carries greater weight.

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



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

Date: Thu, 7 Aug 2003 19:13:24 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Final "Flocking" Script
Message-Id: <slrnbj5qp4.4e4.tadmc@magna.augustmail.com>

Alan J. Flavell <flavell@mail.cern.ch> wrote:

> we had a hacker into our system for a couple of months
> before we became aware of him (and, as far as we could diagnose
> afterwards, we only became aware of him as an accident


The "Star Wars secrets for cocaine" hackers of the 1980s were
tripped up due to a $0.75 discrepency in billing for computer time.

The book about that incident, "The Cuckoo's Egg" (Clifford Stoll),
is a very good read. Kept me up until 3am two nights...


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 07 Aug 2003 22:19:29 +0000
From: gnet <member32995@dbforums.com>
Subject: Find Files By Date
Message-Id: <3215289.1060294769@dbforums.com>


Does anyknow know how to get all the files in a directory based off of
creation date (this will be in Windows, unfortunately).

For example, get an array of all files in C:\temp created between
10/10/2000 and 11/25/2000 , etc, etc ...

Thanks for any help in advance!

--
Posted via http://dbforums.com


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

Date: 07 Aug 2003 22:37:32 GMT
From: Nicholas Dronen <ndronen@io.frii.com>
Subject: Re: Find Files By Date
Message-Id: <3f32d4ac$0$200$75868355@news.frii.net>

gnet <member32995@dbforums.com> wrote:

g> Does anyknow know how to get all the files in a directory based off of
g> creation date (this will be in Windows, unfortunately).

g> For example, get an array of all files in C:\temp created between
g> 10/10/2000 and 11/25/2000 , etc, etc ...

$ perldoc File::Find
$ perldoc -f stat
$ perldoc -f -X # also useful but not immediately relevant

Regards,

Nicholas

-- 
"Why shouldn't I top-post?"    http://www.aglami.com/tpfaq.html
"Meanings are another story."  http://www.ifas.org/wa/glossolalia.html


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

Date: Fri, 08 Aug 2003 01:26:10 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Find Files By Date
Message-Id: <bgun50$s1ggr$1@ID-184292.news.uni-berlin.de>

gnet wrote:
> Does anyknow know how to get all the files in a directory based off
> of creation date (this will be in Windows, unfortunately).
> 
> For example, get an array of all files in C:\temp created between 
> 10/10/2000 and 11/25/2000 , etc, etc ...

One idea:

     #!/usr/bin/perl
     use strict;
     use warnings;

     use Time::Local 'timelocal';

     my $dirpath = 'C:/temp';
     my @s = split /\//, '10/10/2000';
     my @e = split /\//, '11/25/2000';

     my $starttime = timelocal(0,0,0, $s[1], $s[0]-1, $s[2]-1900);
     my $endtime = timelocal(0,0,0, $e[1]+1, $e[0]-1, $e[2]-1900);

     opendir DIR, $dirpath;
     my @files = grep {
         (stat "$dirpath/$_")[9] >= $starttime
         and (stat "$dirpath/$_")[9] < $endtime
     } readdir DIR;
     closedir DIR;

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



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

Date: Fri, 08 Aug 2003 02:09:42 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Find Files By Date
Message-Id: <bgupmp$sm19o$1@ID-184292.news.uni-berlin.de>

Gunnar Hjalmarsson wrote:
> 
>         (stat "$dirpath/$_")[9] >= $starttime
-------------------------------^

A correction: OP asked about _creation_ date, which I for some 
inscrutable reason 'converted' to last modified date...

Change [9] to [10] to select out from creation date.

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



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

Date: Fri, 8 Aug 2003 00:15:07 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: help needed making unicode entities
Message-Id: <Pine.LNX.4.53.0308080000320.5874@lxplus013.cern.ch>

On Fri, Aug 8, Dan Jacobson inscribed on the eternal scroll:

> Why does
>   use HTML::Entities; use utf8; print
> HTML::Entities::encode_entities_numeric("\xE7\xA9\x8D"); print
>   &#xE7;&#xA9;&#x8D;
> i.e. three entities, instead of one?

I think I'm going to have to leave the author to answer that; but my
question would be, did you have a reason for choosing that particular
solution?  All you're trying to do is decode utf-8 and then represent
the answer in decimal.

> Those three bytes represent a Chinese character.

Yup, I could well believe that those three octets taken as utf-8
indeed represent a CJK unified character.

> Must I explore pack()?

Possibly.  But why do you want to write out the nitty details of a
utf-8 coded octet stream?  What's the _real_ starting point of this
exercise?

> Not only do I wish to convert one unicode character (three bytes), but
> also a whole string of them.

[ into HTML &bignumber; representations, apparently. ]

Starting from what?  If you want to read them in, then read them in
(with :utf8 in effect, of course);  and then use ord() to find out
what they are.

> Is that to much to ask?

Too much? I don't think so, but maybe the best way to reach a good
answer is to present the actual problem, rather than complaining about
an apparently non-working solution to an only incompletely stated
problem.

The easy way, btw, is to read your utf-8-encoded data into Mozilla,
edit it, and then save it as iso-8859-1-encoded.  Mozilla will happily
then convert your CJK characters into &bignumber; representations.
But that's clearly off-topic for here.

Disclaimer: I don't read CJK, and at my time of life I'm probably
unlikely to start; but I'm still interested in the character coding
technology.


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

Date: Thu, 07 Aug 2003 22:17:12 +0000
From: gnet <member32995@dbforums.com>
Subject: Re: help with regular expression
Message-Id: <3215287.1060294632@dbforums.com>


$text =~ /ABA.+ABA|ABA.+000/;
$found = $&;

--
Posted via http://dbforums.com


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

Date: Thu, 07 Aug 2003 22:23:33 +0000
From: gnet <member32995@dbforums.com>
Subject: Re: help with regular expression
Message-Id: <3215290.1060295013@dbforums.com>


$text =~ /ABA.+ABA|ABA.+000/s;
$found = $&;

can't forget the s at the end ... then you could just replace the \n
with something if you want.

--
Posted via http://dbforums.com


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

Date: Thu, 7 Aug 2003 16:44:29 -0700
From: "David Oswald" <spamblock@junkmail.com>
Subject: Re: help with regular expression
Message-Id: <vj5p90gh5hnj0c@corp.supernews.com>


"gnet" <member32995@dbforums.com> wrote in message
news:3215290.1060295013@dbforums.com...
>
> $text =~ /ABA.+ABA|ABA.+000/s;
> $found = $&;

If I'm not mistaken, you've just matched everything including the trailing
ABA or 000.  My understanding was that he wanted to match ABA, a bunch of
anything, until he reaches the next ABA or 000, but not including the next
ABA or 000.  I could be wrong, but I think your code also matches greedily,
which didn't sound to me like the original poster's desire.

The following will do exactly what you've asked for.

#!/usr/bin/perl
# You *are* using strict and warnings, aren't you?
use strict;
use warnings;
my $text = "alsdfjadslfjasfABA001 abcdefg hijklmno aaaaa bbbbbABA0002";
$text =~ /(ABA.*?)(ABA|000)/s;
print $1.$/;

The problem is that it won't do what you actually want (there's a difference
between what you've asked for and what you actually want).  This will find
the first occurrance.  If you want to find all occurrences, you have to do
it a little different.  Just adding /g won't work, because you've matched
the trailing ABA|000, which means that you could have gobbled up the next
starting sequence.

The other thing to be wary of is the temptation to use .+, which matches one
or more thigns inbetween the tags.  Or .*, which matches zero or more
things.  The problem is that those are greedy quantifiers, and would give
you evrything between the first ABA and the last ABA|000, including any
ABA's and 000's in between.  The ? following the quantifiers will make it a
non-greedy match, capturing as little as possible instead the most possible.
In a list context you would have to backtrack or consider using split
instead.

Now I feel somewhat guilty having done your homework for you.  But I think
you've still got a bit to chew on before it's done.

Dave




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

Date: Thu, 7 Aug 2003 19:22:52 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: help with regular expression
Message-Id: <slrnbj5ras.4e4.tadmc@magna.augustmail.com>

gnet <member32995@dbforums.com> wrote:
> 
> $text =~ /ABA.+ABA|ABA.+000/;
> $found = $&;


This is wrong on multiple fronts.

You should *never* use the match variables unless you have first
ensured that the match _succeeded_, since match variables are left
with their old stale values when a match fails.

It will not work with the data that was shown, you need the m//s option.

It will not work when there is more than one record in $text, for
that you'd need non-greedy matching.

It will not work for some arrangements of "both kinds" of records,
namely when an ABA/000 record is followed by an ABA/ABA record
because matching happens left-to-right.


I encourage folks to ignore that followup.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 7 Aug 2003 19:25:37 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: help with regular expression
Message-Id: <slrnbj5rg1.4e4.tadmc@magna.augustmail.com>

the dude <jason@memorycheaper.net> wrote:

> i need to write one that will search for and display:
> 
> the letters "ABA", the text in between, until it finds the next
> instance of "ABA" or "000"


Assuming you have the text in $_ :

   print "$1\n" if /(ABA.+?)(ABA|000)/s;


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: 07 Aug 2003 23:23:08 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: I need GD for Redhat 9
Message-Id: <slrnbj5nqu.41m.mgjv@verbruggen.comdyn.com.au>

On Thu, 7 Aug 2003 21:51:28 +1000,
	Gregory Toomey <NOSPAM@bigpond.com> wrote:
> "Jim Rendant" <jrendant@comcast.net> wrote in message
> news:7TednarMlYtlr6-iXTWJjw@comcast.com...
>> I downloaded the GD module from CPAN and tried to compile it on redhat 9
> and
>> it fails. Where can I get a pre-compiled version of this module?
>>
>> I am also looking to run the GD::barcode module. Is this also pre
> compiled?
>>
>> Have a great day!
>> Jim Rendant
> 
> I had some trouble as well. There seems to be lots of "addons" in the latest
> version.
> 
> Version 1.19 (the last version with gif support) installed OK for me on
> Redhat 9.
> See GD-1.19-* at  http://cpan.org/modules/by-module/GD/

Any GD with a version number below 2 should compile with the libgd
that comes with Redhat 9, which I believe is 1.84. You don't have to
go all the way back to 1.19 (you should only need to do that if you
want GIF support, and you have a libgd that supports GIF, but you
should not want to have GIF support).

\begin{offtopic}

If you want a newer version, i.e. the latest, download libgd yourself
(from www.boutell.com), compile and install it somewhere out of the
way (I have some versions in /opt/gd-x.yy), and then download and
compile the GD 2.x version you want, making sure to tell it where the
correct libgd is installed. Off the top of my head, the sequence is
somewhat like this:

$ tar xzvf gd-x.yy.tar.gz
$ cd gd-x.yy
$ ./configure --prefix=/wherever/you/want
$ make
# become root
$ make install

\end{offtopic}

and for GD, just type perl Makefile.pl, and answer the first question
with /whatever/you/want/lib

Martien
-- 
                        | 
Martien Verbruggen      | Never hire a poor lawyer. Never buy from a
Trading Post Australia  | rich salesperson.
                        | 


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

Date: Thu, 07 Aug 2003 18:47:52 -0400
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: nested HTML parsing
Message-Id: <3F32D718.7030504@gwu.edu>

Tad McClellan wrote:
> Ted Zlatanov <tzz@lifelogs.com> wrote:
> 
> 
>>invalid HTML.
> 
> 
> 
> There really is no such thing.
> 
> If it is invalid, then it is not HTML at all, just some angle-brackety text.
> 
> 
I suppose it's a question of intent.  "Invalid HTML" == "It was supposed to be
HTML, but it ain't"

                  Chris Mattern



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

Date: Fri, 08 Aug 2003 00:20:24 GMT
From: "codeWarrior" <GPatnude@HotMail.com>
Subject: Re: Out of memory when reading big file (more question)
Message-Id: <c1CYa.10902$jg.3251637@news1.news.adelphia.net>


"Jason M" <frosty@yoyo.cc.monash.edu.au> wrote in message
news:3f31d7f2$1@nexus.comcen.com.au...
>
> Hi all,
>
> I've search past postings in the group about this topic, and yet I'm still
> experiencing problems with an out of memory error when reading a large
file.
>
> Size of file being read: 1,809,891 KB ASCII text file.
> Record length: 1913 chars.
>
> Running off an IBM Netfinity 770Mhz with 1 GB RAM.
>
> Code:
>
>
> my $datsrcfile = $_[0];
> my $TEMPLATE = $_[1];
> my $cols2sum1 = $_[2];
> my $cols2sum2 = $_[3];
> my($count,@return, $sum1, $sum2);
>
> open DATA, $datsrcfile or &abort(89, "Cannot open config file:
$datsrcfile\n");
>
> $count = 0;
>
> while (<DATA>){
>
> my @data;
> #If fixed use unpack, if delimited use split
> if (! defined $delimiter){
> (@data)=unpack($TEMPLATE,$_);
> } else {
>
> (@data)=split(/$TEMPLATE/,$_)
> }
>
> $sum1 += $data[$cols2sum1-1] if (defined $cols2sum1);
> $sum2 += $data[$cols2sum2-1] if (defined $cols2sum2);
> $count++;
>
> }
>
> ..blah blah..
>
> Any ideas as to why this is so?  I tried to split the file too, by writing
> to different files, but that code too suffered from the "out of memory"
error.
>  I'm pretty sure it is somewhere in the while(<>) loop (obviously).
Thanks.
>
> JM
>
>
>
>

You NEVER know what's in $_


My gaawwwwdddd.... youre running out of memory because you are reading the
entire file into an array where each element is a copy of the file ($_) and
the array hase 'filesize"  (1808891 KB) number of elements...
much much much easire to "slurp" the file into a SINGLE array then process
the array... like this....

  if (open (FID, "$filename")) {

   # SLURP...
   @DATA = <FID>;

   close (FID);

   # SQUASH PROCESS / FORMAT THE DATA AND HIDE ANY FORMATTED VARIABLES...
   $DATA = join "\n", @DATA;
   $DATA =~ s/"/\\"/g;
   $DATA =~ s/'/\\'/g;
   chomp $DATA;
   $DATA = eval "\$$tmp = \"$DATA\"";
   return $DATA;

  } else {

   die "Error: --> Unable to open $filename for read";

  }





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

Date: Thu, 07 Aug 2003 18:57:28 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: using tr and ascii value
Message-Id: <Xns93D0CB0705697sdn.comcast@206.127.4.25>

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

dan@danguzman.com (Dan Guzman) wrote in
news:ddf15003.0308070727.4a8f32e1@posting.google.com: 

> I've tried the suggestions above, but without success:
> 
>      $mLine =~ tr/\x1a/ /;
>      $mLine =~ tr/\032/ /;     

Oh?  What was the failure?  What did it do that you didn't expect, or what 
didn't it do that you did expect?  What was your input, your expected 
output, and your actual output?

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

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

iQA/AwUBPzLnaGPeouIeTNHoEQIAcgCgthwYom1PgNmNx+OHqm7zm3pqCxoAnji/
egxse58hwqS0hQHgwDtXWii4
=cTON
-----END PGP SIGNATURE-----


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

Date: 07 Aug 2003 23:15:29 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: very simple question
Message-Id: <slrnbj5nci.41m.mgjv@verbruggen.comdyn.com.au>

On Thu, 7 Aug 2003 19:32:03 +0000 (UTC),
	Vlad Tepes <minceme@start.no> wrote:
> Abigail <abigail@abigail.nl> wrote:

>> &&  phase00@hotmail.com (Monkey Boy) wrote in 
>> && > How do I initialise (assign value of 0) to multiple variables without
>> && > having to manually specify each one.
>> && > 
>> && > ie. 
>> && > $a = 0;
>> && > $b = 0;
>> && > $c = 0;
>> && > $d = 0; 
>> && > ..etc

[snip]

>> $$_ = 0 for qw /a b c d/;
>>
>> eval "\$$_ = 0" for qw /a b c d/;

[Added comments for people who are thinking of copying this without
knowing what it does.]

This won't work under strict, of course, and should only be used if
you know why you should use it. It uses symbolic references, which are
not a good idea in general, even though they are useful in some
specific cases (this one not being one of them, IMO).

> What about dropping the qw?
> 
> $$_ = 0 for a..d;
> 
> map $$_ = 0, a..d;

And, apart from using symbolic references, this will also generate
warnings if they are enabled, because you're using bare strings. 

$$_ = 0 for 'a' .. 'd';

Martien
-- 
                        | 
Martien Verbruggen      | Unix is user friendly. It's just selective
Trading Post Australia  | about its friends.
                        | 


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

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


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