[23252] in Perl-Users-Digest
Perl-Users Digest, Issue: 5473 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 9 21:05:55 2003
Date: Tue, 9 Sep 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 Tue, 9 Sep 2003 Volume: 10 Number: 5473
Today's topics:
Converting C++ to Perl (Kenny McCarty)
Re: Image::Magick perl: constitute.c:2015: ReadImage: A <mgjv@tradingpost.com.au>
Re: Making a script write to a file (take 2) (Dave)
Re: Making a script write to a file (take 2) <postmaster@castleamber.com>
Re: Making a script write to a file (take 2) <minceme@start.no>
Re: Perl Arguements <postmaster@castleamber.com>
Re: Perl vs TCL (Tad McClellan)
Re: Problem with simple contact script. <noreply@gunnar.cc>
Re: Problem with simple contact script. <postmaster@castleamber.com>
Re: Problem with simple contact script. <noreply@gunnar.cc>
Re: Problem with simple contact script. <postmaster@castleamber.com>
Re: Problem with simple contact script. <noreply@gunnar.cc>
Re: qr// question (Anno Siegel)
Re: Reading Data File Records (Graham)
Re: Reading Data File Records (Jay Tilton)
Speeding up LWP::Simple (David Morel)
Re: Speeding up LWP::Simple <postmaster@castleamber.com>
Re: splitting an array (Jay Tilton)
Re: Using URI::Find to detect Web URL's <emschwar@pobox.com>
Re: Using URI::Find to detect Web URL's <postmaster@castleamber.com>
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 9 Sep 2003 17:55:31 -0700
From: kenny@barmeister.com (Kenny McCarty)
Subject: Converting C++ to Perl
Message-Id: <589a1080.0309091655.6953be6b@posting.google.com>
I am trying to convert this snippet of c++ code to perl and am having
some problems getting the results to match up. I was hoping someone
might be able to help me out. Here is the snippet of C++ code:
DWORD dwVolSerial;
BOOL bIsRetrieved;
char *tmp;
char Data[6];
// Get the serial number
bIsRetrieved =
GetVolumeInformation("C:\\",NULL,NULL,&dwVolSerial,NULL,NULL,NULL,NULL);
// Display the serial number
printf("Serial number of drive C is %X\n",dwVolSerial);
tmp = (char*)&dwVolSerial;
Data[0] = tmp[0];
Data[1] = tmp[1];
Data[2] = tmp[2];
printf("Data is %d-%d-%d\n",Data[0],Data[1],Data[2]);
And here is what I tried in perl:
#just hard coded volume serial number here
$str = '303C-6B38';
@pieces = split(/-/,$str);
@data = split(//,$pieces[0]);
printf("Data: %d-%d-%d\n",ord($data[0]),ord($data[1]),ord($data[2]));
The C++ is run on Windows XP and the perl is run on Free-BSD. For the
perl part I want the user to input the volume serial number of their C
drive and I want to create a strign using this data. I think that the
conversions are different between windows and unix and that is where
my problem is but I am not sure. In windows the "3" becomes a "056"
but in unix it becomes a "53". Any help would be apprecieated.
Thanks.
------------------------------
Date: 09 Sep 2003 23:35:29 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: Image::Magick perl: constitute.c:2015: ReadImage: Assertion `image_info->signature == 0xabacadab' failed
Message-Id: <slrnblsou2.i7c.mgjv@verbruggen.comdyn.com.au>
On Tue, 09 Sep 2003 19:28:30 +0530,
Darshan Shaligram <darshans@aztec.soft.net> wrote:
> robbelljr@aol.com (Rob Bell) writes:
> [ImageMagick]
>> The error is occuring on read of an image file. It's a Linux box. My
>> new questions are: Can anyone here give an indication what type of
>> problem would lead to this type of error:
>
>> perl: constitute.c:2015: ReadImage: Assertion `image_info->signature
>> == 0xabacadab' failed
>
>> Does this seem to be an exception thrown by Perl, by the operating
>> system, or by ImageMagick.
>
> Looks like ImageMagick doesn't like your image file. What kind of image
> is it? Can you open that image file using, say, the GIMP? Can you open
> *other* image files using ImageMagick?
>
> Your image file is probably corrupted.
That shouldn't result in an assertion, but an error returned from the
called function.
>> You may feel free to direct me to a more appropriate newsgroup.
>
> The ImageMagick mailing lists are probably a better place to ask, since
> your problem seems to be unrelated to Perl.
Since the error is an assertion, this hints at a programming error in
ImageMagick itself. Assertions are normally used, and _should_
only be used, to check whether the programmer has made an error. They
should not be used to deal with "normal" error conditions like corrupt
images, or incorrect permissions, or wrong user input.
You should probably report this to the ImageMagick developers.
Martien
--
|
Martien Verbruggen |
Trading Post Australia | 42.6% of statistics is made up on the spot.
|
------------------------------
Date: 9 Sep 2003 15:51:26 -0700
From: prometheus_au@excite.com.au (Dave)
Subject: Re: Making a script write to a file (take 2)
Message-Id: <526e114e.0309091451.2e85986b@posting.google.com>
Abigail <abigail@abigail.nl> wrote in message news:<slrnblgksg.6g7.abigail@alexandra.abigail.nl>...
>
> What have you tried so far?
>
>
> Abigail
Abigail,
I've been working on this.....
$orders_dat = "http//....path to file"
open(ORDERS,">>$orders_dat"); print ORDERS
"$invoice$delimiter$date$delimiter$processing_msg\n"; close(ORDERS);
Cheers
Dave.
------------------------------
Date: Wed, 10 Sep 2003 01:05:57 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Making a script write to a file (take 2)
Message-Id: <1063148864.293097@halkan.kabelfoon.nl>
Dave wrote:
> Abigail <abigail@abigail.nl> wrote in message news:<slrnblgksg.6g7.abigail@alexandra.abigail.nl>...
>
>>What have you tried so far?
>>
>>
>>Abigail
>
>
> Abigail,
>
> I've been working on this.....
>
> $orders_dat = "http//....path to file"
amazing, does open support uploading to an URI?
> open(ORDERS,">>$orders_dat"); print ORDERS
> "$invoice$delimiter$date$delimiter$processing_msg\n"; close(ORDERS);
[1] use a new line now and then and some spaces :-)
[2] open can fail (which quite likely it does here)
[3] close can fail
[4] even print can IIRC.
[5] put -w at the she bang
[6] put "use strict;" (without the qoutes) after the blank line that
follows the she bang (and probably some comment regarding the
script).
--
Kind regards, feel free to mail: mail(at)johnbokma.com (or reply)
virtual home: http://johnbokma.com/ ICQ: 218175426
John web site hints: http://johnbokma.com/websitedesign/
------------------------------
Date: Tue, 9 Sep 2003 23:46:13 +0000 (UTC)
From: Vlad Tepes <minceme@start.no>
Subject: Re: Making a script write to a file (take 2)
Message-Id: <bjloo5$g8t$1@troll.powertech.no>
Dave <prometheus_au@excite.com.au> wrote:
> Abigail <abigail@abigail.nl>
>>
> I've been working on this.....
>
> $orders_dat = "http//....path to file"
>
> open(ORDERS,">>$orders_dat"); print ORDERS
> "$invoice$delimiter$date$delimiter$processing_msg\n"; close(ORDERS);
open() doesn't accept urls as arguments. If the file is on a remote
system you can't use open().
If this is cgi, you must remember to lock your files. Otherwise
simultaneous updates might ruin your files. See 'perldoc -f flock'
for details on how to do this.
Regards,
--
Vlad
------------------------------
Date: Wed, 10 Sep 2003 00:24:36 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Perl Arguements
Message-Id: <1063146382.907425@halkan.kabelfoon.nl>
Michael P. Broida wrote:
> John Bokma wrote:
>
>>And for those who really want the same experience on Windows:
>>http://www.cygwin.com/
>
>
> I am interested in Cygwin, but we need to keep all of
> our systems here in pretty nearly the same configuration
> so we don't introduce problems from dependencies on a
> particular tool.
So why can you use tool Perl but not tool Cygwin?
--
Kind regards, feel free to mail: mail(at)johnbokma.com (or reply)
virtual home: http://johnbokma.com/ ICQ: 218175426
John web site hints: http://johnbokma.com/websitedesign/
------------------------------
Date: Tue, 9 Sep 2003 18:03:47 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl vs TCL
Message-Id: <slrnblsn2j.2c0.tadmc@magna.augustmail.com>
Eric J. Roode <REMOVEsdnCAPS@comcast.net> wrote:
> James Willmore <jwillmore@cyberia.com> wrote in
> news:20030909123749.0cfa013b.jwillmore@cyberia.com:
>
>>
>> Each language has its strengths and its weaknesses.
>>
>
> What are Befunge's strengths? ;-)
Why, its cool name of course.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 10 Sep 2003 00:17:31 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Problem with simple contact script.
Message-Id: <bjljqr$kgb7a$1@ID-184292.news.uni-berlin.de>
Tom wrote:
> OK, for the last time...
>
> #!/usr/bin/perl -wT
>
> use strict;
> use CGI::Carp 'fatalsToBrowser';
> use CGI::ContactForm;
It made me happy to see that you not just looked at CGI::ContactForm,
but actually made use of it. I'm sure you noticed that
CGI::ContactForm is focused on simplicity rather than flexibility.
Nevertheless, with the Perl skill you obviously have, you could still
handle OP's wish to be able to select the recipient address from the form.
<customization snipped>
> Please note:
>
> my $o = new CGI(\*STDIN); # in ContactForm.pm was changed to
> my $o = new CGI(); # since method post is used in the input form.
Noticed. I will make that change in the next version, so as to not
make this kind of customization unnecessarily difficult.
Thanks for a creative example of how CGI::ContactForm can be
customized! Now, let's hope that nobody will point out anything
dangerous with this solution. :)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 10 Sep 2003 00:27:34 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Problem with simple contact script.
Message-Id: <1063146560.801660@halkan.kabelfoon.nl>
Tom wrote:
> my $towhom = param("towhom");
> if(!$towhom) { $towhom = "loanofficer" }
I consider this bad. You are fixing broken input.
--
Kind regards, feel free to mail: mail(at)johnbokma.com (or reply)
virtual home: http://johnbokma.com/ ICQ: 218175426
John web site hints: http://johnbokma.com/websitedesign/
------------------------------
Date: Wed, 10 Sep 2003 01:09:52 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Problem with simple contact script.
Message-Id: <bjlmt7$komd2$1@ID-184292.news.uni-berlin.de>
John Bokma wrote:
> Tom wrote:
>
>> my $towhom = param("towhom");
>> if(!$towhom) { $towhom = "loanofficer" }
>
> I consider this bad. You are fixing broken input.
CGI::ContactForm requires that a (syntactically) correct recipient
address is passed to it, or else the empty form won't be displayed.
The recipient address is originally hard coded, and not dependent on
submitted user input. Accordingly, the above fix is not about fixing
broken input.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 10 Sep 2003 01:52:58 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Problem with simple contact script.
Message-Id: <1063151685.341916@halkan.kabelfoon.nl>
Gunnar Hjalmarsson wrote:
> John Bokma wrote:
>
>> Tom wrote:
>>
>>> my $towhom = param("towhom");
>>> if(!$towhom) { $towhom = "loanofficer" }
>>
>>
>> I consider this bad. You are fixing broken input.
>
>
> CGI::ContactForm requires that a (syntactically) correct recipient
> address is passed to it, or else the empty form won't be displayed. The
> recipient address is originally hard coded, and not dependent on
> submitted user input. Accordingly, the above fix is not about fixing
> broken input.
I read it as: try to obtain the parameter "towhom" and if this fails
(shouldn't be this a defined test?) use a hard coded value. IMHO this
means that the script tries to fix a missing <input> value.
Why is this missing? Because someone is calling the script without using
the proper form (I guess).
Should you fix this? IMHO: never. Don't fix unexpected input.
Or I didn't understand the script and if so I apologise :-).
--
Kind regards, feel free to mail: mail(at)johnbokma.com (or reply)
virtual home: http://johnbokma.com/ ICQ: 218175426
John web site hints: http://johnbokma.com/websitedesign/
------------------------------
Date: Wed, 10 Sep 2003 02:39:13 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Problem with simple contact script.
Message-Id: <bjls56$k9ofj$1@ID-184292.news.uni-berlin.de>
John Bokma wrote:
> Gunnar Hjalmarsson wrote:
>> John Bokma wrote:
>>> Tom wrote:
>>>
>>>> my $towhom = param("towhom"); if(!$towhom) { $towhom =
>>>> "loanofficer" }
>>>
>>> I consider this bad. You are fixing broken input.
>>
>> CGI::ContactForm requires that a (syntactically) correct
>> recipient address is passed to it, or else the empty form won't
>> be displayed. The recipient address is originally hard coded, and
>> not dependent on submitted user input. Accordingly, the above fix
>> is not about fixing broken input.
>
> I read it as: try to obtain the parameter "towhom" and if this
> fails (shouldn't be this a defined test?) use a hard coded value.
> IMHO this means that the script tries to fix a missing <input>
> value.
Well, it's of course correct that it has that effect _as well_,
besides what I mentioned above. Replacing those two lines with the
following would take care of it:
my $towhom;
if ($ENV{REQUEST_METHOD} eq 'POST') {
$towhom = param("towhom");
} else {
$towhom = "loanofficer";
}
With that change, rather than sending to the default address, an error
message would be displayed if for some reason $towhom isn't assigned
any of the expected values.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 9 Sep 2003 22:59:55 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: qr// question
Message-Id: <bjlm1b$3vu$1@mamenchi.zrz.TU-Berlin.DE>
John W. Krahn <krahnj@acm.org> wrote in comp.lang.perl.misc:
> Anno Siegel wrote:
> >
> > Matija Papec <mpapec@yahoo.com> wrote in comp.lang.perl.misc:
> > >
> > > Obviously consistency is hard thing to achieve.
> >
> > "Perl does what you want, unless you want consistency"
>
> Can I quote you on that? :-)
You'd be quoting Larry Wall, more or less, or at least some edition of
the Camel. It wasn't about Perl in general, but, I think it assignment
in various contexts that he said that.
Anno
------------------------------
Date: 9 Sep 2003 15:41:03 -0700
From: GrahamWilsonCA@yahoo.ca (Graham)
Subject: Re: Reading Data File Records
Message-Id: <eda30d78.0309091441.36a36d3@posting.google.com>
> Post your code - I have no idea what you are trying to do. Maybe it's
> just me ;)
It seems it isn't just you. All I am trying to do is get the data
blocks into a suitable perl structure so I can calculate some simple
statistics and reformat it for another program. See comments in the
second while loop.
I really appreciate the help. I have a pile of files with this type
of structure (a legacy of an ancient postdoc) that I need to
manipulate and reformat.
---
# Open the file handle
$fh = new FileHandle;
# Open the file
$fh->open($ARGV[$argnum], "r");
# Quit if there are problems
if (!defined $fh)
{
die "Unable to open $filename\n";
}
# Strip the file header
while ( substr($header, 0, 1) =~ "!" )
{
$header = <$fh>;
}
# Strip comment string from number of levels
@header = split "!", $header, 2;
$numLev = int @header[0];
# Read the data blocks
while ( defined ($line = <$fh>) )
{
# Strip comments from each line
@line = split "!", chomp($line), 2;
$line = $line[0];
# This is where I am lost... I want to read in each data block
or record into a suitable
# perl structure... perhaps an array of lists?
# Each record starts with a block name and a set of units.
I.e.
# '*aaa [units]'
# Next is a listing of double precision numbers of length
$numLev.
# They may be space or comma separated and have an arbitrary
number of rows and
# columns
# For what it is worth, the column width is restricted to 132
characters. I.e
# 1.0, 2.0, 3.0, 4.0, ..., n
# 1.0 2.0 3.0 4.0 ... n
# Something like:
# BlockID[0]: 'aaa'
# BlockUnits[0]: 'units'
# BlockData[0]: (1.0, 2.0, 3.0, 4.0, 5.0, ..., n)
}
---
------------------------------
Date: Tue, 09 Sep 2003 23:24:42 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Reading Data File Records
Message-Id: <3f5e5f12.606289075@news.erols.com>
GrahamWilsonCA@yahoo.ca (Graham) wrote:
: I have a data file that looks like:
:
: --
: ! Comment 1
: ! Comment 2
: ! Comment ...
: 5 ! number of levels
: *aaa [aaa units] ! space deliminated is common
: 1.0 2.0 3.0 4.0 5.0
: *bbb [bbb units] ! csv is possible
: 1.0, 2.0, 3.0,
: 4.0 5.0
^
^
Should there be a comma between those two values?
: *ccc [ccc units] ! the file is written from fortran and the number of
: columns is not fixed
Is this really how the data file is formatted, or did your newsreader
word-wrap that line for you?
: 10.0
: 20.0
: 30.0
: 40.0
: 50.0
: ...
: --
:
: Essentially, there is a header block that always begins with '!' in
: the first column. This is followed by the number of elements in each
: data block and an unknown number of data blocks having a set number of
: elements.
The problem is determining where one block ends and another begins when
the only thing known about the block is how many elements it contains.
There's no apparent consistency or predictability to how the blocks may
be formatted, or to how the elements are separated. Altering the input
record separator, $/, then reading in a number of records isn't going to
work.
What might work would be to read lines of data until a block's requisite
number of elements have been acquired, but the elements themselves will
need to have a consistent, recognizable format, and a newline character
has to mark the boundary between blocks. From the sample data, the
elemets all seem to be numbers with one place after the decimal.
As a first approximation of workable code,
#!perl
use warnings;
use strict;
my $elems_per_block;
while(<DATA>) {
next if /^!/;
($elems_per_block) = /^(\d+)/;
last;
}
my @blocks;
while(<DATA>) {
my $block = $_;
my $n = 0;
while(<DATA>) {
$block .= $_;
last if $elems_per_block == ($n += () = /(\b\d+\.\d\b)/g);
}
push @blocks, $block;
}
for( @blocks ) {
# whatever processing each block needs
print "Block:\n$_\n";
}
__DATA__
! Comment 1
! Comment 2
! Comment ...
5 ! number of levels
*aaa [aaa units] ! space deliminated is common
1.0 2.0 3.0 4.0 5.0
*bbb [bbb units] ! csv is possible
1.0, 2.0, 3.0,
4.0 5.0
*ccc [ccc units] ! the file is written from fortran and the number of
columns is not fixed
10.0
20.0
30.0
40.0
50.0
: The file is generated using about five lines of FORTRAN so it seems
: somehwat surprising that I am up to 30 lines of perl with almost no
: end in sight...
Why should that be surprising? You're trying to build a modicum of
intelligence into one tool to compensate for another's lack of
sophistication. The Perl program would have a much easier time reading
if the FORTRAN program was only a little better at writing.
------------------------------
Date: 9 Sep 2003 16:55:08 -0700
From: altalingua@hotmail.com (David Morel)
Subject: Speeding up LWP::Simple
Message-Id: <60c4a7b1.0309091555.4cc0fe7b@posting.google.com>
Hi all,
I am looking to collect the HTML of approximately 30 million urls, in
as simple a manner as possible, perhaps using the LWP::Simple module.
If I choose to use LWP::Simple, how can I speed up the process?
It seems that it would be too time consuming to collect the HTML one
url at a time... is there any way to collect, say, 10 urls at a time?
20 urls at a time?
Any ideas on how I might implement this or how long it might take to
gather the information?
Thanks,
David Morel
------------------------------
Date: Wed, 10 Sep 2003 02:06:20 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Speeding up LWP::Simple
Message-Id: <1063152487.340076@halkan.kabelfoon.nl>
David Morel wrote:
> Hi all,
>
> I am looking to collect the HTML of approximately 30 million urls, in
> as simple a manner as possible, perhaps using the LWP::Simple module.
> If I choose to use LWP::Simple, how can I speed up the process?
Running processes in parallel. Or even using multiple computers.
split the 30,000,000 urls over say 30 files and let each handle
1,000,000 urls (start 30 processes is probably the easiest way in an
*nix environment)
> It seems that it would be too time consuming to collect the HTML one
> url at a time... is there any way to collect, say, 10 urls at a time?
> 20 urls at a time?
spark 10 or 20 processes or use threads
> Any ideas on how I might implement this or how long it might take to
> gather the information?
depends on a lot: average size of each HTML file (20 kbyte?)
bandwidth, overhead of parallel processing, errors.
Say if you can do 600 kbyte a second with 30 processes it wil take ~
1,000,000 seconds in a perfect world.
--
Kind regards, feel free to mail: mail(at)johnbokma.com (or reply)
virtual home: http://johnbokma.com/ ICQ: 218175426
John web site hints: http://johnbokma.com/websitedesign/
------------------------------
Date: Tue, 09 Sep 2003 23:27:04 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: splitting an array
Message-Id: <3f5e615e.606876538@news.erols.com>
"Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de> wrote:
: Also sprach Philip Lees:
:
: > On Sat, 06 Sep 2003 23:05:29 GMT, tiltonj@erols.com (Jay Tilton)
: > wrote:
: >
: >>Kinda fun. I remember seeing variations on this problem solved before on
: >>clpm, but I couldn't hit on the right Google Groups search terms. Any
: >>pointers?
: >
: > Wasn't it one of MJDs quizzes of the week?
:
: Yes, it was some time ago. The related archive of discussions can
: probably be found somewhere at <http://perl.plover.com/qotw/>.
Found it.
http://article.gmane.org/gmane.comp.lang.perl.qotw.quiz-of-the-week/43
And naturally there's a module squirrelled away on CPAN that does the
job.
------------------------------
Date: Tue, 09 Sep 2003 16:20:12 -0600
From: Eric Schwartz <emschwar@pobox.com>
Subject: Re: Using URI::Find to detect Web URL's
Message-Id: <etollsxob8j.fsf@wormtongue.emschwar>
"\"Dandy\" Randy" <ducott@hotmail.com> writes:
> A while back I added a post about URL detection. To date I have not been
> able to figure it out. There seems to be very little docu. on this. This is
> what I'm trying to do. I have an html web page with a single textarea form
> named "content" The form action points to my detect.pl script.
>
> #!/usr/bin/perl
use warnings;
use strict;
> use URI::Find;
>
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
You don't check this for success.
> @pairs = split(/&/, $buffer);
What if the browser submits them separated by ; ?
> foreach $pair (@pairs) {
> ($name, $value) = split(/=/, $pair);
> $value =~ tr/+/ /;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
ick. Drop all that, and replace with
use URI::Escape;
$value = uri_unescape($value);
Or better yet, stop doing it entirely.
> $form{$name} = $value;
> }
>
> $htmlcontent = $form{'content};
This is pretty broken, and it won't even compile (hint: note the lack
of closing quote in the line above). Please don't re-type code; you
introduce bugs that way that aren't even really in your code, and
waste people's time trying to debug them instead of your real problem.
You can do this by using CGI.pm instead of all that incorrect broken
code above:
use CGI qw/:standard/;
my $cgi = CGI->new;
$htmlcontent = $cgi->param('content');
Simple, easy, and *correct*.
> So basically what I'm looking to do is assign the form data to a variable,
> then scan it for web AND email addressed, and repleace them with the needed
> HTML tags ... <a href ... <mailto ... etc. ect. Then the changed data gets
> saved to a text file, where I use SSI to include the data into my page.
> Points to note would be the form data will almost always contain multipul
> lines and perhaps multipul occurances of web addressed. Can someone please
> help me fill in the missing code? TIA!!!!!
Troll through CPAN for stuff like this. It looks like you might get
some inspiration from texthyper or txt2html, or perhaps you could use
one of them directly.
-=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: Wed, 10 Sep 2003 01:01:52 +0200
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Using URI::Find to detect Web URL's
Message-Id: <1063148619.290489@halkan.kabelfoon.nl>
Eric Schwartz wrote:
> my $cgi = CGI->new;
Cool to see others doing this as well. I consider using $query rather
foolish in most cases :-). Using $cgi promotes self documenting code
--
Kind regards, feel free to mail: mail(at)johnbokma.com (or reply)
virtual home: http://johnbokma.com/ ICQ: 218175426
John web site hints: http://johnbokma.com/websitedesign/
------------------------------
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 5473
***************************************