[16749] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4161 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 29 03:05:32 2000

Date: Tue, 29 Aug 2000 00:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <967532712-v9-i4161@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 29 Aug 2000     Volume: 9 Number: 4161

Today's topics:
        another "why doesn't this work?" question. (James Lee)
    Re: another "why doesn't this work?" question. (Abigail)
    Re: Continuation format danraymond@my-deja.com
    Re: Continuation format (Martien Verbruggen)
    Re: DB_File Problem: HELP!!! <paul@pco.iis.nsk.su>
    Re: Development Tools <lardinois@ose.nl>
        get newsfeeds from a content site with perl? <isc80031@nus.edu.sg>
    Re: get newsfeeds from a content site with perl? (Martien Verbruggen)
        hour difference between localtime and POSIX::mktime steinra@my-deja.com
    Re: hour difference between localtime and POSIX::mktime <tina@streetmail.com>
    Re: hour difference between localtime and POSIX::mktime steinra@my-deja.com
    Re: How do I manipulate each element of an array? <iltzu@sci.invalid>
    Re: How to Unzip a .tar.gz file (BUCK NAKED1)
    Re: MIME Mail help on NT - no sendmail! (Logan Shaw)
    Re: mod_perl & heap and another question <fritz.heinrichmeyer@fernuni-hagen.de>
    Re: Need Help with CGI <s1sims@home.com>
    Re: Need Help with CGI <elephant@squirrelgroup.com>
    Re: Parsing a Excell table - or - a "Tab New_Line" text <bwalton@rochester.rr.com>
    Re: Parsing a Excell table - or - a "Tab New_Line" text <bwalton@rochester.rr.com>
    Re: perl send/detect ICMP (Martien Verbruggen)
    Re: Perldoc help needed (BUCK NAKED1)
        Problem with threads in Windows rreuss@my-deja.com
    Re: quickie obfuscation... <tina@streetmail.com>
    Re: quickie obfuscation... <elephant@squirrelgroup.com>
    Re: selling perl to management (Logan Shaw)
    Re: selling perl to management (Abigail)
    Re: selling perl to management (Logan Shaw)
    Re: The Hacker signature disciplin <iltzu@sci.invalid>
    Re: Unclosed HTML Tags <iltzu@sci.invalid>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 29 Aug 2000 06:27:06 GMT
From: jameslee@cse.buffalo.edu (James Lee)
Subject: another "why doesn't this work?" question.
Message-Id: <8ofl3q$ro$1@prometheus.acsu.buffalo.edu>

Sorry, it's been a while since I've touched perl, and I'm running short on
time. Any way, I'm trying to do convert all tabs to spaces in my c programs
using the following code:

---begin perl code (windows NT platform)

@ARGV = glob ("*") unless @ARGV;

while (@ARGV) 
{
    s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
    print $_;
}

---end perl code

The program just hangs.  Any help will be appreciated.  Thanks.
-- 
James


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

Date: 29 Aug 2000 06:56:51 GMT
From: abigail@foad.org (Abigail)
Subject: Re: another "why doesn't this work?" question.
Message-Id: <slrn8qmnk3.bbg.abigail@alexandra.foad.org>

James Lee (jameslee@cse.buffalo.edu) wrote on MMDLV September MCMXCIII in
<URL:news:8ofl3q$ro$1@prometheus.acsu.buffalo.edu>:
}} Sorry, it's been a while since I've touched perl, and I'm running short on
}} time. Any way, I'm trying to do convert all tabs to spaces in my c programs
}} using the following code:
}} 
}} ---begin perl code (windows NT platform)
}} 
}} @ARGV = glob ("*") unless @ARGV;
}} 
}} while (@ARGV) 
}} {
}}     s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
}}     print $_;
}} }
}} 
}} ---end perl code
}} 
}} The program just hangs.  Any help will be appreciated.  Thanks.


Well, do you really expect @ARGV to lose its elements all by itself?


There are many things wrong with your program. The absense of -w for
instance.


Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


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

Date: Tue, 29 Aug 2000 04:45:44 GMT
From: danraymond@my-deja.com
Subject: Re: Continuation format
Message-Id: <8off5k$3nb$1@nnrp1.deja.com>


> >How does one 'continue' code to a new line?
> >
> >In awk the backslash (\) serves, as in:
> >
> >awk code ... \
> >code continued
>
> Perl doesn't need that, it is (almost) free
> format, meaning you can break a line anywhere
> where a blank can go, with no further
> provisions.
>

Try doing that with the command input operator:

print `ls
       /usr/local`;

It won't work.  A single backslash won't help
either.  A double backslash seems to work
but I'm not sure exactly why.  Anyone know?


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


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

Date: Tue, 29 Aug 2000 06:25:59 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: Continuation format
Message-Id: <slrn8qmiaf.ra.mgjv@verbruggen.comdyn.com.au>

On Tue, 29 Aug 2000 04:45:44 GMT,
	danraymond@my-deja.com <danraymond@my-deja.com> wrote:
> 
> Try doing that with the command input operator:
> 
> print `ls
>        /usr/local`;
> 
> It won't work.  A single backslash won't help

It still works. Perl does the right thing, and passes the string off
to the shell. It's just that the shell doesn't want that newline in
there.

> either.  A double backslash seems to work
> but I'm not sure exactly why.  Anyone know?

Strings in backquotes are interpolated as a double-quoted string,
meaning that a backslash is the escape character. You need to use two
to end up with one in the string that gets passed off to the shell.
IOW, it's the same as

$foo = "ls 
      /usr/local";
print qx/$foo/;

Inspection of $foo after insertion of the backwhacks will show what's
going on.

Martien

PS. To avoid double-quotish interpolation, use qx with single quotes
as a delimiter (see the perlop documentation)
-- 
Martien Verbruggen              | 
Interactive Media Division      | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd.   | from a rich salesperson.
NSW, Australia                  | 


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

Date: Tue, 29 Aug 2000 11:34:26 +0600
From: "Paul Dortman" <paul@pco.iis.nsk.su>
Subject: Re: DB_File Problem: HELP!!!
Message-Id: <8ofekr$1sag$1@news.itfs.nsk.su>

Thank you,

You pointed me out the simple way to port my databases. :)

Paul

Bob Walton wrote in message <39A9DFCA.49B7F9E8@rochester.rr.com>...
>Paul Dortman wrote:
>...
>> I have problem with my *.db database. Please, help me.
>>
>> I want to port my  *.db database to another unix server. To simplify
problem
>> I created the s.db file with only one key  by script:
>>
>> use DB_File;
>> $db = '/home/paul/temp/s.db';
>> tie(%db, 'DB_File', $db) or die "Could not open $db : $!";
>> $num = $db{'num'};
>> $num++;
>> $db{'num'}=$num;
>> print $num;
>> untie %db;
>>
>> The result s.db file has 32768 byte long for one server, and has 8192
byte
>> long for another server. I think It's because of some internal settings
such
>> as size of field. But how can I change them to port my database from one
>> server to another?
>>
>> I should done it quickly, So Please help me or give me links to
>> documentation that can be helpful.
>...
>> Paul
>
>You probably can't assume that the binary files are transportable from
>one system to another.  You will probably need to convert your file to
>an ASCII intermediate form, than convert it back to a tied hash on the
>other system.  I have no information on what your keys and values
>contain, so you'll have to devise those routines yourself.  Anything
>that will let you subsequently obtain the original keys and values
>without corruption will work fine.
>
>If your keys and values don't contain newlines, carriage returns or form
>feeds and the keys don't contain colons, maybe something like
>[untested]:
>
>   ...
>   tie(%db....
>   open OUT,">junk.txt" or die "Couldn't open junk.txt for output,
>$!\n";
>   while(($key,$value)=each %db){
>      print OUT "$key:$value\n";
>   }
>
>on the old computer, followed by:
>
>   ...
>   tie(%db....
>   open IN,"junk.txt" or die "Coulnd't open junk.txt, $!\n";
>   while(<IN>){
>      ($key,$value)=split /:/,$_,2;
>      $db{$key}=$value;
>   }
>
>on the new computer.  You could probably rig up something cool with
>sockets to avoid generating the large ASCII file if that is a problem.
>--
>Bob Walton




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

Date: Tue, 29 Aug 2000 08:57:43 +0200
From: "Mark Lardinois" <lardinois@ose.nl>
Subject: Re: Development Tools
Message-Id: <39ab5eba$0$1677@heracles>

Hi,

I use 40tude. It works just like Delphi or
Visual Basic and has a perfect perl
compiler. You can download it from
www.download.com but you have to
download the perl-modules (perl.exe etc...)
also if you want to use the compiler.
I can e-mail them to you if you want.

Good luck!

Mark Lardinois.




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

Date: Tue, 29 Aug 2000 12:42:43 +0800
From: Mo Jiazhou <isc80031@nus.edu.sg>
Subject: get newsfeeds from a content site with perl?
Message-Id: <22E71DAEC504D111B78100805FFE9DC73E799502@pfs21.ex.nus.edu.sg>

hi, people:

how to get newsfeeds from another site, eg, a newspaper's site,
with perl scripts? is there any place i can find sample code? or
i can learn more about this?

thx.

wowo



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

Date: Tue, 29 Aug 2000 06:16:49 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: get newsfeeds from a content site with perl?
Message-Id: <slrn8qmhp9.ra.mgjv@verbruggen.comdyn.com.au>

On Tue, 29 Aug 2000 12:42:43 +0800,
	Mo Jiazhou <isc80031@nus.edu.sg> wrote:
> hi, people:
> 
> how to get newsfeeds from another site, eg, a newspaper's site,
> with perl scripts? is there any place i can find sample code? or
> i can learn more about this?

I suppose you mean you want to read HTML pages from a Web site?

You want to have a look at the LWP modules. You can get them from
CPAN: http://www.cpan.org/

This question, or questions very similar to it, come up quite often on
this group. You might consider using something like www.deja.com next
time you have a question, or simply read a few of the posts in the
group before you post yourself. If you did that, then next time you
should probably be a bit more thorough.

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Tue, 29 Aug 2000 04:43:40 GMT
From: steinra@my-deja.com
Subject: hour difference between localtime and POSIX::mktime
Message-Id: <8off1p$3ed$1@nnrp1.deja.com>

I am not sure what is wrong in this example.  This is with the following
version of perl

$ perl -v

This is perl, v5.6.0 built for sun4-solaris-64int


Solaris version is 2.6

Here is the Program

#!/usr/local/bin/perl

use POSIX;

$time = time;

print "Date = ", POSIX::ctime($time);

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime($time);

$newtime = POSIX::mktime( $sec,$min,$hour,$mday,$mon,$year );

print "Date = ", POSIX::ctime($newtime);

print "Hour:  $hour\n";

$time_t = POSIX::mktime( 0, 30, 10, 31, 00, 100 );
print "Date = ", POSIX::ctime($time_t);


Here is the output:

Date = Tue Aug 29 00:29:13 2000
Date = Tue Aug 29 01:29:13 2000
Hour:  0
Date = Tue Jan 31 10:30:00 2000

I am not sure why I am getting an hour difference between the two ctime
calls. There appears to be a problem with mktime but I am not sure how
it could be.

 Any suggestions would be appreciated.

Thanks!

Randy


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


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

Date: 29 Aug 2000 05:34:30 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: hour difference between localtime and POSIX::mktime
Message-Id: <8ofi15$apk9q$3@ID-24002.news.cis.dfn.de>

hi,
steinra@my-deja.com wrote:

> print "Date = ", POSIX::ctime($time);

> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> localtime($time);

> $newtime = POSIX::mktime( $sec,$min,$hour,$mday,$mon,$year );

> print "Date = ", POSIX::ctime($newtime);

> print "Hour:  $hour\n";

> $time_t = POSIX::mktime( 0, 30, 10, 31, 00, 100 );
> print "Date = ", POSIX::ctime($time_t);


> Here is the output:

> Date = Tue Aug 29 00:29:13 2000
> Date = Tue Aug 29 01:29:13 2000
> Hour:  0
> Date = Tue Jan 31 10:30:00 2000

> I am not sure why I am getting an hour difference between the two ctime
> calls. There appears to be a problem with mktime but I am not sure how
> it could be.

well I guess it is because of the summer/winter time.
try it out with another month and you'll
be surprised.
I think mktime takes care of summer/winter and
ctime does not. (didn't find the
explanation in the POSIX manpage, though)

tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

Date: Tue, 29 Aug 2000 06:30:25 GMT
From: steinra@my-deja.com
Subject: Re: hour difference between localtime and POSIX::mktime
Message-Id: <8ofla1$a6n$1@nnrp1.deja.com>

In article <8ofi15$apk9q$3@ID-24002.news.cis.dfn.de>,
  news@tinita.de wrote:
>
>
> well I guess it is because of the summer/winter time.
> try it out with another month and you'll
> be surprised.
> I think mktime takes care of summer/winter and
> ctime does not. (didn't find the
> explanation in the POSIX manpage, though)
>
> tina

Thank you!

I feel really dumb now :) *blush* It didn't even occur to me.  I really
hate dumb mistakes.

Thank you again!

Randy


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


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

Date: 29 Aug 2000 05:37:28 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: How do I manipulate each element of an array?
Message-Id: <967527224.29711@itz.pp.sci.fi>

In article <MPG.14145ef54ce6173098ace8@nntp.hpl.hp.com>, Larry Rosler wrote:
>
>  length or $_ = '&nbsp;' for @array;
>
>or (using Abigail's 'length' horror and squeezing out legibility):
>
>  y===c or$_='&nbsp;'for@array;

It can get worse than that - the space isn't really necessary:

   y===cor$_='&nbsp;'for@array;

You didn't really want to know that, did you?

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla  | "By promoting postconditions to
and its pseudonyms -    |  preconditions, algorithms become
do not feed the troll.  |  remarkably simple."  -- Abigail



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

Date: Mon, 28 Aug 2000 23:40:42 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: How to Unzip a .tar.gz file
Message-Id: <9977-39AB3ECA-41@storefull-242.iap.bryant.webtv.net>

Thanks Bart, and while I'm at it... thanks to Larry Rosler, Abigail, and
others that have helped me in the past.  I tend to over-react sometimes.
:-(  

However, I stand corrected with proof. I posted in HTML without
realizing it. My sincere apologies. I'll try to get my NS Communicator
newreader straightened out. Thanks for making me aware of this once
again. I keep forgetting to change it.

--
Kind Regards,
Dennis



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

Date: 28 Aug 2000 23:13:48 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: MIME Mail help on NT - no sendmail!
Message-Id: <8ofd9s$2vt$1@provolone.cs.utexas.edu>

In article <_TFq5.21222$C5.364609@typhoon.austin.rr.com>,
Tracy Terrell <tracyterrell@entersysgroup.com> wrote:
>"stringify" a MIME Entity for printing through the MailTools module.  My
>goal is just to send a "vanilla" mail with a ASCII file attachment.

I don't know what you mean by "vanilla", but if you want to
send any form of attachment, you're going to end up using
MIME, which is not my definition of vanilla (personally).

> I can't
>help but think that I am *really* close here - what confuses me is no matter
>WHAT tweaks I make, the attachment either doesn't show up at all, or shows
>up INLINE instead of as a true attachment (yeah, I'm using Outlook...) -
>help this poor humbled soul.
  :
  :
>THE RESULT IS A MAIL LIKE THIS ("blah" is the content of the attachment
>'short.txt'):
>
>Content-Type: multipart/mixed; boundary="----------=_967518619-518-0"
>Mime-Version: 1.0
>X-Mailer: MIME-tools 4.104 (Entity 4.117)
>
>This is a multi-part message in MIME format...
>
>------------=_967518619-518-0
>Content-Type: text/plain; name="short.txt"
>Content-Disposition: attachment; filename="short.txt"
>
>blah
>------------=_967518619-518-0--

That's a valid attachment.  However, I do notice that you don't
actually have anything other than the attachment.  Normally, messages
have a text part and also an attachment.  So, perhaps you ought to
add a text part (using attach()) before you add this attachment.

  - Logan


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

Date: 29 Aug 2000 08:43:22 +0200
From: Heinrichmeyer <fritz.heinrichmeyer@fernuni-hagen.de>
Subject: Re: mod_perl & heap and another question
Message-Id: <uf1yz8k1o5.fsf_-_@jfh00.fernuni-hagen.de>


Normally the heap size never goes back again (normally means
applications written with malloc/free) under unix (solaris, freebsd), so
limit the number of requests per child.

The situation is better with linux, there processes can get smaller when
free was called.

Btw. i need mod_perl under linux, freebsd and solaris.  Are unchanged
data segment pages (where compiled perl code lives) shared between
children of the apache server in the mentioned Linux/Unixes?

-- 
Fritz Heinrichmeyer mailto:fritz.heinrichmeyer@fernuni-hagen.de
FernUniversitaet Hagen, LG ES, 58084 Hagen (Germany)
tel:+49 2331/987-1166 fax:987-355 http://www-es.fernuni-hagen.de/~jfh


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

Date: Tue, 29 Aug 2000 04:34:25 GMT
From: Tuxman <s1sims@home.com>
Subject: Re: Need Help with CGI
Message-Id: <39AB3209.3A5EF332@home.com>

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
&nbsp;Need some advice here please, I've created a script that is supposed
to read a text file full of address'. Want to have it open the file and
output to an html table. All I get is the title and the horizontal row.
If someone could point out what I'm doing wrong, I know I'm close,
<br>&nbsp;
<p>Here is the script:
<p>#!/usr/bin/perl -w
<p># see_bk.pl - version 1.2 00/08/24
<br>&nbsp;
<p>=head1 PURPOSE
<p>&nbsp;This is part of a set of scripts that converted our personal address
book
<br>from a Lotus Approach Database to a CGI web-based interface. This script
views the
<br>entire address book and spits it into a table.
<p>=head1 REVISIONS
<p>&nbsp;version 1.1 00/08/21: script created
<br>&nbsp;
<p>=head1 AUTHOR
<p>&nbsp;Stephen L. Sims s1sims@home.com
<p>=cut
<br>&nbsp;
<p># Modules
<br>use CGI qw(:standard);
<br>use CGI::Carp qw(fatalsToBrowser);
<br>use FileHandle;
<br>$q = new CGI; # new CGI object
<br>$fh = new FileHandle;
<p>$q->{database} = "/home/httpd/cgi-bin/address.txt";
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<br>&nbsp;
<p>&nbsp;# start html
<br>&nbsp; print $q->header,
<br>&nbsp;&nbsp; $q->start_html(-title=>'All Address',
<br>&nbsp;&nbsp;&nbsp; -BGCOLOR=>'navajowhite'),
<br>&nbsp;&nbsp; $q->h1({-align=>'CENTER'}, 'All Address'),
<br>&nbsp;&nbsp; $q->br,
<br>&nbsp;&nbsp; $q->hr();
<br>&nbsp;
<br>&nbsp;&nbsp; $fh->open("$q->{database}"
<br>&nbsp;&nbsp;&nbsp; || die "Can't open the database!");
<br>&nbsp;
<br>&nbsp;
<p><font color="#3366FF">&nbsp;# start the table and print out the data</font>
<br><font color="#3366FF">&nbsp;print table({-border=>undef});</font>
<br><font color="#3366FF">&nbsp;</font>
<br><font color="#3366FF"># feed file into varibles for output to a table</font>
<br><font color="#3366FF">&nbsp;&nbsp; while(&lt;$fh>){</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; chomp;</font><font color="#3366FF"></font>
<p><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{FirstName} = substr($_,
0, 30);</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{LastName} = substr($_,
30, 30);</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{HomeAddress} = substr($_,
60, 30);</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{City} = substr($_, 90,
20);</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{State} = substr($_, 110,
2);</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{ZipCode} = substr($_,
112, 10);</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{HomePhone} = substr($_,
122, 15);</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{Email} = substr($_, 137,
30);</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{WorkTitle} = substr($_,
167, 20);</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{Employer} = substr($_,
187, 20);</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{WorkAddress} = substr($_,
207, 20);</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{WorkCity} = substr($_,
227, 20);</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{WorkState} = substr($_,
247, 2);</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{WorkZip} = substr($_,
249, 10);</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{WorkPhone} = substr($_,
259, 15);</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; $q->{WorkEmail} = substr($_,
274, 30);</font>
<br><font color="#3366FF">&nbsp;</font>
<br><font color="#3366FF">&nbsp; print Tr({-align=>LEFT},</font>
<br><font color="#3366FF">&nbsp;</font>
<br><font color="#3366FF">&nbsp;</font>
<br><font color="#3366FF">&nbsp;&nbsp;&nbsp; td({-width=>50, [$q->{FirstName}]),</font>
<br><font color="#3366FF">&nbsp;&nbsp; td({-width=>50}, [$q->{LastName}]),</font>
<br><font color="#3366FF">&nbsp;&nbsp; td({-width=>100}, [$q->{HomeAddress}]),</font>
<br><font color="#3366FF">&nbsp;&nbsp; td({-width=>30}, [$q->{City}]),</font>
<br><font color="#3366FF">&nbsp;&nbsp; td({-width=>3}, [$q->{State}]),</font>
<br><font color="#3366FF">&nbsp;&nbsp; td({-width=>15}, [$q->{ZipCode}]),</font>
<br><font color="#3366FF">&nbsp;&nbsp; td({-width=>15}, [$q->{HomePhone}]),</font>
<br><font color="#3366FF">&nbsp;&nbsp; td({-width=>30}, [$q->{Email}]),</font>
<br><font color="#3366FF">&nbsp;&nbsp; td({-width=>20}, [$q->{WorkTitle}]),</font>
<br><font color="#3366FF">&nbsp;&nbsp; td({-width=>20}, [$q->{Employer}]),</font>
<br><font color="#3366FF">&nbsp;&nbsp; td({-width=>100}, [$q->{WorkAddress}]),</font>
<br><font color="#3366FF">&nbsp;&nbsp; td({-width=>30}, [$q->{WorkCity}]),</font>
<br><font color="#3366FF">&nbsp;&nbsp; td({-width=>3}, [$q->{WorkState}]),</font>
<br><font color="#3366FF">&nbsp;&nbsp; td({-width=>10}, [$q->{WorkZip}]),</font>
<br><font color="#3366FF">&nbsp;&nbsp; td({-width=>15}, [$q->{WorkPhone}]),</font>
<br><font color="#3366FF">&nbsp;&nbsp; td({-width=>30}, [$q->{WorkEmail}])</font>
<br><font color="#3366FF">);</font><font color="#3366FF"></font>
<p><font color="#3366FF">}</font>
<br>print $q->end_html;
<br>&nbsp;
<br>&nbsp;
<p>undef $fh;
<br>&nbsp;
<p>####################### Subroutines from here on down ######################
<br>&nbsp;</html>



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

Date: Tue, 29 Aug 2000 04:46:39 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Need Help with CGI
Message-Id: <MPG.1415dda06cb5c6a598971e@localhost>

Tuxman <s1sims@home.com> wrote ..
>Content-Type: text/html; charset=us-ascii
>
><!doctype html public "-//w3c//dtd html 4.0 transitional//en">

*plonk*

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Tue, 29 Aug 2000 04:13:11 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Parsing a Excell table - or - a "Tab New_Line" text file?
Message-Id: <39AB387C.8AD69D47@rochester.rr.com>

Etienne Laverdiere wrote:
 ...
> I have tried your solution, but I still have some problem with the
> response. I have this error :
> 
> Software error:
> Describe failed during DBI::st=HASH(0x8bbf0dc)->FETCH(NAME) at
> D:\xitami\cgi-bin\ex1\excel.pl line 46.
> 
> here's the code I used:
> use DBI;
> use Data::Dumper;
> my $drv  = 'ODBC:driver=Microsoft Excel Driver (*.xls)';
> my $dir  = 'd:/data/base_prod.xls'; #an Excel file
> my $table = 'table1'; #a range name
> my $dbh  = DBI->connect( "dbi:$drv;Dbq=$dir",,,{RaiseError=>1} ) or die
> $DBI::errstr;
> my $sth  = $dbh->prepare("select * from $table");
> 
> error ----> $names=$sth->{NAME};
> print $names;
> for (@$names){print "field:$_\n"}
> my $ref  = $sth->selectall_arrayref($sth);
> print Dumper($ref);
> 
> So, I named my first row of my Excel table "NAME", but it d'dn't help.
> It seems that sth contain nothing.
 ...
> Etienne Laverdiere
 ...

I note that I get the same error you got if I specify a range name that
doesn't exist in the workbook.  To specify a range name in Excel,
highlight the range you want, and click on insert..name..define, type
the name of the range in the blank and click the Add button.  Your
ranges will show up in the listbox immediately above the top left cell
of the spreadsheet.

I also note that one can instead specify a worksheet as follows:

    my $table='[Sheet1$]';

to replace 

    my $table='table1';

The square brackets and the $ are required, and "Sheet1" must be the
name of a sheet in the workbook.  Theoretically, one can also specify a
range like B1:D3 after the $, but I can't get that to work (Excel 8.0
SR2, Windoze 98 SE).

Also, note that the
  
    $names=$sth->{NAME};
    for(@$names){print "field:$_\n"}

bit is just there to print out the field names DBI thinks the "database"
has.  But if that bombs out, so will the later stuff (with a different
error message).
-- 
Bob Walton


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

Date: Tue, 29 Aug 2000 04:07:50 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Parsing a Excell table - or - a "Tab New_Line" text file?
Message-Id: <39AB371B.7D0B7E6B@rochester.rr.com>

Etienne Laverdiere wrote:
 ...
> I have tried your solution, but I still have some problem with the
> response. I have this error :
> 
> Software error:
> Describe failed during DBI::st=HASH(0x8bbf0dc)->FETCH(NAME) at
> D:\xitami\cgi-bin\ex1\excel.pl line 46.
> 
> here's the code I used:
> use DBI;
> use Data::Dumper;
> my $drv  = 'ODBC:driver=Microsoft Excel Driver (*.xls)';
> my $dir  = 'd:/data/base_prod.xls'; #an Excel file
> my $table = 'table1'; #a range name
> my $dbh  = DBI->connect( "dbi:$drv;Dbq=$dir",,,{RaiseError=>1} ) or die
> $DBI::errstr;
> my $sth  = $dbh->prepare("select * from $table");
> 
> error ----> $names=$sth->{NAME};
> print $names;
> for (@$names){print "field:$_\n"}
> my $ref  = $sth->selectall_arrayref($sth);
> print Dumper($ref);
> 
> So, I named my first row of my Excel table "NAME", but it d'dn't help.
> It seems that sth contain nothing.
 ...
> Etienne Laverdiere
 ...

I note that I get the same error you got if I specify a range name that
doesn't exist in the workbook.  To specify a range name in Excel,
highlight the range you want, and click on insert..name..define, type
the name of the range in the blank and click the Add button.  Your
ranges will show up in the listbox immediately above the top left cell
of the spreadsheet.

I also note that one can instead specify a worksheet as follows:

    my $table='[Sheet1$]';

to replace 

    my $table='table1';

The square brackets and the $ are required, and "Sheet1" must be the
name of a sheet in the workbook.  Theoretically, one can also specify a
range like B1:D3 after the $, but I can't get that to work (Excel 8.0
SR2, Windoze 98 SE).

Also, note that the
  
    $names=$sth->{NAME};
    for(@$names){print "field:$_\n"}

bit is just there to print out the field names DBI thinks the "database"
has.  But if that bombs out, so will the later stuff (with a different
error message).
-- 
Bob Walton


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

Date: Tue, 29 Aug 2000 04:31:53 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: perl send/detect ICMP
Message-Id: <slrn8qmbkg.ra.mgjv@verbruggen.comdyn.com.au>

On 29 Aug 2000 19:21:10 GMT,
	Mr. Chow Wing Siu <wschow@Comp.HKBU.Edu.HK> wrote:
> Hi,
> 
> I would like to get the examples to send and read/detect ICMP
> messages by perl.

Maybe there's a module on CPAN that can help you. Have you checked?

# perl -MCPAN -e shell
cpan> i /icmp/
Module          Fwctl::Services::icmp_pkt (F/FR/FRAJULAC/Fwctl-0.28.tar.gz)
Module          NetPacket::ICMP (T/TI/TIMPOTTER/NetPacket-0.01.tar.gz)
cpan> readme NetPacket::ICMP
[snip]

If those modules don't do what you want, maybe you can at least use
their code to work out a solution.

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: Mon, 28 Aug 2000 23:30:10 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Perldoc help needed
Message-Id: <9976-39AB3C52-101@storefull-242.iap.bryant.webtv.net>

Thanks. Been there many times, but didn't know it was referred to as
perldoc -f.

Regards,
Dennis



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

Date: Tue, 29 Aug 2000 06:41:49 GMT
From: rreuss@my-deja.com
Subject: Problem with threads in Windows
Message-Id: <8oflva$ar5$1@nnrp1.deja.com>

I have installed ActivePerl with a build of perl 5.6.0, and I am coding
a script that use threads. Now when I use the thread module, I get the
error: No threads in this perl. I have tried implementing this using
the fork() call instead, but this make the script crash with some
memory fault.
Can it really be, that I have to install Linux to use threads in perl?

Any help is appreciated.
Rune (rune@egmont-kol.dk)


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


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

Date: 29 Aug 2000 04:13:25 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: quickie obfuscation...
Message-Id: <8ofd95$apk9q$2@ID-24002.news.cis.dfn.de>

hi,
Abigail <abigail@foad.org> wrote:
> jason (elephant@squirrelgroup.com) wrote on MMDLV September MCMXCIII in
> <URL:news:MPG.14159e8b164a86f5989717@localhost>:
> || Abigail <abigail@foad.org> wrote ..
> || >Marcel Grunauer (marcel@codewerk.com) wrote on MMDLIV September MCMXCIII
> || >in <URL:news:slrn8qlg28.efv.marcel@gandalf.local>:
> || >\\ On Mon, 28 Aug 2000 15:25:01 -0400, Aaron Spangler <aspangler@lucent.com>
> || >\\ 
> || >\\ >Why does
> || >\\ >           print 1 and 0;
> || >\\ >return 1?
> || >\\ >
> || >\\ >What is perl actually performing here?
> || >\\ 
> || >\\     $ perl -MO=Deparse,-p -e 'print 1 and 0'
> || >\\     (print(1) and '???');
> || >\\     -e syntax OK
> || >\\ 

> If "print 1 and 0" is the final statement of a sub, there's a huge 
> difference between "print 1 and 0" and "print (1) and '???'". As
> large as false and true.

of course. but in the above example "print 1 and 0" the "0"
is just useless, because it's an unused constant value.

00:12am tina@syracus:~/public_html/cgi-bin > perl -MO=Deparse,-p -e '
print 1 and (0)'
-e syntax OK
(print(1) and '???');
00:13am tina@syracus:~/public_html/cgi-bin > perl -MO=Deparse,-p -e '        sub test {print 1 and 0}'
-e syntax OK
sub test {
    (print(1) and 0);
}

the meaning of '???' is quite clearly explained in
perldoc B::Deparse

tina

-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \__,_\___/\___/_| /__/ perception
please don't email unless offtopic or followup is set. thanx


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

Date: Tue, 29 Aug 2000 04:38:39 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: quickie obfuscation...
Message-Id: <MPG.1415dbc3b978e01e98971d@localhost>

Abigail <abigail@foad.org> wrote ..
>jason (elephant@squirrelgroup.com) wrote on MMDLV September MCMXCIII in
><URL:news:MPG.14159e8b164a86f5989717@localhost>:
>|| Abigail <abigail@foad.org> wrote ..
>|| >Marcel Grunauer (marcel@codewerk.com) wrote on MMDLIV September MCMXCIII
>|| >in <URL:news:slrn8qlg28.efv.marcel@gandalf.local>:
>|| >\\ On Mon, 28 Aug 2000 15:25:01 -0400, Aaron Spangler <aspangler@lucent.c
>|| >\\ 
>|| >\\ >Why does
>|| >\\ >           print 1 and 0;
>|| >\\ >return 1?
>|| >\\ >
>|| >\\ >What is perl actually performing here?
>|| >\\ 
>|| >\\     $ perl -MO=Deparse,-p -e 'print 1 and 0'
>|| >\\     (print(1) and '???');
>|| >\\     -e syntax OK
>|| >\\ 
>|| >\\ This is what perl sees. Does that help? Note the placement of the
>|| >\\ parentheses for print().
>|| >
>|| >
>|| >Well, that is certainly confusing. 
>|| >
>|| >As far as I can tell, the result of "print 1 and 0" is false, but the
>|| >result of "(print (1) and '???')" is true.
>|| >
>|| >Unless '???' suddenly became 0.
>|| 
>|| umm .. not sure if this explains it .. but the assignment operator binds 
>|| tighter than 'and' .. so
>|| 
>||   my $foo = print 1 and 0;
>|| 
>|| parses to
>|| 
>||   ( my $foo = print 1 ) and 0;
>|| 
>|| so .. that parsing makes sense in an assignment situation .. and for 
>|| some reason Perl does the same thing when evaluating the statement's 
>|| value in a non-assignment situation
>|| 
>|| which explains the ( print(1) and '???' )
>
>Well, first of all, the "and 0" part are *not* part of the assignment,
>as your own parenthesis show. Secondly, the "for some reason" doesn't
>explain a single thing. What is this "some reason", and how does it
>affect me.

that's why I started with "not sure if this explains it" .. because I 
thought that what I had observed might have made sense to those more 
familiar with how the language guts work

I just noticed that the deparse output for

  print 1 and 0;

is the same (less the assignment) as the deparse output from

  my $x = print 1 and 0;

and therefore it's like even in a void context (where the return value 
of a statement is thrown away) the parsing of that statement still 
assumes an assignment

the exception to that would appear to be when the statement is the last 
line of a sub when the parsing assumes a 'return' prefix to the 
statement .. hence the difference between

  print 1 and 0;

and

  sub test { print 1 and 0 }

I'm not explaining why .. just stating my observations and how they 
differed from yours regarding the sub test {} example

>If "print 1 and 0" is the final statement of a sub, there's a huge 
>difference between "print 1 and 0" and "print (1) and '???'". As
>large as false and true.

yes .. hence the mention about the 'return wrapper' around statements 
that are at the end of subs .. you seemed to have moved on to the 80 
chars thing by the time you got to that part of my post (below)

>|| and also the difference in your sub test {} example elsewhere in the 
>|| thread .. because there's no assignment assumed at the end of a sub .. 
>|| only a return wrapper .. and
>|| 
>||   return 1 and 0;
>|| 
>|| will evaluate the 'and' before passing the result to 'return'
>|| 
>||   [ line longer than 80 chars truncated ]
>
>Huh? What line longer than 80 characters? I don't post lines longer than
>80 characters, except for quoted text, but even then I usually clip.
>
>Perhaps you think 79 > 80?

nup .. the line showing the Aaron Spangler attribution was 83 chars in 
length before my followup .. and 84 after my news reader had stuck it's 
'>' in there

it may very well have been 80 chars *before* your followup .. but after 
your newsreader added '\\ ' it was 83 .. so I truncated it back to 80 .. 
which I'm about to do again (to the same line)

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: 28 Aug 2000 23:35:50 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: selling perl to management
Message-Id: <8ofej6$31r$1@provolone.cs.utexas.edu>

In article <slrn8qm9vv.bbg.abigail@alexandra.foad.org>,
Abigail <abigail@foad.org> wrote:
>Alan Barclay (gorilla@elaine.furryape.com) wrote on MMDLV September
>MCMXCIII in <URL:news:967516584.917639@elaine.furryape.com>:
>{} Put "/usr/local/bin/perl5.005003" as the #! line, changing the number
>{} to the version you want, and of course the correct path. Then, when
>{} you install a new version of perl, that script will continue to use
>{} the old perl.
>
>Untill you run CPAN.pm with UNINSTALL and install a new version of own
>of the modules you are using, and suddenly, older version of Perl no
>longer find the module.

Not if you're anal-retentive enough to abhor installing everything
into the same place:

   $ file -h /usr/local/bin/perl
   /usr/local/bin/perl:    symbolic link to /packages/perl/bin/perl

   $ file -h /packages/perl         
   /packages/perl: symbolic link to perl-5.6.0

   $ ls -ld /packages/perl-*
   drwxr-xr-x   6 bin      bin          512 Nov  6  1999 /packages/perl-5.005_03
   drwxr-xr-x   6 bin      bin          512 Jul 22 19:05 /packages/perl-5.6.0

   $ /packages/perl-5.6.0/bin/perl -e 'print map ("$_\n", @INC)'
   /packages/perl-5.6.0/lib/5.6.0/i86pc-solaris
   /packages/perl-5.6.0/lib/5.6.0
   /packages/perl-5.6.0/lib/site_perl/5.6.0/i86pc-solaris
   /packages/perl-5.6.0/lib/site_perl/5.6.0
   /packages/perl-5.6.0/lib/site_perl
   .

   $ /packages/perl-5.005_03/bin/perl -e 'print map ("$_\n", @INC)'
   /packages/perl-5.005_03/lib/5.00503/i86pc-solaris
   /packages/perl-5.005_03/lib/5.00503
   /packages/perl-5.005_03/lib/site_perl/5.005/i86pc-solaris
   /packages/perl-5.005_03/lib/site_perl/5.005
   .

So, if you want perl version 5.005_03, you just start your script with

   #! /packages/perl-5.005_03/bin/perl -w

If you want whatever version of perl is the currently stable one, you
just use

   #! /packages/perl/bin/perl -w

At least, that's what I do personally.  (And that link from
/usr/local/bin/perl to /packages/perl/bin/perl is generated
automatically, along with 2522 other symbolic links and 18
directories.)

  - Logan


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

Date: 29 Aug 2000 05:17:30 GMT
From: abigail@foad.org (Abigail)
Subject: Re: selling perl to management
Message-Id: <slrn8qmhpq.bbg.abigail@alexandra.foad.org>

Logan Shaw (logan@cs.utexas.edu) wrote on MMDLV September MCMXCIII in
<URL:news:8ofej6$31r$1@provolone.cs.utexas.edu>:
~~ In article <slrn8qm9vv.bbg.abigail@alexandra.foad.org>,
~~ Abigail <abigail@foad.org> wrote:
~~ >Alan Barclay (gorilla@elaine.furryape.com) wrote on MMDLV September
~~ >MCMXCIII in <URL:news:967516584.917639@elaine.furryape.com>:
~~ >{} Put "/usr/local/bin/perl5.005003" as the #! line, changing the number
~~ >{} to the version you want, and of course the correct path. Then, when
~~ >{} you install a new version of perl, that script will continue to use
~~ >{} the old perl.
~~ >
~~ >Untill you run CPAN.pm with UNINSTALL and install a new version of own
~~ >of the modules you are using, and suddenly, older version of Perl no
~~ >longer find the module.
~~ 
~~ Not if you're anal-retentive enough to abhor installing everything
~~ into the same place:

So, your programs break because it suddenly can't find the modules
you forgot to reinstall?

Having to reinstall everything and/or modify all the #! lines don't
strike me as practical. Nor should it ever be suggested to do, or
else the people maintaining perl should maintain old versions as
well. But maintainance is much better done by issueing new versions.



Abigail
-- 
               split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_)  {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};


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

Date: 29 Aug 2000 00:38:28 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: selling perl to management
Message-Id: <8ofi8k$3i5$1@provolone.cs.utexas.edu>

In article <slrn8qmhpq.bbg.abigail@alexandra.foad.org>,
Abigail <abigail@foad.org> wrote:
>Logan Shaw (logan@cs.utexas.edu) wrote on MMDLV September MCMXCIII in
><URL:news:8ofej6$31r$1@provolone.cs.utexas.edu>:
>~~ >Untill you run CPAN.pm with UNINSTALL and install a new version of own
>~~ >of the modules you are using, and suddenly, older version of Perl no
>~~ >longer find the module.
>~~ 
>~~ Not if you're anal-retentive enough to abhor installing everything
>~~ into the same place:
>
>So, your programs break because it suddenly can't find the modules
>you forgot to reinstall?

No, I'm anal-retentive, remember?  :-)

This wouldn't happen for two reasons:

#1:  The source archive of any module I install goes into
     /packages/perl-*/source, so I always know exactly what I've
     installed, and

#2:  I'd use ExtUtils::Installed to get a list of installed
     modules on the old installation and verify that I've got
     everything.

Also, if I were being really, really anal-retentive, I'd refuse to use
any modules that don't register themselves in such a way that I can see
them with ExtUtils::Installed.

Plus, if it were really an issue (on a production system, for example),
I'd "diff -r" the two library directories and make sure that the output
makes sense to me.

>Having to reinstall everything and/or modify all the #! lines don't
>strike me as practical.

Reinstalling everything is the only way I'd do it, since I won't use
binary modules with a version of perl other than the one that generated
the Makefile that compiled them.  And, I don't trust myself to
accurately determine which modules have binary components and which
don't, so I'd just reinstall every one of them.  It's not that hard to
reinstall something anyway, especially considering you don't have to go
tracking everything down because you can find most of what you'd need
at CPAN.

Personally, I'd only set the #! lines to point to a specific version of
perl if I felt there was a need for some reason.  Since I make it a
point not to use version-specific stuff, I've never had to.

Actually, the main reason it's nice to have simultaneously-installed,
completely separate trees is that it's then easy to go back to the
previous version if something important stops working.  You just change
/packages/perl to point to the version that was working, and you're
fine.  Then, you delete the old version at your leisure.  I usually end
up deleting old stuff next time I install something in /packages,
provided the old stuff is old enough.

  - Logan


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

Date: 29 Aug 2000 06:26:54 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: The Hacker signature disciplin
Message-Id: <967529487.7424@itz.pp.sci.fi>

In article <eli$0008281836@qz.little-neck.ny.us>, Eli the Bearded wrote:
>
 [JAPH]
>Works in a clever way: print unpack('u*',...) is not very clever.
>This is suject to various peoples personal opinions.

Well, I'd say there are quite a few different types of JAPHs:

Simple but obfuscated:
  print unpack u => q/:2G5S="!A;F]T:&5R(%!E<FP@:&%C:V5R+`H`/

Obvious purpose but convoluted implementation:
  sub AUTOLOAD {sub{print${$_[3]}=~/::(.*)/,$_[5]?" ":",\n"}->(caller 0)}
  hacker(Perl(another(Just())))

"Now just what the heck is this doing?":
  print @{{split//,"buitdtcsxrprlrhognqlvkshjhweoekeuctafanPaJy,r m e z\n"}}{a..z}


>exec{$^X}('Just Another Perl HackerX',$0)unless($^X=~y=X=\cJ=);print$^X

This, I'd say, falls into the second category.  Of course, one of the
signs of a good JAPH is that it defies classification, so the above
list should be treated as nothing more than a random set of examples.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla  | "By promoting postconditions to
and its pseudonyms -    |  preconditions, algorithms become
do not feed the troll.  |  remarkably simple."  -- Abigail



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

Date: 29 Aug 2000 06:45:07 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Unclosed HTML Tags
Message-Id: <967531283.14582@itz.pp.sci.fi>

In article <RGzq5.5228$EB2.117717@news2-win.server.ntlworld.com>, Tazz wrote:
>I have a news Perl scrpt im working on, a user fills out a form, submits
>it, and then it is later displayed with all the news items on one page,
>the problem is this: if someone forgets to close an HTML tag in their
>post (they use <b> but forget to add the </b> end tag) it makes the
>entire page bold.

Parse the HTML, using HTML::Parser (or HTML::TokeParser).  Toss out
any tags you don't recognize as safe.  Add missing end tags if you
like.  Complain if parsing fails.

I bet someone has done this already.  Searching Deja, CPAN and the web
might well turn out an existing solution.


>------=_NextPart_000_001E_01C01134.978018A0
>Content-Type: text/html;
>	charset="iso-8859-1"
>Content-Transfer-Encoding: quoted-printable
>
><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

Please don't do that.  Set your newsreader to post plain text only.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla  | "By promoting postconditions to
and its pseudonyms -    |  preconditions, algorithms become
do not feed the troll.  |  remarkably simple."  -- Abigail



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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 4161
**************************************


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