[9854] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3446 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 14 12:08:24 1998

Date: Fri, 14 Aug 98 09:00:29 -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           Fri, 14 Aug 1998     Volume: 8 Number: 3446

Today's topics:
    Re: "newgrp" in a Perl script <rootbeer@teleport.com>
    Re: 5.002 and 5.004 question <rootbeer@teleport.com>
    Re: 5.002 and 5.004 question <kperrier@blkbox.com>
    Re: <SELECT multiple...> only returns 1st value (Larry Rosler)
    Re: <SELECT multiple...> only returns 1st value <rootbeer@teleport.com>
    Re: A Regexp problem (Greg Bacon)
    Re: Access DB on same machine <j_henderson@umb.com>
    Re: Apache mod_rewrite, perl script problem <rootbeer@teleport.com>
    Re: Beginners problem? greene@gucc.org
    Re: Browser Counter Code Required (Steve Linberg)
    Re: Compile Perl Script (-)
    Re: Error in Databases <rootbeer@teleport.com>
    Re: File updating question <kpatel@mathworks.com>
    Re: File updating question (Chris Russo)
    Re: File updating question (Larry Rosler)
    Re: File updating question (Alastair)
        filehandle in CGI.pm <xuchu@iscs.nus.edu.sg>
    Re: flock vs open (Robert Bell)
    Re: Forked CGI process won't terminate browser connecti <rootbeer@teleport.com>
    Re: HELP !!!! HTTP ERROR 404 <kperrier@blkbox.com>
    Re: How to append at the top of the logfile ? (-)
    Re: How to append at the top of the logfile ? <jim.michael@gecm.com>
        localtime showing wrong info (Steve .)
    Re: localtime showing wrong info (Matthew Bafford)
    Re: localtime showing wrong info <rootbeer@teleport.com>
    Re: Matts counter - suddenly stopped working <rootbeer@teleport.com>
    Re: more than one recipient when emailing with sendmail <jdw@dev.tivoli.com>
    Re: Northern Colorado Perl Users Group (Greg Bacon)
        NT Registry Routines <rineholt@us.ibm.com>
    Re: opening page in top window <rootbeer@teleport.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Fri, 14 Aug 1998 15:17:46 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: "newgrp" in a Perl script
Message-Id: <Pine.GSO.4.02.9808140815220.10161-100000@user2.teleport.com>

On 14 Aug 1998, Joseph Bell wrote:

> write a ksh script that calls perl with the name of the file
> containing your perl prog.  chmod +s the ksh script. voila.

Uh oh. Are your ksh set-id scripts secure? (If you're not sure, see the
discussion in the Unix FAQ about set-id scripts.) Maybe your kernel has
secure set-id scripts, but (whether it does or not) you can use Perl to
make secure set-id scripts; you don't have to use ksh. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 14 Aug 1998 15:19:54 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: 5.002 and 5.004 question
Message-Id: <Pine.GSO.4.02.9808140819000.10161-100000@user2.teleport.com>

On 13 Aug 1998, Kent Perrier wrote:

> > 	In PERL 5.002, if you don't define a variable i.e. $my_string and
> > do an operation such as:
> > 
> > 	$my_string .= "\n";
> > 
> > you'll get an "use of uninitialize value message".
> > 
> > 	But in PERL 5.004, I don't get it.  Is this a correct explaination
> > for the observation I made or is it something?

> In the first script (using 5.002) you have a use strict; line and in the
> script useing 5.004 you don't.

You seem to be mistaken. The 'use strict' pragma doesn't have any effect
whatsoever on warnings about uninitialized values. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 14 Aug 1998 10:51:57 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: 5.002 and 5.004 question
Message-Id: <ysipve3lfxe.fsf@blkbox.com>

Tom Phoenix <rootbeer@teleport.com> writes:

> On 13 Aug 1998, Kent Perrier wrote:
> 
> > In the first script (using 5.002) you have a use strict; line and in the
> > script useing 5.004 you don't.
> 
> You seem to be mistaken. The 'use strict' pragma doesn't have any effect
> whatsoever on warnings about uninitialized values. Cheers!
> 

Oh,  I thought the 'use strict' pragme forced you define your variables and,
if you didn't, you got the 'use of uninitialize value' error message.  Is this
not true?

Kent


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

Date: Fri, 14 Aug 1998 08:25:09 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: <SELECT multiple...> only returns 1st value
Message-Id: <MPG.103df6b2f7ee6669897ca@nntp.hpl.hp.com>

In article <6r0hf5$fue$1@holly.prod.itd.earthlink.net> on Fri, 14 Aug 
1998 01:31:28 -0400, Ha <REPLY_TO_lastronin@earthlink.net> says...
 ...
> guess what? it works--all the time, every time.

Oh?  Nothing can go wrong, go wrong, go wrong, ...  Read on.

 ...
> CGI.pm. the module is immensely heavy for the poster's purpose. if one just
> wants to parse the query string, is it wise to load up CGI.pm when a few
> lines of (working, yes) code will do? IMHO, the latter is preferable over
> the former.

I agree.  BUT one still has to code defensively, which takes a bit more 
effort than you have put into it.

> btw, here is the subroutine. tell me where i went wrong since in my wildest
> dreams i will never have my name on a book:
> 
> sub read_query_string
> {
>    local ($buffer, @pairs, $pair, $name, $value, %FORM);

'my', not 'local'.  But that is not the problem, as you are about to see.

>    $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/;
>    if ($ENV{'REQUEST_METHOD'} eq "POST")

What happens to these two lines if $ENV{REQUEST_METHOD} is not defined?

>    {
>       read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});

What happens if $ENV{CONTENT_LENGTH} is undefined or has a value that is 
not a non-negative integer?  What happens if the 'read' fails to return 
that many bytes?

>    }
>    else
>    {
>       $buffer = $ENV{'QUERY_STRING'};

What happens if $ENV{QUERY_STRING} is not defined?

>    }
>    @pairs = split(/&/, $buffer);

What happens if the data aren't formatted the way they should be?

>    foreach $pair (@pairs)
>    {
>       ($name, $value) = split (/=/, $pair);

What happens if the data aren't formatted the way they should be?

>       $value=~ tr/+/ /;
>       $value=~ s/%(..)/pack("C", hex($1))/eg;

What happens if the two characters following the '%' are not hex digits?

>       $FORM{$name} .= "\t" if $FORM{$name};        # tab delimits a
> multiselect
>       $FORM{$name} .= $value;
>    }
>    %FORM;
> }

I hope you see by now.  You have made assumptions about the rational 
behavior of software over which you have no control (in this case, a web 
server).  Writers of good modules (or robust equivalents) try to 
anticipate and deal with external irrationality.  You have not.

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 14 Aug 1998 15:38:42 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: <SELECT multiple...> only returns 1st value
Message-Id: <Pine.GSO.4.02.9808140833120.10161-100000@user2.teleport.com>

On Fri, 14 Aug 1998, Ha wrote:

> Tom Christiansen wrote in message <6qav3d$16b$1@csnews.cs.colorado.edu>...
> >In comp.lang.perl.misc, someone wrote:
> >:EEk!!!!
> >:
> >:Everyone yells about using CGI.pm. People overcomplicate things and force
> >:the rest of us to be lazy. It's wonderful to NOT reinvent the wheel. Then
> >:again, if you don't even know the basics of wheel-ism, you're not gonna
> >:learn much.
> >
> >Guess what?  Your code is wrong.  Better go study CGI.pm some more.
> 
> yup. that was me. guess what? it works--all the time, every time. 

Tom C was right. If you're going to write your own code, you have to
follow the specification. The fact that your code "works" is no excuse.
You can skydive for years without bothering to bring a second parachute,
but that doesn't mean that your actions are acceptable.

If you're going to write your own code, instead of using CGI.pm, you have
to follow the CGI specification. There's no way around it.

    http://hoohoo.ncsa.uiuc.edu/cgi/

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 14 Aug 1998 14:37:24 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: A Regexp problem
Message-Id: <6r1i34$dt9$2@info.uah.edu>

In article <35D31607.2476B551@cs.ubc.ca>,
	Greg Smolyn <smolyn@cs.ubc.ca> writes:
: Any reason why you can't be courteous to a fellow Perl user?

Worry about the plank in your eye.

Greg
-- 
Sam:  What's new, Normie? 
Norm: Terrorists, Sam. They've taken over my stomach. They're demanding beer. 


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

Date: Fri, 14 Aug 1998 09:05:45 -0500
From: "Jerry Henderson" <j_henderson@umb.com>
Subject: Re: Access DB on same machine
Message-Id: <6r1g63$5eq@news9.noc.netcom.net>

Go to www.perl.com and then click on WindowsNT at the bottom left-hand
corner of the page.
This will eventually take you to http://www.access.digex.net/~jurlwin/
who has some excellent examples and tips on doing something like this.
You'll need to teak your Registry a little, but there is nothing to it.  I
know, because I've done it using the DBI module in Perl.

Brian Andrus wrote in message <6qsk4q$jnc$1@supernews.com>...
>How can I access a MS Access database on the same machine as the server? I
>am using IIS/NT. I do it all the time with ASP, but would like to find how
>to do it via PERL.
>
>Brian Andrus
>sysop@millenia.com
>
>




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

Date: Fri, 14 Aug 1998 15:31:50 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Apache mod_rewrite, perl script problem
Message-Id: <Pine.GSO.4.02.9808140831100.10161-100000@user2.teleport.com>

On Thu, 13 Aug 1998, Rosenet Technical Support wrote:

> When I use the rewrite module, the browser is taken to the proper
> address, but the script is shown in plain text.

Sounds as if your server isn't doing what you want. Perhaps the docs,
FAQs, and newsgroups about servers should be of assistance to you. Good
luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 14 Aug 1998 14:33:39 GMT
From: greene@gucc.org
Subject: Re: Beginners problem?
Message-Id: <6r1hs3$e5r$1@nnrp1.dejanews.com>

In article <35D0FDF5.274D@bigfoot.com>,
  Heikki Luukkala <hluukkala@bigfoot.com> wrote:
> How can I make words beginning with http:// to work as links?
>
> $text = "Some text http://www.domain.com/page.html some more text."
>
> How can I change it to:
> "Some text <A
> HREF=http://www.domain.com/page.html>http://www.domain.com/page.html</A>
> some more text."
>
> Something like $text =~ s/?/?/g ?
>
> Thanks,
> Heikki Luukkala
>

How about (WARNING: untested):

$text =~ s|(http:\S+?)|<a href="$1">$1</a>|g;

This (or something very similar) should work fine for http: stuff, but don't
forget about the mailto:, ftp:, telnet: and news: protocols.

I'm sure if you search Deja News, someone has developed a much more elegant
solution than this one.

Cheers,

JAGreene
Informatics Consulting
D-79539 Loerrach
http://gucc.org/greene/consult

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 14 Aug 1998 10:19:50 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Browser Counter Code Required
Message-Id: <linberg-1408981019510001@pri03-028.oldcity.dca.net>

In article <903092775.563.0.nnrp-04.9e98ffcf@news.demon.co.uk>, "Jason
Townsend" <jason@technolog.com> wrote:

> Does anybody have any example code for keeping a hit counter of the type of
> Browser being used to access a site, ie Number of Netscape 3.0 hits, IE 3
> hits, etc.

Your serverlogs have all of this information already.

CGI hit counters aren't accurate.  It's impossible.  The logs are the only
way to really tell.  Get some software to interpret them.


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

Date: Fri, 14 Aug 1998 14:16:13 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Compile Perl Script
Message-Id: <35d4464d.251987520@news2.cais.com>

"news.space.ru" <gzhel@space.ru> Said this:

>What  can I do to compile perl script? What software I can use?
>

Go to the CPAN and look around. There is a compiler for perl, although
it's not perfect and it often will not result in a working executable.
For smaller, simpler scripts it seems to work fine, but then again,
those smaller simpler scripts don't usually mandate the efficiency
gains of compiled code. :)




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

Date: Fri, 14 Aug 1998 15:48:58 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Error in Databases
Message-Id: <Pine.GSO.4.02.9808140848060.10161-100000@user2.teleport.com>

On Fri, 14 Aug 1998, Kowalski wrote:

> How do I get information out of a database (MSAccess) using perl?

See the documentation for the module you're using to access that database.
If you're not using a module, install one from CPAN. If there isn't one on
CPAN yet, write one and upload it. :-)

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 14 Aug 1998 10:08:37 -0400
From: Ketan Patel <kpatel@mathworks.com>
Subject: Re: File updating question
Message-Id: <35D444E5.E968F29F@mathworks.com>

Ha wrote:
> no no no. as i mentioned in another post to someone esle, you CANNOT READ
> AND WRITE AT THE SAME TIME IF YOU'RE GOING TO CHANGE THE SIZE OF THE FILE.
> sorry for the shouting. perldocs is not stressing this enough. the only way
> to do a valid +< is to keep the file size exactly the same. go back to my
> first post and try the open read, open write, rename method. unless you're
> making a byte-for-byte replacement (which takes a lot of forethought in the
> original creation of the datafile) you should never use +<.
> 

My data file is something along the lines of:

00000|00000|0|Text Here [50-char string]|Text Here [75-char
string]|00000000
00001|00000|0|Text Here [50-char string]|Text Here [75-char
string]|00000000
00002|00000|0|Text Here [50-char string]|Text Here [75-char
string]|00000000

Where each line and field is of a pre-determined length and that never
changes... Also, in the particular 'editing session' I am talking about,
the overall size of the file does not change... It's pretty much turning
that '0' in the third column to a '1'... In my search for an answer,
last night I came upon "-i" or "$^I"... Anyone have info on these?  I
couldn't find any meaningful examples... I did write a quick script to
test it, but that didn't work as planned:

open(DATA,"+<data.txt") or die "die!";
flock DATA, 2;
while(<DATA>) {
	@array = split(/\|/,$_);
	$array[2] = '1';
	$print DATA @array; #this doesn't seem to work ?? any suggestions?
#       $print;             #this didn't work either...
}
close(DATA);

Thanks for all your help...


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

Date: Fri, 14 Aug 1998 08:14:25 -0700
From: news@russo.org (Chris Russo)
Subject: Re: File updating question
Message-Id: <news-1408980814250001@buzz.hq.alink.net>

In article <6r0ftj$cmc$1@holly.prod.itd.earthlink.net>, "Ha"
<REPLY_TO_lastronin@earthlink.net> wrote:

[ [un]flock before close snipped ]

>In all the documentation and examples I've seen, in the books, etc. i've
>never come across this "perl will do it for you." IMHO, it never hurts to be
>explicit. for example, while leaving out flock 8 *may* work on UNIX, it
>doesn't work on dos-based systems. if you don't unlock, you can't do
>anything with it such as renaming, deleting, opening, etc. trust me, i've
>been through this before and have learned the error of my flocking ways.

As I understand it, the problem is that flock(8) doesn't flush the
contents of the file, close() does.  So if you have some code:

open the file
flock(2)
print to the file
flock(8)
xxx
close the file

There's the danger that another process can jump in where I've put the
"xxx" and start working on the file before your close() has a chance to
safely flush its contents out to disk.

So, it's actually a *bad* thing to explicitly unlock the file.

Of course, I have no answer as to why you've run into other difficulties
when trying this under DOS.

I'm hoping that someone who's read the Perl source can jump in and shed
some illumination on the subject.

Regards,

Chris Russo

-- 
Chris Russo
news@russo.org
http://www.russo.org


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

Date: Fri, 14 Aug 1998 08:40:11 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: File updating question
Message-Id: <MPG.103dfa32f6fc9d7a9897cb@nntp.hpl.hp.com>

In article <6r0ftj$cmc$1@holly.prod.itd.earthlink.net> on Fri, 14 Aug 
1998 01:05:05 -0400, Ha <REPLY_TO_lastronin@earthlink.net> says...
 ... 
> no no no. as i mentioned in another post to someone esle, you CANNOT READ
> AND WRITE AT THE SAME TIME IF YOU'RE GOING TO CHANGE THE SIZE OF THE FILE.
> sorry for the shouting. perldocs is not stressing this enough. the only way
> to do a valid +< is to keep the file size exactly the same. go back to my
> first post and try the open read, open write, rename method. unless you're
> making a byte-for-byte replacement (which takes a lot of forethought in the
> original creation of the datafile) you should never use +<.

Simply not true.  You can seek to some place in the file, truncate it 
there, and write whatever you please after.  This is well documented, for 
example in the famous FAQ that you have not absorbed, "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?"
 ...
    In the unique case of deleting lines at the end of a file, you can
    use tell and truncate. The following code snippet deletes the last
    line of a file without making a copy or reading the whole file into
    memory: 

        open (FH, "+< $file");
        while ( <FH> ) { $addr = tell(FH) unless eof(FH) } 
        truncate(FH, $addr);

> >I don't understand how to save (write to file) the changes I make when
> >going line by line... When I used the read-in-the-whole-array method, I
> >would just overwrite the whole file with the new array...
> 
> as i said, this method is fine. however, it would do you good to learn how
> to read files line by line. give it a week, a month, and come back and see
> if you're comfy with either style.

It would do you good to learn how to read...

> i might as well answer Tom Phoenix here.
> I said:
> > if you use flock 2, remember to flock 8 (unlock
> > it) before closing FILE.
> 
> He said:
> >No, you should simply close the file, and let perl take care of unlocking
> >it. (That's what the original poster was doing, correctly.)
> 
> >     open(DATA, ">$datapath")
> >         || print ("Son, it's not my fault.");
> >     flock(DATA, 2);
> 
> >That's not a good way to cooperate with other processes. If another
> >process were writing that file, you just clobbered it!
> 
> In all the documentation and examples I've seen, in the books, etc. i've
> never come across this "perl will do it for you." IMHO, it never hurts to be
> explicit. for example, while leaving out flock 8 *may* work on UNIX, it
> doesn't work on dos-based systems. if you don't unlock, you can't do
> anything with it such as renaming, deleting, opening, etc. trust me, i've
> been through this before and have learned the error of my flocking ways.

No, you haven't.  By unlocking a file before closing it, you run the risk 
of another process changing the file before your output buffer has been 
flushed to it.  I recall reading here that 'flock .. 8' has been changed 
to force the flush before unlocking the file, which is why you may have 
been getting away with it. 

-- 
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 14 Aug 1998 15:54:01 GMT
From: alastair@psoft.co.uk (Alastair)
Subject: Re: File updating question
Message-Id: <6r1miq$808@handupme.avid.com>

Ketan Patel <kpatel@mathworks.com> wrote:
>
>open(DATA,"+<data.txt") or die "die!";
>flock DATA, 2;
>while(<DATA>) {
>	@array = split(/\|/,$_);
>	$array[2] = '1';
>	$print DATA @array; #this doesn't seem to work ?? any suggestions?
>#      $print;             #this didn't work either...

It's pretty obvious why the 'prints' aren't working ... what _is_
'$print'. A variable?

-- 
Alastair
Avid Effects
alastair@psoft.co.uk


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

Date: 14 Aug 1998 15:25:13 GMT
From: wings <xuchu@iscs.nus.edu.sg>
Subject: filehandle in CGI.pm
Message-Id: <6r1ksp$96t15@id4.nus.edu.sg>

i'm writing an upload script with CGI. as told in CGI.pm, 
$q->param('file') returns both the filename as a string and a handle.
so here is part of my codes:

	$srcfile = $q->param('file');
	# assuming that $srcfile='d:\test\a.html'

	open (FP, ">d:\\test\\b.html") || die "cant write";
	while (<$srcfile>) {
		print FP $_;
	}

i always get zero bytes in b.html. where am i doing wrong?

thx for any help.
-- 
wings
------
World is a book, those dont travel read only one page.

Email: xwings@usa.net, xuchu@iscs.nus.edu.sg
ICQ UIN: 1440319
http://gump.iscs.nus.edu.sg


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

Date: Fri, 14 Aug 1998 14:58:03 GMT
From: rbell@hcdemocrat.com (Robert Bell)
Subject: Re: flock vs open
Message-Id: <35d44e9a.4344614@news.eclipse.net>

On Thu, 13 Aug 1998 12:48:42 -0800, madame philosophe <mp@mkt2mkt.com>
wrote:

>What I want to know is it proper to use flock() before or after opening
>a file? and how about closing?
>
>To make it easy for you to anwer me please choose from the following
>options:
>
>A) open first then lock, close first then unlock.
>B) lock first then open, close first then unlock.
>C) open first then lock, unlock first then close.
>D) lock first then open, unlock first then close.
>
>Please advise!  Thanks!

E] none of the above. Sort of. One opens, then locks. Closing unlocks.


Robert Bell
rbell@hcdemocrat.com



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

Date: Fri, 14 Aug 1998 15:40:26 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Forked CGI process won't terminate browser connection
Message-Id: <Pine.GSO.4.02.9808140839200.10161-100000@user2.teleport.com>

On Fri, 14 Aug 1998 glen_a_smith@my-dejanews.com wrote:

> 		if (fork() == 0) {

Be sure to check for a failed fork, which returns undef.

> Everything works fine *except* the browser seems to hang around
> and wait for $bg_process_cmd to terminate. Ideas?

It sounds as if you're trying to get your browser to do something
different. Maybe the docs, FAQs, and newsgroups about browsers (or
servers) will be able to help you. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 14 Aug 1998 10:23:50 -0500
From: Kent Perrier <kperrier@blkbox.com>
Subject: Re: HELP !!!! HTTP ERROR 404
Message-Id: <ysisoizlh89.fsf@blkbox.com>

Alee Ali <aaa@dms2.com> writes:

> Hi,
> I have the hello.pl perl program which prints the IP Address.  I have
> that in my cgi-bin directory on NT 4.0.  Does anyone know why I keep
> getting the HTTP Error 404 that it can't find the file or the script.
> 

Your server isn't configured correctly?  

Kent


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

Date: Fri, 14 Aug 1998 14:13:16 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: How to append at the top of the logfile ?
Message-Id: <35d43f38.250174990@news2.cais.com>

mnc@diana.law.yale.edu (Miguel Cruz) Said this:

>Terrence S. Ma <terrence@cs.utexas.edu> wrote:
>> I am pretty new to perl so I hope that I am not asking a very 
>> stupid question.  I have a perl script to log all the web hits 
>> on my web page but I want to have the latest hit to be at the top 
>> of the logfile instead of at the bottom.
>
>There's only one way that's going to scale particularly well to large
>logfiles: Turn your monitor upside down and leave the code alone.
>
>Otherwise you're going to have to rewrite the entire file every time you add
>a line. Are you sure it's really worth the trouble? Perhaps you could attack
>the problem from the other angle; for instance, write a version of "more"
>that pages backwards through a file.
>

Actually, these are probably "hacks" but it's possible to do... 

the easiest method is to slurp the entire file into memory, the best
way is into a hash, then make your modifications and write it all out
to the file (but don't append, actually overwrite the old file).

To write to the top of a file, simply create a new file, write your
new first line, then append the original file to this new file and
rename it to the original file name.  use cat to accomplish this
quickly - `cat oldfile >>newfile`; or whatever.  I suppose if you have
a slow disk subsystem but a monster CPU, you could even gzip the file
first and then do all the file manipulations, then gunzip it once you
are done, that might save a little on the actual file writes??  You
can also use the unix commands tail and head creatively to accomplish
this - 

open (OUT, "tempfile");
print "$newline\n";
close OUT;
`tail -50 filename >>tempfile`
`head -100 filename >>tempfile`

This is an odd example, but what you've done is written the first
line, then placed the last 50 lines after the first line, and then the
first 100 lines after that.  I can't imagine why you would do that,
but you can see how that works.

Sure, it's all a hack, but often that's what we have to resort to --
"whatever works" ;)


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

Date: Fri, 14 Aug 1998 11:31:01 -0400
From: Jim Michael <jim.michael@gecm.com>
Subject: Re: How to append at the top of the logfile ?
Message-Id: <35D45835.4501@gecm.com>

- wrote:

> To write to the top of a file, simply create a new file, write your
> new first line, then append the original file to this new file and
> rename it to the original file name.  use cat to accomplish this

My TMTOWTDI:

#!/usr/bin/perl -w
open (OUT,"+<access.log") || die $!;
my $line = "http://language.perl.com/newdocs/pod/perlfaq5.html";
seek OUT, 0, 0;
print OUT $line;
close OUT;

Cheers,

Jim


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

Date: Fri, 14 Aug 1998 14:57:27 GMT
From: syarbrou@ais.net (Steve .)
Subject: localtime showing wrong info
Message-Id: <35d45010.7010213@news.ais.net>

Why does localtime show everything correctly except for the month.  My
system clock is set to August, but it is showing 7 for the month
number.  The year shows 98 and the day shows 14.  Is the month
starting with 0?  If so, what's the deal with that?  If not, what's
going wrong?  This is on Solaris.  Thanks.

STeve


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

Date: Fri, 14 Aug 1998 16:05:19 GMT
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: localtime showing wrong info
Message-Id: <MPG.103e21652e63e7c0989698@news.scescape.net>

In article <35d45010.7010213@news.ais.net> on Fri, 14 Aug 1998 
14:57:27 GMT, Steve . (a) felt the following information to be of 
use:
> Why does localtime show everything correctly except for the month.  My
> system clock is set to August, but it is showing 7 for the month
> number.  The year shows 98 and the day shows 14.  Is the month
> starting with 0?  If so, what's the deal with that?  If not, what's
> going wrong?  This is on Solaris.  Thanks.
> 
> STeve
>

# perldoc -f localtime
 ...
All array elements are numeric, and come straight out of
a struct tm. In particular this means that $mon has the
range 0..11 and $wday has the range 0..6 with sunday as
day 0. Also, $year is the number of years since 1900,
that is, $year is 123 in year 2023.
 ...
#


Hope this helps!

--Matthew


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

Date: Fri, 14 Aug 1998 15:53:52 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: localtime showing wrong info
Message-Id: <Pine.GSO.4.02.9808140853350.10161-100000@user2.teleport.com>

On Fri, 14 Aug 1998, Steve . wrote:

> Why does localtime show everything correctly except for the month.

Because you haven't read the docs. :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 14 Aug 1998 15:42:07 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Matts counter - suddenly stopped working
Message-Id: <Pine.GSO.4.02.9808140841340.10161-100000@user2.teleport.com>

On Thu, 13 Aug 1998, I R A Aggie wrote, quoting me:

> + Complain to the program's author. Hope this helps!
> 
> Matt doesn't support his programs. No help there.

I didn't say to ask for support; I said to complain. :-)

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 13 Aug 1998 22:11:52 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: more than one recipient when emailing with sendmail
Message-Id: <obk94c9s07.fsf@alder.dev.tivoli.com>


syarbrou@ais.net (Steve .) writes:
> I am sending an attachment to an individual.  Everything works fine.
> The recipient line is as follows:
> 
> print MAIL "To: person\@joe.net (The Name) \n";
> 
> If I want to add more than one recipient, how is that done, or do I
> need to do a foreach loop to email each recipient?  Thanks.

I've never used the sendmail module, but assuming it's using sendmail
-t, you can seperate addresses by commas, and you can add carriage
returns, but only if you then indent at least one space on the next
line.  You can also add additional addresses via bcc:/cc: lines

i.e.

print MAIL <<'EOT';
To: "George Jetson" <gjetson@tvland.com>, "Mick Jagger" <mj@rs.com>,
    "John Doe" <jdoe@nowhere.com>
cc: "My Home Address for backups" <ralph@home.net>
    "My Logs" <logs@localhost>
bcc: "your boss" <joe_luser@work.com>
EOT

You might also take a look at the sendmail faq...

-- 
Jim Woodgate 
Tivoli Systems
E-Mail: jdw@dev.tivoli.com


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

Date: 14 Aug 1998 14:40:17 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Northern Colorado Perl Users Group
Message-Id: <6r1i8h$dt9$3@info.uah.edu>

In article <5qsoj2hzsl.fsf@prometheus.frii.com>,
	Nathan Torkington <gnat@frii.com> writes:
: Let's get together for a beer and swap war stories.  I'll even give
: you a report on the Perl Conference if you couldn't make it (complete
: with photos!).

GIF! GIF! JPEG! JPEG! :-)

Greg
-- 
Nothing inspires forgiveness quite like revenge. 
    -- Dogbert


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

Date: Fri, 14 Aug 1998 11:17:20 -0400
From: rineholt <rineholt@us.ibm.com>
Subject: NT Registry Routines
Message-Id: <35D454FF.C76674A6@us.ibm.com>

I  have "inherited" some code that I need to maintain and update that
use apis like
NTReg...Key.  Are these officially how one can access NT's registry?
All the books I have read and code that I have written with the latest
perl distribution use an OO approach like $hkey->Create( ...) etc.  The
latest perl that I have does not seem to recognize the NTReg...Key
apis.  The problem is I wanted to merge some fixes/updates done with the
OO approach with the old stuff and update the perl version being used.
I'm not a perl GURU (probably obvious), but I'd like an understanding of
what is the correct way/most portable way of doing NT Registry
operations in perl.  Is the NTReg..Key api's antiquated?



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

Date: Fri, 14 Aug 1998 15:43:28 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: opening page in top window
Message-Id: <Pine.GSO.4.02.9808140842410.10161-100000@user2.teleport.com>

On 14 Aug 1998, Ivo Bieleveldt wrote:

> Subject: opening page in top window

Did you realize that you posted this message twice?

> A script is being called by one frame. The script does eventually:
> print "location: $url\n\n";
> 
> $url appears in the old frame, but I want it to appear in the top
> window. 

It sounds as if you want to tell a browser to do something. Perhaps the
docs, FAQs, and newsgroups about browsers could help you. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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 3446
**************************************

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