[13800] in Perl-Users-Digest
Perl-Users Digest, Issue: 1210 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 28 09:05:24 1999
Date: Thu, 28 Oct 1999 06:05:11 -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: <941115910-v9-i1210@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 28 Oct 1999 Volume: 9 Number: 1210
Today's topics:
"1" end ? <link@nowhere.org>
Re: "1" end ? <Joachim.Pimiskern@de.bosch.com>
Re: "1" end ? <slanning@bu.edu>
$formdata=~s/\s+$//; ? <hmaster@factory.co.kr>
Re: $formdata=~s/\s+$//; ? <slanning@bu.edu>
Re: $formdata=~s/\s+$//; ? <Joachim.Pimiskern@de.bosch.com>
Re: adding data to beginning of file <amwalker@gate.net>
Re: adding data to beginning of file <umungo01@shafika.vetri.com>
Re: adding data to beginning of file <jeffp@crusoe.net>
Re: Circular buffering (Neil Cherry)
Re: How to avoid FILEHANDLE reusage.. <gellyfish@gellyfish.com>
Re: Is Perl a good language for making text-based games (Greg McCarroll)
Re: is there a Perl module for checksum (or CRS)? <sb@sdm.de>
Re: is there a Perl module for checksum (or CRS)? <gellyfish@gellyfish.com>
Re: mod perl anomalies (brian d foy)
NET::FTP / Firewall ? <ccarr@websocket.com>
Pack function in Active Perl (win32) buggy? <lars.soderstrom@capgemini.fi>
Perl Cookie questions and stuff <chuckwilliams1@netscape.net>
perl lang parser (Salem Lee Ganzhorn)
Regular Expression <b39ast@ku.ac.th>
Re: Regular Expression <jeffp@crusoe.net>
Require statement <zvonko.bostjancic@siol.net>
Strange Bus error problem <jamesp@sunf48.rd.bbc.co.uk>
Re: What makes the web go? (brian d foy)
Write File Question? <el2100@netvigator.com>
Re: Write File Question? (Greg McCarroll)
Re: Write File Question? <Joachim.Pimiskern@de.bosch.com>
Re: Write File Question? <slanning@bu.edu>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 28 Oct 1999 10:33:42 GMT
From: "ling" <link@nowhere.org>
Subject: "1" end ?
Message-Id: <aEVR3.28817$up3.44895@news21.bellglobal.com>
Why most html page created using perl have an "1" character appear at the
end of page ?
How to make it disappear ?
Kieu
------------------------------
Date: Thu, 28 Oct 1999 13:18:02 +0200
From: "Joachim Pimiskern" <Joachim.Pimiskern@de.bosch.com>
Subject: Re: "1" end ?
Message-Id: <7v9bda$np5$1@proxy2.fe.internet.bosch.de>
Kieu,
if you use a module, Perl expects a non-undef value as the
last expression. The value 1 as the last expression in a module
has become convention.
When creating html pages via Perl, some people like the
facility of here documents:
$x =<<'EOF';
<html>
...
</html>
EOF
Maybe in your case the end symbol is not recognized.
Joachim
Joachim.Pimiskern@de.bosch.com
------------------------------
Date: 28 Oct 1999 07:32:31 -0400
From: Scott Lanning <slanning@bu.edu>
Subject: Re: "1" end ?
Message-Id: <kusk8o7oh4g.fsf@strange.bu.edu>
"ling" <link@nowhere.org> writes:
> Why most html page created using perl have an "1" character
> appear at the end of page ?
I've never observed this, let alone "most html page"s....
> How to make it disappear ?
Turn off your monitor.
--
"Every word is like an unnecessary stain on silence and nothingness."
--Samuel Beckett
------------------------------
Date: Thu, 28 Oct 1999 17:52:00 +0900
From: "Yeong Mo/Director Hana co." <hmaster@factory.co.kr>
Subject: $formdata=~s/\s+$//; ?
Message-Id: <XvqWVvSI$GA.163@news.thrunet.com>
Hi,
What is "/\s+$//;" ?
$formdata=~s/\s+$//;
Someone please explain this ?
------------------------------
Date: 28 Oct 1999 07:28:56 -0400
From: Scott Lanning <slanning@bu.edu>
Subject: Re: $formdata=~s/\s+$//; ?
Message-Id: <kusn1t3ohaf.fsf@strange.bu.edu>
"Yeong Mo/Director Hana co." <hmaster@factory.co.kr> writes:
> What is "/\s+$//;" ?
>
> $formdata=~s/\s+$//;
>
> Someone please explain this ?
No.
--
"Sarcasm: the last refuge of modest and chaste-souled people when the
privacy of their soul is coarsely and intrusively invaded."
--Dostoyevsky
------------------------------
Date: Thu, 28 Oct 1999 14:17:39 +0200
From: "Joachim Pimiskern" <Joachim.Pimiskern@de.bosch.com>
Subject: Re: $formdata=~s/\s+$//; ?
Message-Id: <7v9et3$ql0$1@proxy2.fe.internet.bosch.de>
Hello Yeong,
>>What is "/\s+$//;" ?<<
It means "Trailing spaces". $formdata =~ s/\s+$//; means "delete trailing
spaces".
\s means any space, \s+ means space at least once, and $ means
end of the string.
Regards,
Joachim
(Joachim.Pimiskern@de.bosch.com)
------------------------------
Date: Thu, 28 Oct 1999 06:32:41 -0400
From: Aaron Walker <amwalker@gate.net>
Subject: Re: adding data to beginning of file
Message-Id: <38182649.46A8B65C@gate.net>
First of all, I have not read the Perl FAQ. I thought we were just supposed to
read the comp.lang.perl.misc FAQ. Anyways, so I headed over to section 5 of
the Perl FAQ and checked out the appropriate section. The way I am currently
accomplishing this is follows: (no error checking for simplicity)
--
#!/usr/bin/perl -w
$datafile = "/www/cgi-bin/file.dat";
open(FILE, "$datafile");
@data = <FILE>;
close(FILE);
open(FILE, ">$datafile");
print FILE "Entry 1";
print FILE @data;
close(FILE);
-
Is this the wrong way to go about accomplishing this task? It seems much
easier (or at least, easier to read).
Thanks again,
Aaron
Tad McClellan wrote:
> Aaron Walker (amwalker@gate.net) wrote:
>
> : I am attempting to write a perl script that writes data to the beginning
> : of a file.
>
> Perl FAQ, part 5:
>
> "How do I change one line in a file/
> delete a line in a file/
> insert a line in the middle of a file/
> append to the beginning of a file?"
>
> You are expected to check the Perl FAQ *before* posting
> to the Perl newsgroup you know.
>
> --
> Tad McClellan SGML Consulting
> tadmc@metronet.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Thu, 28 Oct 1999 12:30:05 GMT
From: Govindaraj <umungo01@shafika.vetri.com>
Subject: Re: adding data to beginning of file
Message-Id: <s1ggedbmr0842@corp.supernews.com>
Hi Aaron,
Get the Piece of Code....!!!!
#!/home1/ips/gnu/perl-5.004/perl -w
open(INFILE, "<$ARGV[0]") || die "Cannot Open the Input File $!\n";
open(OUTFILE, ">$ARGV[1]") || die "Cannot Open the Input File $!\n";
if ( (!$ARGV[0]) || (!$ARGV[1]) )
{
print "Usuage : $0 <InputFile> <OutputFie>\n";
exit;
}
print OUTFILE "First Line you want ot print......!!!!\n";
while ( <INFILE> )
{
print OUTFILE "$_\n";
}
close(INFILE);
I Hope this will clarify your doubts....!!!
Regards,
Govindaraj M.
Aaron Walker wrote:
>
> I am attempting to write a perl script that writes data to the beginning
> of a file. The way I plan on doing this is by reading in the current
> data file into say @data, then writing the current data into the file,
> then writing the data in @data after the current data. Is there a
> fuction that does this or another easier way of doing this in perl?
>
> thanks,
> Aaron
>
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Thu, 28 Oct 1999 08:52:19 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: adding data to beginning of file
Message-Id: <Pine.GSO.4.10.9910280845540.2694-100000@crusoe.crusoe.net>
On Oct 28, Govindaraj blah blah blah:
> open(INFILE, "<$ARGV[0]") || die "Cannot Open the Input File $!\n";
> open(OUTFILE, ">$ARGV[1]") || die "Cannot Open the Input File $!\n";
methinks you copied and pasted.
> if ( (!$ARGV[0]) || (!$ARGV[1]) )
so I can't operate on a file called "0"? I'd suggest:
if (@ARGV != 2)
> {
> print "Usuage : $0 <InputFile> <OutputFie>\n";
> exit;
> }
this is REALLY nitpicky of me right here, so sorry. usage messages should
be written to STDERR; I've been told this many times. So the usual
mechanism is to use die().
die "Usage: $0 infile outfile\n" if @ARGV != 2;
> while ( <INFILE> )
> {
> print OUTFILE "$_\n";
> }
> close(INFILE);
That will do ungood things. Namely, that will put extra newlines after
each line... these lines already end with newlines.
Again, I would simplify this as:
# note: this is not a while loop, this is a naked block
{
local $/;
print OUTFILE <INFILE>:
}
And then you forget to close your filehandles.
--
MIDN 4/C PINYAN, USNR, NROTCURPI
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN/
------------------------------
Date: Thu, 28 Oct 1999 12:43:28 GMT
From: njc@dmc.uucp (Neil Cherry)
Subject: Re: Circular buffering
Message-Id: <slrn81gh51.dv5.njc@dmc.uucp>
On 27 Oct 1999 22:49:38 -0700, Greg Andrews wrote:
>ncherry@home.net writes:
>>On 27 Oct 1999 17:37:35 GMT, M.J.T. Guy wrote:
>>>In article <slrn81bddi.36g.njc@dmc.uucp>, Neil Cherry <ncherry@home.net> wrote:
>>>>I'm interested in using circular buffering in my Perl program. Does
>>>>anyone have code examples of how to accomplish this?
>>>
>>>Use an array, say @buff, to hold the buffer.
>>>
>>>Then push @buff, $item; # add $item to @buff
>>> my $item = shift @buff # take $item from @buff
>>>
>>>Contrary to what you might guess, these are efficient operations even
>>>if the buffer gets large ( O(1) most of the time ), as Perl is careful
>>>to avoid unnecessary shifting or copying of arrays.
>>
>>I see I have caused some confusion but I have gained further knowledge
>>in the process. I was unaware of push/pull shift/unshift etc.
>>
>>What I meant by circular buffers is a fixed size array were a pointer
>>points to the current position in the array to put new characters and
>>a pointer that points to the last read character.
>>
>
>Modify your pointer definitions to be "the position of the last
>character written to the buffer" and "the position of the next
>character to be read from the buffer", then your circular buffer
>is no different than the array described by M.J.T Guy. If you
>think about it, re-defining the pointers in that fashion does
>not stop it from being a circular buffer.
OK, I'm going to have to sit down and reread this a couple of times
just to make sure I understand it. Though it does sound like what I am
attempting to do.
>After all, a "circular" buffer isn't really circular, is it?
Just memory cells, usually one after another (a lifo). Which makes me
think that I need to reread the books to get a better understnading of
the pointers, arrays and the push/pull (etc) commands. My knowledge of
Perl is too weak to write these programs yet.
Thanks.
--
Linux Home Automation Neil Cherry ncherry@home.net
http://members.home.net/ncherry (Text only)
http://meltingpot.fortunecity.com/lightsey/52 (Graphics GB)
------------------------------
Date: 28 Oct 1999 13:24:35 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How to avoid FILEHANDLE reusage..
Message-Id: <38184083_1@newsread3.dircon.co.uk>
F00 Baz <f00baz@my-deja.com> wrote:
> Hello people, here I was writing some kind of code, which is supposed to
> sniff throught directory three using recursion, and create files there.
> However, I got stuck with the problem, that FILEHANDLEs are getting reused,
> so I just get complete junk with it.
I didnt bother reading your code as it wasnt formatted at all.
However you might want to look at the section in perlfaq5 entitled:
=head2 How can I make a filehandle local to a subroutine?
How do I pass filehandles between subroutines?
How do I make an array of filehandles?
/J\
--
"It's times like this I wish I had a penis" - Duckman
------------------------------
Date: Thu, 28 Oct 1999 11:03:45 GMT
From: greg@mccarroll.demon.co.uk (Greg McCarroll)
Subject: Re: Is Perl a good language for making text-based games? If not, what is?
Message-Id: <38182ae7.17129504@newspull.london1.eu.level3.net>
On 28 Oct 1999 04:33:40 -0500, abigail@delanet.com (Abigail) wrote:
>Greg McCarroll (greg@mccarroll.demon.co.uk) wrote on MMCCXLIX September
>MCMXCIII in <URL:news:3817ff93.6036000@newspull.london1.eu.level3.net>:
>..
>.. You have 3 main aspects to any MU* , first is text parsing, second is
>.. data sharing and storage and third is networking. Perl is excellent at
>.. all 3. The biggest challenge involved if you are going to try to write
>.. a driver as good as a MudOS one is how you are going to implement
>.. a secure equivalent of LPC[1] in Perl.
>
>*cough* *cough* *cough*
>
>"A driver as good as MudOS", that sounds even more rediculious than
>"An OS as good as Windows". The fact that MudOS and MSDOS only differ
>by one letter cannot be a coincidence.
>
>If you want an LP driver, nothing comes remotely close to DGD.
>
>
i got out of Muds when DGD was just coming in so i can't possibly
comment, i seem to remember lots of problems trying to get any mudlib
apart from melville working with it, but i'm sure thats changed.
didn't python have some sort of MU* in the early days called POO?
Greg
------------------------------
Date: 28 Oct 1999 10:35:47 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: Re: is there a Perl module for checksum (or CRS)?
Message-Id: <7v98u3$ibj$1@solti3.sdm.de>
In article <3817F94C.8FE3BA65@iname.com>, Anttoni Huhtala <Anttoni@iname.com> wrote:
> Is there a module for CRS?
> just a smiple one would do...cheking date and bytesize...
> (and comparing it to an other file would just be great!)
> But just plain old CRS would do...
use MD5;
RTFaqM
--
Steffen Beyer <sb@engelschall.com>
http://www.engelschall.com/u/sb/whoami/ (Who am I)
http://www.engelschall.com/u/sb/gallery/ (Fotos Brasil, USA, ...)
http://www.engelschall.com/u/sb/download/ (Free Perl and C Software)
------------------------------
Date: 28 Oct 1999 13:39:37 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: is there a Perl module for checksum (or CRS)?
Message-Id: <38184409_1@newsread3.dircon.co.uk>
Anttoni Huhtala <Anttoni@iname.com> wrote:
> Hi.
> Is there a module for CRS?
> just a smiple one would do...cheking date and bytesize...
> (and comparing it to an other file would just be great!)
> But just plain old CRS would do...
>
You could probably do better than that - there is an MD5 module available
from CPAN.
/J\
--
"The internet is like a car boot sale" - Jon Sopel, BBC News
------------------------------
Date: Thu, 28 Oct 1999 06:36:28 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: mod perl anomalies
Message-Id: <brian-ya02408000R2810990636280001@news.panix.com>
In article <FKB178.IFr@csc.liv.ac.uk>, ijg@connect.org.uk (I.J. Garlick) posted:
> In article <GsFWRDAHBgF4EwSI@tnunn.demon.co.uk>,
> Thomas Nunn <tom@tnunn.demon.co.uk> writes:
> > However every so often when I submit the form, the record that is added
> > to the file is actually a repetition of a record added a few submits
> > before.
>
> I think this is because you are accessing an Apache httpd that you have
> accessed before which contains old info, ie. it's not been reset properly.
this is covered in the mod_perl traps documentation that is included
in the mod_perl distribution. make sure you read the included docs
and FAQs as you play with mod_perl. it might take several reads :)
> > I can see no pattern to this repetition, it just seems to randomly
> > remember a string that was used a little while before.
>
> Yep that's the clue that leads me too the above.
it's only random in so far as the particular httpd child process
that handles the request. as an aid to debugging, it's wise to include
the PID in the debugging output so you know which child handled the
request.
also, if you are changing modules around, you will want to enable
StatINC checking, or restart the server. mod_perl should automatically
detect changes in scripts though.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Thu, 28 Oct 1999 06:09:39 -0500
From: Clinton Carr <ccarr@websocket.com>
Subject: NET::FTP / Firewall ?
Message-Id: <38182EF3.BB646BD3@websocket.com>
Can NET::FTP handle the following FTP login procedures through a
firewall?
> ftp firewall.host
user> myfirewallID
password> myfirewallPassword
destination> user ftpServerID@some.ftp.host
For here I can continue using NET::FTP commands
Also, can the above be done using win32::internet?
Thanks for the help,
Clinton
------------------------------
Date: Thu, 28 Oct 1999 12:37:22 GMT
From: "Lars Soderstrom" <lars.soderstrom@capgemini.fi>
Subject: Pack function in Active Perl (win32) buggy?
Message-Id: <6sXR3.233$ZB5.3758@read2.inet.fi>
Hello,
I came across a awkward feature (I think) of the pack-function when
programming a cgi-script in Active Perl. The web server is IIS.
It seems to work Ok in a UNIX-based web server.
It seems that the pack-function converts %0D%0A (CR-LF) in IIS to _two_
linefeeds when it is in UNIX converted to only one linefeed.
Is this a bug? Makes porting UNIX->WIN a bit harder.
Best regards
Lars
------------------------------
Date: Thu, 28 Oct 1999 11:12:23 GMT
From: Chuck Williams <chuckwilliams1@netscape.net>
Subject: Perl Cookie questions and stuff
Message-Id: <7v9b2m$kep$1@nnrp1.deja.com>
I've done a little homework and setup some test pages and now I'm
looking for some deeper understanding of cookies (use Apache/Sun/Perl).
Here's my current questions:
1.Which variables can be recovered from the HTTP_COOKIE envar? All I
can get is the name=value pair.
2.In Set-cookie: ...., if I don't set the expires date, the cookie
doesn't get written to the user's hard drive, right?
3.Does it matter in what order I write the Set-cookie: ... parameters?
4.Should there be NO trailing semi-colon on the Set-cookie line?
5.Is the alpha weekday (Sun Mon Tue...) required in the expires field?
6.Is there a way to make the expires field a variable?
7.If user has cookies turned off, does the expire=blank cookie still
work?
And altho I'm sure to answer some of this myself thru more
experimentation, I'm open to suggestions.
Finally, for reference, here's my "homework":
http://www.servicesbywilliams.com/business/help/i-___061.html
Thanks,
Chuck Williams
--
http://www.servicesbywilliams.com/business
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 27 Oct 1999 22:31:48 GMT
From: slganzho@unity.ncsu.edu (Salem Lee Ganzhorn)
Subject: perl lang parser
Message-Id: <7v7ugk$bh5$3@uni00nw.unity.ncsu.edu>
I am looking for a package which can parse a perl script and store the
information in a structure.
This is for creating and managing code dependancies.
TIA
--
Salem Lee Ganzhorn... slganzho@unity.ncsu.edu
------------------------------
Date: Thu, 28 Oct 1999 18:35:35 +0700
From: Apisilp Trunganont <b39ast@ku.ac.th>
Subject: Regular Expression
Message-Id: <38183507.24369A6F@ku.ac.th>
Dear,
I have this variable.
$a = "[b]abc[/b] [b]def[/b]";
And I want to change the value of this variable to "<b>abc</b>
<b>def</b>".
I try to use this regexp.
$a =~ s/\[b\](.*)\[\/b\]/<b>$1<\/b>/g;
But it doesn't work. When I print this variable, it shows.
<b>abc[/b] [b]def</b>
How can I solve this problem?
Thanks,
Apisilp.
------------------------------
Date: Thu, 28 Oct 1999 08:28:45 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Regular Expression
Message-Id: <Pine.GSO.4.10.9910280823310.2694-100000@crusoe.crusoe.net>
[posted & mailed]
On Oct 28, Apisilp Trunganont blah blah blah:
> $a = "[b]abc[/b] [b]def[/b]";
> $a =~ s/\[b\](.*)\[\/b\]/<b>$1<\/b>/g;
[snip. result:]
> <b>abc[/b] [b]def</b>
How can you solve this problem?
1) read perlre. this documentation is very good on explaining how
to construct regular expressions.
2) learn about non-greedy matching.
3) learn about the /BEGIN(?:(?!END))END/ regular expression, how you can
apply it here, and what it does in general.
4) read perlre.
5) read perlre.
6) read "Mastering Regular Expressions", by Jeffrey Friedl, published
by O'Reilly. there are two owls on the cover. you can't miss them.
7) read p... well, you get it.
--
MIDN 4/C PINYAN, USNR, NROTCURPI
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN/
------------------------------
Date: Thu, 28 Oct 1999 14:06:54 -0000
From: "bostja31" <zvonko.bostjancic@siol.net>
Subject: Require statement
Message-Id: <J_WR3.21$vx4.2124@news.siol.net>
Hello!
I'm working on a Perl project and I have problems with require statement.
In my script I use require statement like this:
require "eng_html.pl";
and when I try it on my local computer it returns an error message:
perl -Ie:/Harije1 e:\harije1\harije.pl
Can't locate ang_html.pl in @INC (@INC contains: e:/Harije1
C:/Perl/lib C:/Perl/
site/lib . e:\Harije-cgi) at e:\harije1\harije.pl line 15.
I have installed ActivePerl from ActiveState.
Regards,
Zvonko
------------------------------
Date: 28 Oct 1999 11:28:47 GMT
From: James Porritt <jamesp@sunf48.rd.bbc.co.uk>
Subject: Strange Bus error problem
Message-Id: <7v9c1f$8pq$1@nntp0.reith.bbc.co.uk>
I'm currently experiencing a very awkward perl problem. A Bus error is being
produced after my perl code has finished running. I do reference a home
written package, into which I stuck relevant BEGIN and END functions to prove
to myself that the Bus error occurs after clean-up.
My version of perl is version 5.004_04 built for sun4-solaris, running on
a Sun Ultra 10, using Solaris 7.
Are there any known bugs with this version of perl/platform, or might there
be something wrong that I'm doing with regards to libraries. Any further
hints on how to debug this code further would be very much appreciated -
I don't know what else to try.
Cheers,
Poz.
--
James Porritt | Room B213,
Online Engineer | BBC Research and Development,
BBC R&D / Multimedia Group / | Kingswood Warren, Tadworth,
BBC Internet Services | Surrey, KT20 6NP. (01737) 839614
------------------------------
Date: Thu, 28 Oct 1999 06:30:14 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: What makes the web go?
Message-Id: <brian-ya02408000R2810990630140001@news.panix.com>
In article <s1fmp7q5r0822@corp.supernews.com>, cberry@cinenet.net (Craig Berry) posted:
> brian d foy (brian@smithrenaud.com) wrote:
> : although CGI might be an interesting place to start, it's not what
> : you want to be doing for a high traffic site. mod_perl, servlets,
> Absolutely. But simple Perl-based CGI is easier to set up on a home
> machine, easier to understand, and lets you 'see' more of the
> protocol-layer stuff underlying the Web, which comes in handy when you
> move up to the bigger guns.
i would argue that mod_perl exposes more to the developer, whereas
the CGI hides it (as interfaces are supposed to do). it's
easier to set up and play with because it's *less* complex :)
it's too bad that such a limited, dead-end technology would have
to be a starting point for learning.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: 28 Oct 1999 10:23:33 GMT
From: Excellerated Learning 2100 Ltd <el2100@netvigator.com>
Subject: Write File Question?
Message-Id: <7v9875$psc11@imsp212.netvigator.com>
Dear all,
I am now writing a program as below:
#!/usr/local/bin/perl
$AUTHFILE ="haha.txt";
print (-s $AUTHFILE);
print "\n";
open (passfile,">$AUTHFILE") || die "can't open the file";
print (-s $AUTHFILE);
print "\n";
print passfile "haha";
close <passfile>;
print (-s $AUTHFILE);
print "\n";
open (passfile1,"<$AUTHFILE") || die "can't open the file";
while(<passfile1>)
{
print "haha\n";
print "Line $. = <$_>\n";
}
close <passfile1>;
print (-s $AUTHFILE);
print "\n";
and the result as below:
29
0
0
0
when I view the "haha.txt" use "cat", the following appears:
hahasr/local/bin/perl
Can anyone help me to solve this problem? Thank you in advance.
------------------------------
Date: Thu, 28 Oct 1999 11:12:38 GMT
From: greg@mccarroll.demon.co.uk (Greg McCarroll)
Subject: Re: Write File Question?
Message-Id: <38182f5f.18273113@newspull.london1.eu.level3.net>
On 28 Oct 1999 10:23:33 GMT, Excellerated Learning 2100 Ltd
<el2100@netvigator.com> wrote:
>Dear all,
> I am now writing a program as below:
>
>#!/usr/local/bin/perl
>$AUTHFILE ="haha.txt";
<snip>
>
>close <passfile>;
>
this wouldn't work anyway, you need round brackets ()
<snip>
>}
>close <passfile1>;
>
same again
>29
>0
>0
>0
> when I view the "haha.txt" use "cat", the following appears:
>hahasr/local/bin/perl
ok remember to put a \n in at the end of your print your getting your
prompt stuck onto the last line in the file i think
hth,
Greg
------------------------------
Date: Thu, 28 Oct 1999 13:20:42 +0200
From: "Joachim Pimiskern" <Joachim.Pimiskern@de.bosch.com>
Subject: Re: Write File Question?
Message-Id: <7v9bia$ns4$1@proxy2.fe.internet.bosch.de>
close <passfile>;
Shouldn't it read
close passfile;
?
Regards
Joachim (Joachim.Pimiskern@de.bosch.com)
------------------------------
Date: 28 Oct 1999 07:50:51 -0400
From: Scott Lanning <slanning@bu.edu>
Subject: Re: Write File Question?
Message-Id: <kushfjbog9w.fsf@strange.bu.edu>
Excellerated Learning 2100 Ltd <el2100@netvigator.com> writes:
Maybe you should decrease the excelleration [sic].
> Can anyone help me to solve this problem? Thank you in advance.
<sigh>
1) Use the -w switch. (duh....................)
2) It's close(file) not close <file>.
3) perldoc -f open
--
"One should not confuse this craving for change and novelty with the
indifference of play which is in its greatest levity at the same time
the most sublime and indeed the only true seriousness." --Georg Hegel
------------------------------
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 1210
**************************************