[8930] in Perl-Users-Digest
Perl-Users Digest, Issue: 2548 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 10 00:17:51 1998
Date: Sat, 9 May 98 21:00:37 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 9 May 1998 Volume: 8 Number: 2548
Today's topics:
Re: "Dynamic" forms--Perl question <angst@scrye.com>
5.004_04 tests fail on Irix 6.2 <ldl@chpc.utah.edu>
Re: books for learning perl (Shaun Sides)
Can I select(STDOUT)? and read the text into a @variabl <maldonadod@ct-arng.ngb.army.mil>
Re: CPAN intended audience? (was Re: CPAN & Module grip (Earl Hood)
Database Questions - DB_File, miltiple fields, etc. (M. Hahnfeld)
Re: Does Perl have a IDE?I don't like command line. (Shaun Sides)
Re: Does Perl have a IDE?I don't like command line. (Danny Aldham)
Re: Does Perl have a IDE?I don't like command line. <tchrist@mox.perl.com>
Re: Dylan Song Title Generator (was Re: Rainy Day Women (David Faciane)
Re: MODULE MANIA STRIKES (Was Re: What does this do?) <sowmaster@juicepigs.com>
Re: mSQL <---> MSAccess (Darrell Golliher)
perl mailer submit to cgi <milos@vellocet.insync.net>
Re: perl mailer submit to cgi <milos@vellocet.insync.net>
Re: perl script for zone files (Earl Hood)
Re: perl script to trans smtp mail text to html <milos@vellocet.insync.net>
Re: QRe: == vs. eq (John Moreno)
Stumped on opening file to print. <info@purco.qc.ca>
Re: Stumped on opening file to print. (brian d foy)
Re: Symbolic References <rjk@coos.dartmouth.edu>
Re: Total Object Uselesness <jdf@pobox.com>
Re: Total Object Uselesness <bholzman@mail.earthlink.net>
Re: Total Object Uselesness <rjk@coos.dartmouth.edu>
Re: Total Object Uselesness <danboo@negia.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 9 May 1998 19:50:07 GMT
From: angst <angst@scrye.com>
Subject: Re: "Dynamic" forms--Perl question
Message-Id: <6j2c1f$2bb$1@jelerak.scrye.com>
Fred R. Cronkhite <fred.r.cronkhite@erols.com> wrote:
: I'm new, but not a novice with writing perl scripts. I have "on the
: fly" perl for creating forms. However, I cannot find any reference on
: how I can populate an the on the fly form with data obtained from, say,
: a registration data file. For example, I want to provide the client
: with the name and address values already in the form when the form is
: opened by the browser, so that the client can simply fill any blank
: fields in the form.
: Can perl do this? Any references or example scripts?
This depends on a lot of things. If you're asking if perl can read
from a data file, absolutely. The question is, how do you figure out
which information to print? If it's on a customer-by-customer
basis, you'd need to have some place for the user to specify information
about himself that would allow you to look up the proper information
to fill the form with in your data file. So, you could have the customer
enter his name, hit submit, and then generate a form with the default
information you have for the customer, picked out of the data file
(a database format like Berkeley DB, or SQL or some such would probably
be better for this...there are modules for both in CPAN).
For instance, here's a script for setting up an autoresponder I wrote...
this particular script takes an email address and figures out everything
from there (it also needs other fields for authentication). This
script is just screaming for a re-write (it's on my list of things to do),
but should give you a general idea. I'm including here just the
relevant parts. Again, this script is old and not very elegant at all,
but it should help you a bit with how to generate default values in
form fields. This is also probably a little more heavily commented
than really necessary, but oh well. The beauty of dynamic HTML in perl
is that you can fill it out with pretty much anything that you can
read into a variable. This includes straight text from a file (like what's
done here), entries in a database, or whatnot.
require "./cgi-lib.pl";
require 5.001;
# ReadParse splits cgi input into the hash %input. see cgi-lib for details.
&ReadParse(\%input);
# Print content header. Browsers break without this.
print "Content-type: text/html\n\n";
# If the email address didn't get past, we're done.
unless(defined $input{'email'}){
print "You must define an email address to edit.\n";
exit 0;
}
# Assign the email address to a variable name that's easier to type
$email = $input{'email'};
$email = lc($email);
# Authentication stuff snipped
# split the email address, and generate home directory location from it.
($user,$domain)=split /@/, $email, 2;
$d=substr($user,0,1);
$userdir="/var/mail/domains/$domain/$d/$user";
# Start automagically generating a form
print "<form method = \"post\" action = \"/cgi-bin/aset.pl\">";
# If the user's directory doesn't exist, we're done.
unless(-d $userdir){ print "Maildir not found.\n"; exit 0; }
# Print form fields for enable. Determine default by what they already have.
if(-f "$userdir/auto"){
print "<input type=radio name=\"enable\" value=\"yes\" checked> Yes ";
print "<input type=radio name=\"enable\" value=\"no\"> No ";
}else{
print "<input type=radio name=\"enable\" value=\"yes\"> Yes ";
print "<input type=radio name=\"enable\" value=\"no\" checked> No ";
}
# If autoresponder text already exists, generate default field values from it
if(-s "$userdir/auto.txt"){
open TMP, "$userdir/auto.txt";
$count=0;
# Go through the autoresponder text file line by line:
while($line=<TMP>){
# increment count for each line
$count++;
# by design, the first few lines are mail headers, so we pull those out first
if($count<4){
# If the line we're at is the from line:
if($line =~ /From:/){
# Separate the From: from the rest of the line
($junk,$junk2) = split ": ", $line, 2;
# Separate the Name and Email address (Name is first in the file by design)
($from,$junk3) = split "<", $junk2, 2;
# We're done, go to next line
next;
}
# If the line we're at is the subject line:
if($line =~ /Subject:/){
# Separate subject header from subject text
($junk,$subject) = split ": ",$line, 2;
# We're done, go to next line
next;
}
}
# If we get this far, we're past the headers, so add the line to the default msg
$auto .= $line;
}
# We're done with the autoresponder text file
close TMP;
}else{
# If the autoresponder text didn't already exist, generate a cheesy default
$auto = "This user is on vacation and may not receive your mail for a while.\n
";
}
# Generate some defaults for from and subject if they weren't already set
unless(defined $subject){ $subject="I am on Vacation"; }
unless(defined $from){ $from="$user"; }
# Write out form fields for real name, subject, and text
print "<BR><HR><BR>Your Real Name: ";
print "<input type=text name=\"rname\" size=50 value=\"$from\">\n";
print "<br>Subject of autoresponder message: ";
print "<input type=text name=\"subject\" size=50 value=\"$subject\">\n";
print "<br><hr><br>\n";
print "<font size=2 face=\"Verdana,Arial,Helvetica\"> Enter the message to be se
nt:</font>\n";
print <<EOF;
<P><textarea name="autotxt" cols=70 rows=15 wrap=soft>
$auto
</textarea>
EOF
print "<BR><HR>\n";
# Generate submit and reset buttons, and close everything out.
print "<P><input type=submit value=\"Set Autoresponder\"><input type=reset value
=\"Reset Form\">\n";
print "</form>";
--
Erik Nielsen <eln@rmci.net>
solaris/perl/qmail/dns weenie
this post != views of anyone at all, really
"You are like...unix GOD" -- local tech support
------------------------------
Date: Sat, 09 May 1998 17:04:45 -0600
From: Lou Langholtz <ldl@chpc.utah.edu>
Subject: 5.004_04 tests fail on Irix 6.2
Message-Id: <3554E0AA.12BDF601@chpc.utah.edu>
I tried building perl 5.004_04 with SGI's cc as well as gnu's gcc.
Running make tests of perl 5.004_04 under Irix 6.2 fails for lib/posix
and op/groups with either. To get more specifics I cd'd to ./t and ran
perl harness. I get the following errors:
op/groups...........FAILED test 2
Failed 1/2 tests, 50.00% okay
lib/posix...........Confused test output: test 9 answered after test 10
ok
I'm assuming the later I can ignore then, but how serious is the former?
Has anyone else ran into this? What was the fix? Could a second or two
of clock skew from the NFS server cause this?
Please email me your responses if you would be so kind as I dont often
read this group. Thanks so much!
------------------------------
Date: 9 May 1998 19:56:17 GMT
From: arch@abts.net (Shaun Sides)
Subject: Re: books for learning perl
Message-Id: <slrn6l8qsb.96u.arch@abts.net>
Original message by: Gerhard Poul <gerhard@shadow.ccc.at>
Date: Sat, 9 May 1998 09:15:06 +0200
Subject: Re: books for learning perl
> A very good book is "Learning Perl" from ORA... all books from them are
> good of course ;-)
>
> Just go on http://www.ora.com and use your mouse to go to the perl pages,
> there you can find a big list of perl books... But "Learning Perl" is the
> best for the beginner I think...
I just got it this week, and I highly recommend it. No waste of pages
in that book. You open, you read some witty comments by Larry, then you
start working with Perl. I'm enjoying it. ;-)
--
Shaun L. Sides arch@abts.net
Business web site http://www.abts.net/~arch
Showershoe web site http://www.abts.net/~arch/showershoe
Recreational web site http://sara.mmlc.nwu.edu/~arch
------------------------------
Date: Sat, 9 May 1998 23:27:50 -0400
From: "DannyM" <maldonadod@ct-arng.ngb.army.mil>
Subject: Can I select(STDOUT)? and read the text into a @variable?
Message-Id: <6j36mk$qae@news-central.tiac.net>
I know select is only used for the write and print functions but I need to
trap STDOUT in one of my scripts. I wanted to use DBI and DBD-Oracle
to query my Oracle database but I have a multitude of patches to load before
this will work and I can not wait till then. I have had to write the output
to a
file and then read the spooled text from the file. This is not efficient at
all
and I would rather have all the streamed output from STDOUT go into a
variable
then work with it from there. Thanks in advance for any solutions.
------------------------------
Date: 9 May 1998 21:38:17 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: CPAN intended audience? (was Re: CPAN & Module gripes)
Message-Id: <6j2ic9$7c0@news.service.uci.edu>
In article <3553f9f4.0@news.one.net>, Mike Heins <mikeh@minivend.com> wrote:
>I would be willing to take on the additions to the PAUSE -- I see
>it as a simple script to present a series of existing directories in
>the application area, along with an input to create a new one, and the
>corresponding symlinking to the authors/ID directory. It could stand
>alone, I think, and be just another option area on the PAUSE menu.
I think this would be great. Are there any objections from
other PAUSE maintainers.
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: Sun, 10 May 1998 01:18:08 GMT
From: hahnfeldjl@surfree.com (M. Hahnfeld)
Subject: Database Questions - DB_File, miltiple fields, etc.
Message-Id: <3554f9cf.2575506@news.surfree.com>
I have released a freeware auction script that basically runs on two
sets of data files--user data files and auction item data files.
Currently, new items are placed in uniquely named data files and user
registrations are placed in uniquely named data files in another
directory.
User data files have a username (this serves datafile filename or
database key), password, and 3 address lines. Item data files have an
item number (this serves datafile filename or database key), reserve
price, bid increment, description, and bids.
The data file construction seems to work great when I need to look up
something about a specific user or item or add or delete and item, but
searching and listing is SLOW because each item must be opened,
queried, and closed.
I am considering restructuring to database format. The problem I am
encountering is the lack of dynamic-sized fields and multiple fields.
I want to use DB_File because according to "Programming Perl" it is
the fastest standard supported system and it has lots of great
features. I looked up the info on it and installed everything fine,
but I have found that hashing really only associates one key with one
value. I have found a way around that is to use the perl "pack"
command to place a whole list of things (ie. username, password,
address) into one nice variable and store it that way. I am doing
something like this:
tie(%regfile, 'DB_File', "$basepath$regdb");
$regfile{$username} =
pack('A32A32A32A32A32',$password,$email,$add1,$add2,$add3);
MY QUESTIONS:
1. Is there any way I can make field size dynamic somehow with "pack"?
By making each field have max. length 32, I am limiting myself.
Especially for fields like "item description", where fields may be
very long with lots of HTML or very short simple information. By
allocating 1000 characters to that, won't I automatically take up 1000
characters worth of memory/disk space, even if most are null?
2. In the case of the item database, some items may have 1000 bids,
and some may only have one. In a datafile it is easy to just have it
spit out a list of bids (any line at the end of the file after all the
other fields is assumed to be a bid) but how would I go about doing
this using perl database commands? Some items may have more bids than
others... Each bid must hold information about the bidder and bid
price.
3. Is using the pack command the best way to give the database
multiple fields (a list of fields)? (is their a built-in way???)
What would be ideal is to be able to store multiple fields with each
key without using pack.
4. Are the administration times associated with using a database
greater than using plain ASCII text files? Will using a database
give me a speed increase?
Thank you everyone for your replies. They are greatly appreciated...
-----------------
Matt Hahnfeld
EverySoft
http://www.everysoft.com/
aj304@detroit.freenet.org
------------------------------
Date: 9 May 1998 19:57:44 GMT
From: arch@abts.net (Shaun Sides)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <slrn6l8qv1.96u.arch@abts.net>
Original message by: scott@softbase.com <scott@softbase.com>
Date: 9 May 1998 14:39:18 GMT
Subject: Re: Does Perl have a IDE?I don't like command line.
> > Does perl have a IDE(like Turbo C2.0)?
>
> Perl's IDE is Emacs! The two great tools that go great together.
Mine's vim 5. ;-) No worries.
--
Shaun L. Sides arch@abts.net
Business web site http://www.abts.net/~arch
Showershoe web site http://www.abts.net/~arch/showershoe
Recreational web site http://sara.mmlc.nwu.edu/~arch
------------------------------
Date: 10 May 1998 02:13:35 GMT
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6j32gf$722$1@lennon.postino.com>
X-Newsreader: TIN [version 1.2 PL2]
yujun (Xyujun@ppp.wzptt.zj.cn) wrote:
: Does perl have a IDE(like Turbo C2.0)?
: Xyujun@ppp.wzptt.zj.cn
If you are developing on NT or a MS product, check out Perl Builder
at www.solutionsoft.com .
--
Danny Aldham SCO Ace, MCSE, JAPH, DAD
Field Service Manager BCTel Systems Support
7000 Lougheed Hwy, Burnaby BC (604) 444-8949
------------------------------
Date: 10 May 1998 03:51:56 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6j388s$let$1@csnews.cs.colorado.edu>
Yes, Perl has an IDE: it's called Unix.
--tom
--
MSDOS is a Neanderthal operating system -- Henry Spencer
------------------------------
Date: 9 May 1998 23:56:35 GMT
From: dave@nws.fsu.edu (David Faciane)
Subject: Re: Dylan Song Title Generator (was Re: Rainy Day Women #12 & 35 question)
Message-Id: <6j2qfj$76n$1@news.fsu.edu>
In article <35527B85.544@erols.com>, <bobgill@erols.com> wrote:
>dave@nws.fsu.edu (David Faciane) writes:
>>
>> <In article <howells.894376052@shell4.ba.best.com>,
>> <John Howells <howells@best.com> wrote:
>> <>My opinion: the title means absolutely nothing. It's just some
>> <>nonsense he thought up on the spur of the moment, like "Alcatraz
>> <>to the 9th Power". That's just the way his mind works.
>>
>> <Indeed. Here's a quick little hack. Ever notice, during the mid-60s,
>> <how Bob was fond of prefacing a rather mundane song title with an
>> <adjective to kind of spice it up, as in
>>
>> <Positively Fourth Street
>> <Obviously Five Believers
>> <Absolutely Sweet Marie
>>
>
> This is a good observation, and I like this sort of thing, and I really
>don't mean to sound pedantic, but these words that are being added are
>all adverbs, not adjectives.
Yes, but you don't need a weatherman to know which way the wind blows :)
And the program had bugs too... just goes to show that reading, but
not posting to Usenet can be enhanced by a few pints of Guinness! :)
--
David Faciane |web: http://www.nws.fsu.edu/
NOAA National Weather Service |Real-Time Worldwide Marine Weather Reports
Tallahassee, FL | http://www.nws.fsu.edu/buoy
------------------------------
Date: Sat, 09 May 1998 15:24:05 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
Subject: Re: MODULE MANIA STRIKES (Was Re: What does this do?)
Message-Id: <3554AD55.2849@juicepigs.com>
Art Cohen wrote:
>
> Bob Trieger <sowmaster@juicepigs.com> wrote:
> :>
>
> : I think you miss the point here. the original poster was obvious
> : ignorant as to how to read the documentation for the read function or
> : just too lazy. By using CGI.pm he will only have to read one document
> : instead of the documentation for all the other functions used after the
> : read.
>
> So you're saying that the solution for newbies who don't even know where
> to find documentation on Perl's built-in functions is to have them use
> more *modules*? That's going to make it easier for him to learn Perl?
> Forgive me if I remain a little skeptical.
Using modules is the easiest way to accomplish anything in perl. As the
newbies learn what the modules do and how to use them, they can then
start looking at how they work.
You admittedly use cgi-lib.pl. Why aren't you typing out the commends
everytime you write a new script? Because somebody has already done the
work for uyou, that's why. And that is just what all the modules do, the
work for you.
--
Bob Trieger | Titanic: big boat, bigger
sowmaster@juicepigs.com | iceberg, big deal
------------------------------
Date: 10 May 1998 00:06:15 GMT
From: golliher@bob.coe.uga.edu (Darrell Golliher)
Subject: Re: mSQL <---> MSAccess
Message-Id: <6j2r1n$qmr$1@cronkite.cc.uga.edu>
Pat Trainor (ptrainor@bbn.com) wrote:
: I use msqlperl, and would appreciate pointers to resources that
: allow the exchange of information between mSQL and MSAccess? Posting to
: the MS groups was not productive.. (surprise)..
I use mysql not msql so your millage may vary, but you will probably
need a Windows ODBC driver for msql. This driver runs on the
Wintel box and acts as the glue between MSAccess and your database.
As a starting point have a look at the www.mysql.com page. Even
if you need to stick with msql you might find something useful under
the links section.
Hope this helps,
--
-Darrell Golliher
http://www.coe.uga.edu/~golliher
------------------------------
Date: Sun, 10 May 1998 03:23:59 GMT
From: Miles Lott <milos@vellocet.insync.net>
Subject: perl mailer submit to cgi
Message-Id: <j5951.5$FR1.155444@synthemesc>
I would like to create a script to take the contents of an email message
(script would be a mailer invoked from sendmail or .forward file)
and submit the proper fields to an existing remote cgi. I think I can
handle everything up to the print action (?) of the perl script. I
suppose there is a module to handle the form submission?
------------------------------
Date: Sun, 10 May 1998 03:49:23 GMT
From: Miles Lott <milos@vellocet.insync.net>
Subject: Re: perl mailer submit to cgi
Message-Id: <7t951.6$FR1.166521@synthemesc>
I suppose that Web Client Programming with Perl by O'Reilly would be a
valuable resource for this?
Miles Lott <milos@vellocet.insync.net> wrote:
> I would like to create a script to take the contents of an email message
> (script would be a mailer invoked from sendmail or .forward file)
> and submit the proper fields to an existing remote cgi. I think I can
> handle everything up to the print action (?) of the perl script. I
> suppose there is a module to handle the form submission?
------------------------------
Date: 9 May 1998 22:04:02 GMT
From: ehood@medusa.acs.uci.edu (Earl Hood)
Subject: Re: perl script for zone files
Message-Id: <6j2jsi$86v@news.service.uci.edu>
[mail & posted]
In article <35510477.A675F49C@interport.net>,
Tommy Ho <tch@interport.net> wrote:
>I'd like to run a script to modify lines in multiple DNS zone files. So
>if I need to change an "A" record or "NS" records on 50 different zone
>files all at once, I would need a perl script to do that.
>
>Does anyone have any experience with this?
Yes. Learn Perl and decide how sophisticated you want your zone file
parser. Check the RFCs on the syntax of zone files (or the DNS/BIND
book from O'Reilly). To get something done quick, try to see if you
can make assumptions on the format of the files to avoid writing a
complete zone file parser.
--ewh
--
Earl Hood | University of California: Irvine
ehood@medusa.acs.uci.edu | Electronic Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME
------------------------------
Date: Sun, 10 May 1998 03:19:47 GMT
From: Miles Lott <milos@vellocet.insync.net>
Subject: Re: perl script to trans smtp mail text to html
Message-Id: <n1951.4$FR1.155444@synthemesc>
Earl Hood <ehood@medusa.acs.uci.edu> wrote:
> [mail & posted]
> In article <6il2mv$h7h$1@nnrp1.dejanews.com>, <ageorge@best.com> wrote:
>>Does anyone know where I can find a script that will translate smtp mail text
>>to html?
I am not sure what you are asking exactly, but let me pose another
semi-related question(?):
I would like to make use of my pager company's web-based paging service
via a perl script. Furthermore, I want to parse the contents of an email
into a form post via that company's cgi script. I can handle the email
forwarding to a perl script, but how do I get perl to post or submit the
right information to the remote cgi? Pointers to FAQ or other resources
are certainly welcome.
------------------------------
Date: Sat, 09 May 1998 23:13:57 GMT
From: phenix@interpath.com (John Moreno)
Subject: Re: QRe: == vs. eq
Message-Id: <1d8s00w.1riuzgut0qysN@roxboro0-034.dyn.interpath.net>
John Moreno <phenix@interpath.com> wrote:
> Aaron Baugher <abaugher@rnet.com> wrote:
>
> > "Allan M. Due" <due@discovernet.net> writes:
> >
> > > Any suggestions for "real newsreaders" for those of us doomed to
> > > operate in a Windoze environment.? Or, are we only real if we
> > > have access to UNIX?
> >
> > Yes. :-) Seriously, though, take a look at the Good Net-Keeping Seal
> > of Approval <http://http.bsd.uchicago.edu/~twpierce/news/index.html>.
-snip-
> That's the old version, it has been superseded.
>
> Try: <http://www.xs4all/~js/gnksa/>.
Actually you should try <http://www.xs4all.net/~js/gnksa/>. Sorry about
that.
--
John Moreno
------------------------------
Date: Sun, 10 May 1998 02:00:11 GMT
From: Leon Stepanian <info@purco.qc.ca>
Subject: Stumped on opening file to print.
Message-Id: <35550B03.3D01D834@purco.qc.ca>
Hello;
I am currently writting a Perl script for an elaborate interactive
trading system which comprises many html forms, results etc. In order to
cut down on script size, I'd like to able to read in separate files of
html code and then print to users screen according to chosen requests
and security levels.
I have tried opening files which were in simple html format such as;
<html> or in perl format such as print"<html>\n"; but in both ways, I am
getting the code printed on the screen and not the actual html page.
Files were opened and stored in $array or @array format then printed
with print<$file> or sequenced through a for($a=0;a<@file;$a++) to
print"$file[$a]"; but again, I am only getting the actual code printed
on the screen. Also tried print<@array> but again not good.
So, here's the question. How can I use Perl to read in the html code of
a file and have the html page appear through a Perl script, instead of
having the print"<html>\n"; type code in my Perl sub-routines. These
pages work great when in my perl sub-routines, but I'd like to put them
in separate files. Otherwise, I will wind up with 5 megs of perl code
and it's a pain downloading each time to my sever to try it out. And I
don't want to have to split the main code into many parts.
Any help would be most welcomed.
Leon Stepanian
Perl............from an ocean of human kinds.
------------------------------
Date: Sat, 09 May 1998 23:19:38 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Stumped on opening file to print.
Message-Id: <comdog-ya02408000R0905982319380001@news.panix.com>
Keywords: from just another new york perl hacker
In article <35550B03.3D01D834@purco.qc.ca>, Leon Stepanian <info@purco.qc.ca> posted:
>I have tried opening files which were in simple html format such as;
><html> or in perl format such as print"<html>\n"; but in both ways, I am
>getting the code printed on the screen and not the actual html page.
>
>Files were opened and stored in $array or @array format then printed
>with print<$file> or sequenced through a for($a=0;a<@file;$a++) to
>print"$file[$a]"; but again, I am only getting the actual code printed
>on the screen. Also tried print<@array> but again not good.
the relevant snippet would be nice - we could point out the parts that
aren't working. :)
i do this sort of thing a lot, and all i use is something like:
if( open FILE, $top_html )
{
local $/ = undef;
my $data = <FILE>;
#do some extra processing if you like
print _parse_wrapper_file($data);
}
else
{
print <<"HERE";
<html>
<head>
<title>Some title</title>
</head>
<body>
HERE
}
you might also check to ensure that you are sending a text/html
content-type rather than text/plain. HTTPeek [1] of CG-Eye [2] could
help you figure that out if you are having trouble.
good luck :)
[1] HTTPeek <URL:http://computerdog.com/httpeek/>
[2] CG-Eye <URL:http://www.htmlhelp.com/tools/cg-eye/>
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers <URL:http://www.pm.org>
------------------------------
Date: Sat, 09 May 1998 16:38:09 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Symbolic References
Message-Id: <3554BEB2.6AFA23B6@coos.dartmouth.edu>
Aaron Kushner wrote:
>
> So what is the best/approved way of setting a variable in a perl program
> and accessing it in all of the modules. For example, if I set DEBUG=1 in
> the main program, how should the modules access DEBUG?
Like this:
$DEBUG=1;
instead of this:
my $DEBUG=1;
And the modules can access it as:
$main::DEBUG
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 09 May 1998 16:35:29 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: pudge@pobox.com (Chris Nandor)
Subject: Re: Total Object Uselesness
Message-Id: <k97vgmam.fsf@mailhost.panix.com>
pudge@pobox.com (Chris Nandor) writes:
> $y = bless \substr($x, 3), "D'oh";
> sub D'oh'oh {${$_[0]} = $_[1]}
>
> $y->oh('baz');
Well, you got me on this one. Will you kindly explain the way $y->oh
becomes D'oh'oh? I've been scanning perlobj, perlbot, etc., and can't
figure it out.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: Sat, 09 May 1998 16:34:14 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Total Object Uselesness
Message-Id: <3554BDC6.6A40D587@mail.earthlink.net>
Not so hard. Simply recall that the perl4 way of specifying packages
was with the "'" character. The real issue here is using a
ref-to-lvalue as the implementation of the object. IIRC, this is not
supported, and may break in the future.
Jonathan Feinberg wrote:
>
> pudge@pobox.com (Chris Nandor) writes:
>
> > $y = bless \substr($x, 3), "D'oh";
> > sub D'oh'oh {${$_[0]} = $_[1]}
> >
> > $y->oh('baz');
>
> Well, you got me on this one. Will you kindly explain the way $y->oh
> becomes D'oh'oh? I've been scanning perlobj, perlbot, etc., and can't
> figure it out.
>
> --
> Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
> http://pobox.com/~jdf/
------------------------------
Date: Sat, 09 May 1998 17:12:13 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Total Object Uselesness
Message-Id: <3554C6B0.29607052@coos.dartmouth.edu>
Jonathan Feinberg wrote:
>
> pudge@pobox.com (Chris Nandor) writes:
>
> > $y = bless \substr($x, 3), "D'oh";
> > sub D'oh'oh {${$_[0]} = $_[1]}
> >
> > $y->oh('baz');
>
> Well, you got me on this one. Will you kindly explain the way $y->oh
> becomes D'oh'oh? I've been scanning perlobj, perlbot, etc., and can't
> figure it out.
>From perlobj:
Method Invocation
There are two ways to invoke a method, one of which you're already
familiar with, and the other of which will look familiar.
[...]
For C++ fans, there's also a syntax using -> notation that does exactly
the same thing. The parentheses are required if there are any
arguments.
$fred = Critter->find("Fred");
$fred->display('Height', 'Weight');
The Camel book, 2ed, page 291, describes this syntax as:
CLASS_OR_INSTANCE->METHOD(LIST)
If you're confused by the apostrophe/single-quote, that was the original
package delimiter. It is equivalent to ::, so D'oh'oh is the same as
D::oh::oh but looks cooler.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sat, 09 May 1998 17:04:19 -0400
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Total Object Uselesness
Message-Id: <3554C4D3.DBBEDB4@negia.net>
Jonathan Feinberg wrote:
>
> pudge@pobox.com (Chris Nandor) writes:
>
> > $y = bless \substr($x, 3), "D'oh";
> > sub D'oh'oh {${$_[0]} = $_[1]}
> >
> > $y->oh('baz');
>
> Well, you got me on this one. Will you kindly explain the way $y->oh
> becomes D'oh'oh? I've been scanning perlobj, perlbot, etc., and can't
> figure it out.
hint: single quote (') is the old package separator before
double colon (::)
--
Dan Boorstein home: danboo@negia.net work: danboo@y-dna.com
"THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER."
- Cosmic AC
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 2548
**************************************