[17789] in Perl-Users-Digest
Perl-Users Digest, Issue: 5209 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 27 21:05:52 2000
Date: Wed, 27 Dec 2000 18:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <977969106-v9-i5209@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 27 Dec 2000 Volume: 9 Number: 5209
Today's topics:
Code Review? <emerald-arcana@home.com>
Re: FAQ 6.21: What's wrong with using grep or map in (Tim Hammerquist)
Re: for var aliasing on values %hash <wescott@conterra.com>
How the Script Works <emerald-arcana@home.com>
Re: How to delete items from an array? <uri@sysarch.com>
Re: just SELECT * from MSSQL 7.0 ?? <bwalton@rochester.rr.com>
Re: just SELECT * from MSSQL 7.0 ?? <taboo@comcen.com.au>
NEED SCRIPTING DONE <ppdc@home.com>
Re: NEED SCRIPTING DONE <taboo@comcen.com.au>
opening database problem <djo22@cornell.edu>
Re: opening database problem <bwalton@rochester.rr.com>
Re: Our question - Possible Legacy code question... <joejava@dragonat.net>
problem opening database <djo22@cornell.edu>
Re: problem opening database <bwalton@rochester.rr.com>
Re: Problems with Archive::Tar <johngros@Spam.bigpond.net.au>
Re: RSH and PING <bwalton@rochester.rr.com>
Sending Zero Values from Forms georgebailey@my-deja.com
Re: Sending Zero Values from Forms <taboo@comcen.com.au>
Re: Sending Zero Values from Forms <bart.lateur@skynet.be>
Re: Text Conversion in Perl georgebailey@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 28 Dec 2000 00:17:40 GMT
From: Arcana <emerald-arcana@home.com>
Subject: Code Review?
Message-Id: <EEv26.29447$59.8971251@news3.rdc1.on.home.com>
Does anyone here mind doing a review of my script and making appropriate
comments? I don't have specific problems, but I'd like to perhaps be
enlightened in some of the finer points of programming. My script seems
(to me) very rudimentary and I'd like to become aware of different
techniques I could use when solving further problems.
I'll start with the description of my problem, and the way I solve it, then
I'll post the script.
PROBLEM:
I run an online fantasy game that features an application for new players.
Players must fill in a form, known as a Persona Sheet (or p-sheet for
short) that asks for information about their characters. A sample copy of
a P-sheet appears below:
PERSONA SHEET
~~~~~~~~~~~~~
---
Player Information
------------------
**Name (or alias):
**E-mail Address:
Age:
Gender:
ICQ/AIM/Yahoo Pager! (etc):
Why do you want to join?:
Other notes:
---
Character Quick Reference
-------------------------
(Keep these fields short: preferrably a few words.
These are displayed on the Persona Web Page.)
**Name:
**Age:
**Gender:
**Occupation:
**General Appearance:
**Personality:
The player is asked to save a copy of the sheet to their hard drive. They
fill it out and E-mail it back to the Persona Verifier. When the sheet is
judged to be suitable, the sheet must be added to the web page.
The web page displays the following information in a table:
Player's Name
Player's E-mail address
Persona name
Persona age
Persona occupation
Persona gender
What I want to do is to parse this data from the P-sheet and output it in a
record that is a part of a text database. (Later this text file is parsed
to create an HTML index).
I hope that's a good description of the problem.
The script I have is below:
#!/usr/bin/perl -w
#
# 2000-12-23 Irwin Kwan
#
# This script parses a DeM P-sheet file and takes out
# the Character Name, Age, Occupation, Gender, Player
# name, and player E-mail address. This information
# is printed to STDOUT as a record.
#
# (the output can be piped into a utility
# that will generate the HTML code to put into a P-sheet)
#
# THINGS TO DO:
# 1. Check "age" for numerics. If not, then write ? or try to
# strip out a number in case you get "Somewhere around 17-18"
# 2. Use blocks.
{ # Main block
use diagnostics;
use strict;
###############
# Only works on Version 2 P-sheets.
# Constants to parse for:
my $F_name = quotemeta "**Name (or alias):" ;
my $F_email = quotemeta "**E-mail Address:";
my $F_pname = quotemeta "**Name:";
my $F_age = quotemeta "**Age:";
my $F_gender = quotemeta "**Gender:";
my $F_occupation = quotemeta "**Occupation:";
my $F_appearance = quotemeta "**General Appearance:";
my $F_personality = quotemeta "**Personality:";
###############
# Argument handling.
if ( $ARGV[0] eq "") {
die "Argument: <filename> (A P-sheet file.)\n";
}
# Sheet filename
my $sheetfile = $ARGV[0];
# The hashtable we're going to use
my %pdata;
# SHEET is filehandle for the P-sheet
open(SHEET, $sheetfile) || die "ERROR opening $sheetfile\n";
# Streams file into $_ and parses
while (<SHEET>) {
# must strip newlines at end
s/\s+$//;
# Get player name
if ( /^$F_name/ ) {
s/^$F_name\s+//;
$pdata{"name"} = $_;
# Get E-mail address
} elsif (/^$F_email/) {
s/^$F_email\s+//;
$pdata{"email"} = $_;
# Get persona name
} elsif (/^$F_pname/) {
s/^$F_pname\s+//;
$pdata{"pname"} = $_;
# Get persona age
# TO DO: error check result for either a NUMERAL or ?
} elsif (/^$F_age/) {
s/^$F_age\s+//;
$pdata{"age"} = $_;
# Get gender and convert to M, F, or ?
} elsif (/^$F_gender/) {
s/^$F_gender\s+//;
my $genderline = $_;
# Male if user typed "male, Male, M, m, Mail, etc.
if ( $genderline =~/^[Mm](\w*)/ ) {
$pdata{"gender"} = "M";
# Female if user typed F, f, FEMALE, etc.
} elsif ( $genderline =~ /^[Ff]/ ) {
$pdata{"gender"} = "F";
# Indeterminate gender is question mark
} else {
$pdata{"gender"} = "?";
}
# Get occupation
# Multiple line-input?
} elsif (/^$F_occupation/) {
s/^$F_occupation\s+//;
$pdata{"occupation"} = $_;
# Get appearance
## TODO: get multiple line descriptions
} elsif (/^$F_appearance/) {
s/^$F_appearance\s+//;
$pdata{"appearance"} = $_;
# Get personality
## TODO: get multiple line personality
} elsif (/^$F_personality/) {
s/^$F_personality\s+//;
$pdata{"personality"} = $_;
}
} # End reading from file
close(SHEET);
## This section is dull and not well-extendible: edit soon
# Create a data record for P-data
# print out hashtable line-by-line with | separators
print $pdata{"pname"};
print "|";
print $pdata{"age"};
print "|";
print $pdata{"gender"};
print "|";
print $pdata{"occupation"};
print "|";
print $pdata{"name"};
print "|";
print $pdata{"email"};
#print "|";
## Hold off on these last two until I can parse
## multiple lines
# print "$pdata{"appearance"};
# print "|";
# print "$pdata{"personality"}
print "\n";
} ## end script
EXAMPLES
---------
Here's some example input in a file called p-lilly.txt:
PERSONA SHEET
~~~~~~~~~~~~~
---
Player Information
------------------
**Name (or alias): Arcana
**E-mail Address: emerald-arcana@home.com
Age:
Gender:
ICQ/AIM/Yahoo Pager! (etc):
Why do you want to join?:
Other notes:
---
Character Quick Reference
-------------------------
(Keep these fields short: preferrably a few words.
These are displayed on the Persona Web Page.)
**Name: Lilly
**Age: 16
**Gender: F
**Occupation: Student
**General Appearance: Very small girl with black hair and brown eyes.
She is petite and has a narrow waist.
**Personality: Very quiet and shy. She is afraid to express herself and
tends not to speak up very often.
---
and an example of the program invoked from the command line.
---
[irwink@sapphire ~/perl_junk/dem]$ ./psheet.pl p-lilly.txt
Lilly|16|F|Student|Arcana|emerald-arcana@home.com
---
If anyone has comments about oversights, ways I can improve my coding
style, more efficient techniques, et cetera, please let me know! Thank you
very much for reviewing my code and have a good day!
--
-- Arcana
------------------------------
Date: Thu, 28 Dec 2000 01:20:36 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: FAQ 6.21: What's wrong with using grep or map in a void context?
Message-Id: <slrn94l5f9.a3h.tim@degree.ath.cx>
Abigail <abigail@foad.org> wrote:
> Tim Hammerquist (tim@degree.ath.cx) wrote on MMDCLXXV September MCMXCIII
> in <URL:news:slrn94ijnl.9cd.tim@degree.ath.cx>:
> ?? John Lin <johnlin@chttl.com.tw> wrote:
> ?? > Hey, map and grep, you can save the trouble of building up a return list
> ?? > when (not defined wantarray), right? Don't blame the programmers.
> ??
> ?? Um, you can just use a for loop instead of map. Then you don't waste
> ?? the return list. The chances that the implementation of grep() and
> ?? map() will be changed are very slim with a construct so similar and
> ?? frequently used already in existence.
>
> Because one way of doing it in favour of another is all in the
> spirit of Perl, right?
Good point, but why petition for a change in implementation when the
contruct almost exactly like you'd be changing it to already exists?
> Besides, who needs both for, while, until, map, grep and bare blocks
> when you can just use goto. Then you don't waste anything!
Ha ha. =)
> The fact that map in void context is inefficient is a bug in perl, the
> implementation. Not the language. Cure the disease, don't ridicule
> someone for the symptoms.
Is it inefficient? Or is it just doing a lot of stuff that some
programmers forfeit when using it in void context? Or maybe both?
--
-Tim Hammerquist <timmy@cpan.org>
People get annoyed when you try to debug them.
-- Larry Wall, 1999
------------------------------
Date: Wed, 27 Dec 2000 23:07:48 GMT
From: Mike Wescott <wescott@conterra.com>
Subject: Re: for var aliasing on values %hash
Message-Id: <ospuidcvjg.fsf@eriadne.sc.rr.com>
Mike Wescott <wescott@conterra.com> writes:
> The perlfunc.pod has not (yet) been updated to reflect this.
> Yeah, I know, "patches are welcome". :-)
The developer version (5.7) has.
--
Mike Wescott
wescott@conterra.com
------------------------------
Date: Thu, 28 Dec 2000 00:20:27 GMT
From: Arcana <emerald-arcana@home.com>
Subject: How the Script Works
Message-Id: <fHv26.29449$59.8976469@news3.rdc1.on.home.com>
Just to make your lives easier, here's a pseudocode outline of what my
program does:
1) Open the file specified on the command line
2) Look for the variables to parse for in the file (defined at top)
IF MATCH: then use substitution and blank out the field label. Save the
result (which should be the rest of the line) to a hashtable.
3) Print hashtable in specified order at bottom of program to STDOUT
--
-- Arcana
------------------------------
Date: Wed, 27 Dec 2000 23:26:30 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: How to delete items from an array?
Message-Id: <x73df9bg49.fsf@home.sysarch.com>
>>>>> "A" == Abigail <abigail@foad.org> writes:
A> This is of course wrong. After replacing map by grep, you select 5
A> out of 10 elements. The original poster wanted 6. You lose $array [9].
i jumped into the middle of this thread and as bart pointed out, i was
not too sharp anyhow.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Thu, 28 Dec 2000 00:58:16 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: just SELECT * from MSSQL 7.0 ??
Message-Id: <3A4A9094.3BF98FDC@rochester.rr.com>
Christian Tawfik wrote:
...
> i just want to execute a SELECT * in a perl script!
>
> perl is running on Solaris 2.6 and a MSSQL 7.0 server should be
> accessed.
>
> is there a possibility without installing DBD::Sybase module??
> (and setting up a workaround to get to this damn MS product?)
>
> or is there a direct way to connect to a MSSQL server??
>
> thx chris
Well, maybe DBD::Proxy would help? See:
http://tlowery.hypermart.net/perl_dbi_dbd_faq.html#HowDoIAccessMSWindowsDB
for more info.
--
Bob Walton
------------------------------
Date: 28 Dec 2000 12:08:54 +1100
From: "Kiel " <taboo@comcen.com.au>
Subject: Re: just SELECT * from MSSQL 7.0 ??
Message-Id: <3a4a92a6$1@nexus.comcen.com.au>
Christian Tawfik <toughiq@i-one.at> wrote:
>hi,>
>i just want to execute a SELECT * in a perl script!
>
>perl is running on Solaris 2.6 and a MSSQL 7.0 server should be
>accessed.
>
>is there a possibility without installing DBD::Sybase module??
>(and setting up a workaround to get to this damn MS product?)
>
>or is there a direct way to connect to a MSSQL server??
>
>thx chris
>
>
open a pipe to mssql client.
------------------------------
Date: Thu, 28 Dec 2000 00:40:43 GMT
From: "alan feiler" <ppdc@home.com>
Subject: NEED SCRIPTING DONE
Message-Id: <f_v26.169352$hD4.44040392@news1.rdc1.mi.home.com>
can work remote.
thanks ppdc@ppdc.net
------------------------------
Date: 28 Dec 2000 12:10:43 +1100
From: "Kiel" <taboo@comcen.com.au>
Subject: Re: NEED SCRIPTING DONE
Message-Id: <3a4a9313$1@nexus.comcen.com.au>
"alan feiler" <ppdc@home.com> wrote:
>can work remote.
>thanks ppdc@ppdc.net
woohaa remote work, g well done.
Good 4 u alan.
------------------------------
Date: Wed, 27 Dec 2000 19:16:35 -0500
From: "Dan O'Connor" <djo22@cornell.edu>
Subject: opening database problem
Message-Id: <92e18i$am5$1@news01.cit.cornell.edu>
Hello all!
I've searched desperately but can't find any help in here or deja or
anything, so I'll ask the pros =). All I'm trying to do is open a database
(.db) file and go through the records. Here's the error:
Failed to open file: Invalid argument at .....\check4existing.pl line 19.
Here's the code: (line 19 is the second line)
$DBFILE_NAME = "\contest\accounts.db";
open(FILE, "<$DBFILE_NAME") or die("Failed to open file: $!");
Thanks a ton,
Dan
------------------------------
Date: Thu, 28 Dec 2000 01:06:17 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: opening database problem
Message-Id: <3A4A9274.EA95B2CB@rochester.rr.com>
Dan O'Connor wrote:
>
> Hello all!
> I've searched desperately but can't find any help in here or deja or
> anything, so I'll ask the pros =). All I'm trying to do is open a database
> (.db) file and go through the records. Here's the error:
>
> Failed to open file: Invalid argument at .....\check4existing.pl line 19.
>
> Here's the code: (line 19 is the second line)
>
> $DBFILE_NAME = "\contest\accounts.db";
> open(FILE, "<$DBFILE_NAME") or die("Failed to open file: $!");
>
...
> Dan
Please don't post the same request twice. Doing so does not make it
more likely your post will be replied to. It might get you plonked
instead.
--
Bob Walton
------------------------------
Date: Wed, 27 Dec 2000 18:36:07 -0500
From: "Joel Ricker" <joejava@dragonat.net>
Subject: Re: Our question - Possible Legacy code question...
Message-Id: <T3v26.3348$IL1.118467@news2.atl>
nobull@mail.com wrote in message ...
>"Joel Ricker" <joejava@dragonat.net> writes:
>Have you considered looking a version of the FAQ contemporary with the
>version of Perl that you find does not support our()? (D'oh!)
I did. That didn't answer the question. our() never comes up as an error.
That would be pretty obvious wouldn't it? But it doesn't. Thats why I
asked for verification. Just a simple question.
>> Can I just change our to my?
>
>No, but you can change to "use vars". The semantics of our() are
>different from use vars but for all but the most obfuscated code that
>isn't going to matter.
Thanks working fine now.
Joel
------------------------------
Date: Wed, 27 Dec 2000 19:24:53 -0500
From: "Dan O'Connor" <djo22@cornell.edu>
Subject: problem opening database
Message-Id: <92e18j$am5$2@news01.cit.cornell.edu>
Hey all!
I searched to no avail everywhere but can't find the answer to my
problem. All I simply want to do is open a database (.db) and go through
the records. I can't even do the opening database part right! If anyone
knows why this isn't working I'll be so grateful. BTW the server says I
have read/write access for the database.
My code snippet:
$DBFILE_NAME = "\contest\accounts.db";
open(FILE, "<$DBFILE_NAME") or die("Failed to open file: $!");
My error:
Failed to open file: Invalid argument at ...\check4existing.pl line 19.
line 19 is the open(FILE, "<$DBFILE_NAME")... line.
Any help is greatly appreciated.
Thanks a ton,
Dan
------------------------------
Date: Thu, 28 Dec 2000 01:03:12 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: problem opening database
Message-Id: <3A4A91BB.3465F9A1@rochester.rr.com>
Dan O'Connor wrote:
>
> Hey all!
> I searched to no avail everywhere but can't find the answer to my
> problem. All I simply want to do is open a database (.db) and go through
> the records. I can't even do the opening database part right! If anyone
> knows why this isn't working I'll be so grateful. BTW the server says I
> have read/write access for the database.
>
> My code snippet:
>
> $DBFILE_NAME = "\contest\accounts.db";
> open(FILE, "<$DBFILE_NAME") or die("Failed to open file: $!");
>
> My error:
> Failed to open file: Invalid argument at ...\check4existing.pl line 19.
>
> line 19 is the open(FILE, "<$DBFILE_NAME")... line.
...
> Dan
Dan, try either quoting the \'s in your path\file, enclosing them with '
instead of ", or using / instead of \. Things like \c and \a get
interpolated when inside of " strings, and don't come through as the
literal characters you obviously expected. Read:
perldoc perlop
especially the section on quote and quote-like operators.
--
Bob Walton
------------------------------
Date: Wed, 27 Dec 2000 23:19:45 GMT
From: "John Boy Walton" <johngros@Spam.bigpond.net.au>
Subject: Re: Problems with Archive::Tar
Message-Id: <lOu26.35144$xW4.275476@news-server.bigpond.net.au>
> unlink($newfile);
Woops that deletes your archived file.
I think you wanted to unlink the old log file.
> print header;
> print qq(Job Done!);
>
> ___________________
>
> I get the feeling I'm close to achieving what I want, but what I actually
> get in "/home/servername/www/archives/" is a file called "access-log.tar"
> with a zero-byte size. It seems I'm moving the original file
successfully,
> and creating the "tar" file successfully, but the command to write the
> logfile to the "tar" file is failing...
>
> Can anyone see what's wrong with the above?
>
> Thanks and Merry Christmas!
------------------------------
Date: Thu, 28 Dec 2000 01:26:14 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: RSH and PING
Message-Id: <3A4A9722.E71F4951@rochester.rr.com>
marvin wrote:
...
> I am using Perl 5.005 on Sun/Unix machines. I have plenty of scripts,
> which scan over intranet specific servers via $output=`rsh ...` command.
> Now, if I switch one of those servers off, rsh hangs into infinite loop.
> The solution would be to ping before issue rsh command. My question is,
> do I have to do ping using system or `` command, or there is one of
> module I can use to check if host is alive or not.
...
Check out Net::Ping.
--
Bob Walton
------------------------------
Date: Thu, 28 Dec 2000 00:58:11 GMT
From: georgebailey@my-deja.com
Subject: Sending Zero Values from Forms
Message-Id: <92e371$8eq$1@nnrp1.deja.com>
This might be a dumb question, but, as they say "Why Doesn't This
Work?"
<FORM ACTION="myscript.pl" METHOD="post">
<INPUT TYPE="checkbox" NAME="Item Zero" VALUE="0">Item Zero<BR>
<INPUT TYPE="checkbox" NAME="Item One" VALUE="1">Item One<BR>
<INPUT TYPE="checkbox" NAME="Item Two" VALUE="2">Item Two<BR>
<INPUT TYPE="submit">
When I parse that form in myscript.pl, and ask it to print out
$Form{'Item Zero'} I get nothing -- or rather, I get zero characters,
not the number zero.
Everything else comes over OK, and if I set the method to GET then I
can clearly see ?Item+Zero=0&Item+One=1&Item+Two=2 in the URL.
I'm sure I'm missing something obvious. I used the parse_form
subroutine from FormMail.pl, one of the scripts from Matt Wright. Could
it be destroying zero values somehow when it reads in the name/value
pairs or assigns them to the hash, or is there something more
fundamental that I don't understand?
TIA
George
--
~~ ...and dance by the light of the moon
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 28 Dec 2000 12:27:54 +1100
From: "Kiel" <taboo@comcen.com.au>
Subject: Re: Sending Zero Values from Forms
Message-Id: <3a4a971a$1@nexus.comcen.com.au>
georgebailey@my-deja.com wrote:
>This might be a dumb question, but, as they say "Why Doesn't This>Work?"
>
><FORM ACTION="myscript.pl" METHOD="post">
><INPUT TYPE="checkbox" NAME="Item Zero" VALUE="0">Item Zero<BR>
><INPUT TYPE="checkbox" NAME="Item One" VALUE="1">Item One<BR>
><INPUT TYPE="checkbox" NAME="Item Two" VALUE="2">Item Two<BR>
><INPUT TYPE="submit">
>
>When I parse that form in myscript.pl, and ask it to print out
>$Form{'Item Zero'} I get nothing -- or rather, I get zero characters,
>not the number zero.
>
>Everything else comes over OK, and if I set the method to GET then I
>can clearly see ?Item+Zero=0&Item+One=1&Item+Two=2 in the URL.
>
>I'm sure I'm missing something obvious. I used the parse_form
>subroutine from FormMail.pl, one of the scripts from Matt Wright. Could
>it be destroying zero values somehow when it reads in the name/value
>pairs or assigns them to the hash, or is there something more
>fundamental that I don't understand?
>
>TIA
>
>George
you are setting it to 0 in your code ie,
<input type="text" [ -> value="0" <- ] >
this will over wright any enter value.
------------------------------
Date: Thu, 28 Dec 2000 02:03:33 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Sending Zero Values from Forms
Message-Id: <i47l4t4pmo32c7nfaqb6op54bjk2ct1iqg@4ax.com>
georgebailey@my-deja.com wrote:
><INPUT TYPE="checkbox" NAME="Item Zero" VALUE="0">Item Zero<BR>
>When I parse that form in myscript.pl, and ask it to print out
>$Form{'Item Zero'} I get nothing -- or rather, I get zero characters,
>not the number zero.
>
>Everything else comes over OK, and if I set the method to GET then I
>can clearly see ?Item+Zero=0&Item+One=1&Item+Two=2 in the URL.
It looks to me like there could be some OR'ring going on, where your
value is OR'red out by a default, the empty string.
>I'm sure I'm missing something obvious. I used the parse_form
>subroutine from FormMail.pl, one of the scripts from Matt Wright.
Oh dear. A good recipe for a certain desaster.
I've grabbed the source for this at
<http://www.worldwidemart.com/scripts/cgi-bin/download.cgi?s=formmail&c=txt&f=FormMail.pl>
and this snippet here looks like a good candidate for a culprit:
if ($Form{$name} && $value) {
$Form{$name} = "$Form{$name}, $value";
}
elsif ($value) {
push(@Field_Order,$name);
$Form{$name} = $value;
}
I don't know what you made of this. As you might have guessed by now,
$value = "0" is false. Therefore, neither of the above will catch it.
You'd better get some more reliable examples, or simply use a proper
library file to do the form parsing, such as one of CGI, CGI::Minimal,
CGI::Request, CGI::Lite; if you want to steer clear of pitfalls like
these, that is. See <http://search.cpan.org/>. There could be more. Even
the old workhorse, cgi-lib.pl, would be a better choice.
--
Bart.
------------------------------
Date: Thu, 28 Dec 2000 01:15:35 GMT
From: georgebailey@my-deja.com
Subject: Re: Text Conversion in Perl
Message-Id: <92e47m$99p$1@nnrp1.deja.com>
> At 9:03 am +0000 26/12/00, Mario Thomas wrote:
>
> I'm receiving a text file from another department in my company which
> contains an article ...Quark on the Mac...
I'm sorry to say this, but why on earth are you trying to fix this
problem with Perl? Of course it's possible, but it's probably the most
roundabout solution you could possibly use.
These aren't "weird characters put into the file by Quark", they're
perfectly logical characters for a Mac/Print version of the file. To
have left them *out* would have marked the DTP person as an amateur...
Get in contact with the person who sent you the file and ask them for a
plain text version without the smart quotes and em-dashes etc. I bet
you they've come across this problem before!
They can do that from Quark, but if they can't, they can run it through
their version of Word or just about *anything* and have those
characters replaced with non-Mac-specific characters. Hell, send it to
*me* and I'll open the file, make one mouseclick, save the file and
send it back.
It just seems counterproductive to me to have a fantastically
complicated program like Quark produce a very specific file, then to
attack the arcane specificities of that file with Perl. You're using a
sledgehammer to crack a nut, and moreover it's a nut sent to you by
someone who owns a $1000 nutcracker...
Sent via Deja.com
http://www.deja.com/
------------------------------
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 5209
**************************************