[13885] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1295 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Nov 8 14:22:58 1999

Date: Mon, 8 Nov 1999 11:22:47 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942088967-v9-i1295@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 8 Nov 1999     Volume: 9 Number: 1295

Today's topics:
    Re: CGI FAQ discussion <flavell@mail.cern.ch>
        CGI file Basics <gacavi@rocketmail.com>
    Re: CGI file Basics (Kragen Sitaker)
    Re: CGI file Basics (Bart Lateur)
        CGI problem on Netscape <Lalit.Kolhe@newit.co.uk>
    Re: CGI problem on Netscape (Michel Dalle)
    Re: CGI problem on Netscape <flavell@mail.cern.ch>
    Re: CGI problem on Netscape <gellyfish@gellyfish.com>
    Re: cgi tutorial <msalter@bestweb.net>
        CGI.pm not looking at command line <burton@REMOVETHIS.lucent.com>
    Re: CGI.pm not looking at command line <rootbeer@redcat.com>
    Re: comparing text with words (Simon Cozens)
    Re: comparing text with words <qumsieh@sympatico.ca>
    Re: comparing text with words <rick.delaney@home.com>
    Re: Complex hashes and CGI (Kragen Sitaker)
        CONTENT TYPE <david_anderson1@mindspring.com>
    Re: CONTENT TYPE <nead@neadwerx.com>
    Re: CONTENT TYPE (Kragen Sitaker)
    Re: CONTENT TYPE (Michael Budash)
    Re: CONTENT TYPE (Kragen Sitaker)
    Re: CONTENT TYPE <gellyfish@gellyfish.com>
        Continuous "tail" into a buffer/array? <tturton@ntx.waymark.net>
    Re: Continuous "tail" into a buffer/array? <lr@hpl.hp.com>
    Re: Continuous "tail" into a buffer/array? <tturton@ntx.waymark.net>
    Re: Converting a perl .db file on BSDI to a .pag/.dir f (Kragen Sitaker)
    Re: Copying files. <cassell@mail.cor.epa.gov>
    Re: Copying files. <gellyfish@gellyfish.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 7 Nov 1999 01:31:04 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: CGI FAQ discussion
Message-Id: <Pine.HPP.3.95a.991107012038.19149B-100000@hpplus01.cern.ch>


On 6 Nov 1999, Jonathan Stowe wrote:

> I dont think there is anything there that I could disagree with, however
> one thing occurs to me - if we do advocate the paring down of this entry
> in the FAQ to be basically 'use CGI.pm or look elsewhere' we ought to be
> certain that there is an elsewhere to which they can be redirected

Well, maybe...

> - most
> of *us* are not unhappy about looking at RFCs or other technical
> specifications to derive information that can be applied in practice but
> this could be too much to ask of the usual posters who ask about these
> things in this group and would be directed to these materials.

Well, we should perhaps be open to the possibility that if they can't
understand the RFCs they'd better not be let loose on writing
substitutes for CGI.pm, but may I reserve judgement on that for now...
 
> I'm not so sure that the CGI faq covers this in as much detail as you
> have layed out here - perhaps some text based on yours could be put in
> that ?  Indeed isnt there a CGI autofaq somewhere now into which this
> could be inserted.

Well, there is, but it doesn't seem to engender much discussion.  So if
our proposal goes there, it should get properly hacked about first.  I
think I'll wait for due discussion first (the CGI group hasn't reacted
yet, AFAICS, maybe the best people have more important things to do with
their weekends.  ;-) - so this is only a "holding" response for now.

There are still some features that are more Perl-ish than CGI-ish; it
would be good to get the split right.  That "proposal B" of mine seems 
increasingly appropriate for the Perl side of the fence, if I may say
so.

all the best



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

Date: Sun, 07 Nov 1999 19:53:01 GMT
From: Bill Miller <gacavi@rocketmail.com>
Subject: CGI file Basics
Message-Id: <804las$jtf$1@nnrp1.deja.com>

Dont know anything about Perl or CGI and need some basic information. I
have a Perl application which is run from a .CGI file and I would like
to get it working. I want to set up and test the program offline on my
desktop PC. When I call the .cgi file using a hyperlink my browser trys
to open the file with text.exe or just pulls up the text in the browser
window. I have named the file with both the .cgi and .pl extensions and
it reacts the same way.

1. is it possible to test the program off line?
2. do I need special software to test and run offline?

I'm using Frontpage98 and Microsft personal webserver to manage my
website.

Thanks for your help.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Sun, 07 Nov 1999 21:43:53 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: CGI file Basics
Message-Id: <tomV3.54337$23.2028355@typ11.nn.bcandid.com>

In article <804las$jtf$1@nnrp1.deja.com>,
Bill Miller  <gacavi@rocketmail.com> wrote:
>Dont know anything about Perl or CGI and need some basic information. I
>have a Perl application which is run from a .CGI file and I would like
>to get it working. I want to set up and test the program offline on my
>desktop PC. When I call the .cgi file using a hyperlink my browser trys
>to open the file with text.exe or just pulls up the text in the browser
>window. I have named the file with both the .cgi and .pl extensions and
>it reacts the same way.
>
>1. is it possible to test the program off line?
>2. do I need special software to test and run offline?

0. this is actually not the best newsgroup to ask in; see
comp.infosystems.www.authoring.cgi.
1. yes.
2. yes, a web server.  e.g. apache.

Actually, you can test the program from the ms-dos prompt if you speak CGI.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Mon, 08 Nov 1999 08:53:04 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: CGI file Basics
Message-Id: <382a8ccd.2293228@news.skynet.be>

Kragen Sitaker wrote:

>Actually, you can test the program from the ms-dos prompt if you speak CGI.

No need for that, if your CGI supporting module has a special off-line
mode. E.g. CGI.pm:

 # If $meth is not of GET, POST or HEAD, assume we're being debugged
   offline.
 # Check the command line and then the standard input for data.

In my own mini-CGI module, I read the parameters from a text file, and
save the output, except content-type and other headers, into another
file (usually a html file), which can be loaded into the browser.

-- 
	Bart.


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

Date: Mon, 08 Nov 1999 16:30:19 GMT
From: Lalit Kolhe <Lalit.Kolhe@newit.co.uk>
Subject: CGI problem on Netscape
Message-Id: <s2dukruq6i788@corp.supernews.com>

Hi,

I am trying to run a cgi script with Netscape 4.6. It is supposed to show 
me the HTML page. But it asks me whether I want to Open/Save the output. 
When I open it, it shows the HTML statements in the editor instead of 
showing them in the browser.

The script runs fine in IE5. What may be the reason for this  and way 
around this ?

Regards,
Lalit

--
Posted via CNET Help.com
http://www.help.com/


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

Date: Mon, 08 Nov 1999 16:42:59 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: CGI problem on Netscape
Message-Id: <806ur7$k5g$1@news.mch.sbs.de>

In article <s2dukruq6i788@corp.supernews.com>, Lalit Kolhe <Lalit.Kolhe@newit.co.uk> wrote:
>Hi,
>
>I am trying to run a cgi script with Netscape 4.6. It is supposed to show 
>me the HTML page. But it asks me whether I want to Open/Save the output. 
>When I open it, it shows the HTML statements in the editor instead of 
>showing them in the browser.
>
>The script runs fine in IE5. What may be the reason for this  and way 
>around this ?

The reason may be that your script and/or your webserver returns the wrong
Content-type to your browser, so Netscape will ask you what to do with it,
while IE5 will try to outsmart itself and open the page if it contains HTML.

Check whether your script contains a line like
        print header; # if you use CGI :-)
or
        print $q->header; # if you use CGI :-)
or
        print "Content-type: text/html\n\n"; # if you don't use CGI :-(
etc.
and check the configuration of your webserver.

For the rest, check the relevant comp.infosystems.www.servers.* newsgroup.

Have fun,

Michel.


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

Date: Mon, 8 Nov 1999 18:08:19 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: CGI problem on Netscape
Message-Id: <Pine.HPP.3.95a.991108180211.28187B-100000@hpplus01.cern.ch>

On Mon, 8 Nov 1999, Lalit Kolhe wrote:

> I am trying to run a cgi script with Netscape 4.6. It is supposed to show 
> me the HTML page. But it asks me whether I want to Open/Save the output. 
> When I open it, it shows the HTML statements in the editor instead of 
> showing them in the browser.

FAQ: http://www.htmlhelp.org/faq/html/media.html#garbled-media

This FAQ explains the basis of your problem, except that it's talking
about configuring content-types in the server.  In your case your CGI
script is responsible for sending the correct content-type, but the
underlying principle is the same.

> The script runs fine in IE5.

Actually no.  IE only gives an impression of working, whereas in fact
it is seriously violating the published interworking specification.

The proper place for this kind of question is on the WWW authoring
groups, in this case comp.infosystems.www.authoring.cgi, but you would
be well advised to make yourself familiar first with the FAQ resources
at the above site, http://www.htmlhelp.org/




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

Date: 8 Nov 1999 17:15:57 GMT
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: CGI problem on Netscape
Message-Id: <3827054d_2@newsread3.dircon.co.uk>

Lalit Kolhe <Lalit.Kolhe@newit.co.uk> wrote:
> Hi,
> 
> I am trying to run a cgi script with Netscape 4.6. It is supposed to show 
> me the HTML page. But it asks me whether I want to Open/Save the output. 
> When I open it, it shows the HTML statements in the editor instead of 
> showing them in the browser.
> 
> The script runs fine in IE5. What may be the reason for this  and way 
> around this ?
> 

You are probably sending the wrong Content-type header but you are certainly
asking in the wrong group - posting from help.com is no excuse :

   comp.infosystems.www.authoring.cgi

You might also want to see the CGI FAQ at :

  <http://www.webthing.com/tutorials/cgifaq.html>

/J\
-- 
"Enter the Great Jaffa Cakes Debate. In these jam-filled concoctions
were cakes they would escape VAT. Because they are soft and not hard,
they were deemed to be cakes and therefore VAT free. In 1974 Master of
the Universe asked the VAT tribunal to exempt him from VAT because he
is the Supreme Authority in the Universe and therefore should not pay
it. He lost his case" - BBC News Website


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

Date: Fri, 05 Nov 1999 14:36:01 GMT
From: Mike Salter <msalter@bestweb.net>
Subject: Re: cgi tutorial
Message-Id: <Pine.BSF.4.05.9911050933340.25758-100000@monet.bestweb.net>

On Thu, 4 Nov 1999 brondsem@my-deja.com wrote:
>Could anyone point me to a good CGI/perl tutorial
>on the net?  I have no experience with either,
>but am a fast learner, so a beginner to
>intermediate tutorial would be good.

http://www.perl.com
http://stein.cshl.org/~lstein/
http://www.webthing.com/tutorials/cgifaq.html

HTH - Mike




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

Date: Fri, 05 Nov 1999 11:45:43 -0500
From: Burton Kent <burton@REMOVETHIS.lucent.com>
Subject: CGI.pm not looking at command line
Message-Id: <382309B7.7361D959@REMOVETHIS.lucent.com>

I have a CGI program (using CGI.pm) I want to debug from the command line, or by
typing arguments in through standard input.  CGI.pm is supposed to automatically
check the command line then STDIN, but it's not.

The only way I can see that CGI.pm's command line debugging might be turned off
is setting NO_DEBUG to 1, but it's set (correctly) to 0;
    # Set this to 1 to disable debugging from the
    # command line
    $NO_DEBUG = 0;

Any clues about this?

Thanks.

B


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

Date: Fri, 5 Nov 1999 12:50:19 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: CGI.pm not looking at command line
Message-Id: <Pine.GSO.4.10.9911051247120.29670-100000@user2.teleport.com>

On Fri, 5 Nov 1999, Burton Kent wrote:

> I have a CGI program (using CGI.pm) I want to debug from the command
> line, or by typing arguments in through standard input.  CGI.pm is
> supposed to automatically check the command line then STDIN, but it's
> not.
> 
> The only way I can see that CGI.pm's command line debugging might be
> turned off is setting NO_DEBUG to 1, but it's set (correctly) to 0;
>     # Set this to 1 to disable debugging from the
>     # command line
>     $NO_DEBUG = 0;
> 
> Any clues about this?

What you have posted is correct Perl code. The bug must be in what you
didn't post. Cut it down to the smallest example which demonstrates the
behavior, then post that.

No, wait; I've done it for you.

    #!/usr/bin/perl -w
    use CGI qw/ :standard /;
    my @params = param();

Works for me. If it doesn't work for you, see whether you can find out how
your code differs from this. Cheers!

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



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

Date: 7 Nov 1999 07:11:37 GMT
From: simon@othersideofthe.earth.li (Simon Cozens)
Subject: Re: comparing text with words
Message-Id: <slrn82a9h9.o1i.simon@othersideofthe.earth.li>

Abigail (comp.lang.perl.misc):
>Well...... not quite. It's a little known fact that certain comparison
>operators can be written in all caps as well.

Well, they can, but you get shouted at. Or at least, you should get
shouted at. 

But here's a good bug for you - if you use it with an unquoted string,
you get shouted at *twice*:

 % perl -wle 'print q/woo/ if b GT "a"'
 Use of GT is deprecated at -e line 1.
 Unquoted string "b" may clash with future reserved word at -e line 1.
 Use of GT is deprecated at -e line 1.
 woo

-- 
"Anyone attempting to generate random numbers by deterministic means is, of
course, living in a state of sin."
-- John Von Neumann


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

Date: Sun, 07 Nov 1999 18:48:29 GMT
From: Ala Qumsieh <qumsieh@sympatico.ca>
Subject: Re: comparing text with words
Message-Id: <3825C9EE.E46BE3BE@sympatico.ca>

Larry Rosler wrote:
> 
> In article <381CCE33.491FAD47@sympatico.ca> on Sun, 31 Oct 1999 23:16:28
> GMT, Ala Qumsieh <qumsieh@sympatico.ca> says...
> > Perl golf is never in my mind when I write programs, but I like to be
> > simple
> > and concise.
> 
> The 'golf score' is often an indication of clarity and even of
> performance.  In this case, using 'local $_' to eliminate all the
> repetitions of '$x =~', and using logical short-circuiting '||' instead
> of all those 'if' statements.

In this particular case, I doubt that golfing this piece of code had
any 
performance impact. But, I usually do:

	/$pat/ and $x = 1 and next;

instead of:
	if (/$pat/) {
		$x = 1;
		next;
	}

which drives my colleagues crazy :)
I guess I'll have to organize a Perl golf tournament here :)

> By the way, your newsreader is still producing funny line breaks.  See
> above.

I apologize for that. The setting are set for "warp at 72 chars".
I guess I'll have to insert the breaks manually then.

--Ala


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

Date: Sun, 07 Nov 1999 19:14:05 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: comparing text with words
Message-Id: <3825CF92.B463E8FE@home.com>

[posted & mailed]

Ala Qumsieh wrote:
> 
> In this particular case, I doubt that golfing this piece of code had
> any
> performance impact. But, I usually do:
> 
>         /$pat/ and $x = 1 and next;
> 
> instead of:
>         if (/$pat/) {
>                 $x = 1;
>                 next;
>         }
> 
> which drives my colleagues crazy :)

And no wonder!  What if you want to assign 0 to $x?

> I guess I'll have to organize a Perl golf tournament here :)
> 
> > By the way, your newsreader is still producing funny line breaks.  See
> > above.
> 
> I apologize for that. The setting are set for "warp at 72 chars".
                                                 ^^^^
Looks like it's working.  ;-)

> I guess I'll have to insert the breaks manually then.

I believe that is the source of the problem with this particular
"newsreader".  You put a linefeed after "any ", leaving a line with 73
characters (excluding linefeed).  "any \n" is then wrapped onto the next
line, leaving it all alone.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Sun, 07 Nov 1999 23:56:48 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Complex hashes and CGI
Message-Id: <4loV3.54819$23.2046064@typ11.nn.bcandid.com>

In article <7stnsa$h9c$1@nnrp1.deja.com>, Ubu  <ubu@easynet.ca> wrote:
>My current plan is to use Data::Dumper to store the data in temporary
>files, save/reload the data on each load of the page.
>
>What I'm wondering is if anyone has taken a different approach,
>specifically if there is any way to pass a complex hash with an
>arbitrary structure as a form element(s) (hidden probably) using CGI.pm
>itself. From what I can tell it is not possible,

You can use Data::Dumper for this, too.  If the data is big, you won't
want to, but you can.

param('uglything') = Data::Dumper->Dump($uglything);
print hidden(-name=>'uglything');

(Untested code.)
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sat, 6 Nov 1999 13:30:58 -0500
From: "David Anderson" <david_anderson1@mindspring.com>
Subject: CONTENT TYPE
Message-Id: <801rvh$lno$1@nntp3.atl.mindspring.net>

I want to check an IP address before an html page loads and if
the IP matches, it bypasess the the login screen.

Here is the code:

#!/usr/bin/perl

print "Content-type: text/html\n\n";
$value = "$ENV{'REMOTE_ADDR'}";


if ($value = "165.247.44.140") {
   print "Location: http://www.foodexplorer.com/\n\n";
# else {
# exit();
}

# display the relevant CGI variables
#

The problem is that the code works fine but prints the
url instead of redirecting the user? How do I turn off
the Content-Type. Since I am using PHP, I'm forced
to use the Content-type line.

Any ideas would be greatly appreciated.

Thank you.





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

Date: Sat, 06 Nov 1999 13:49:34 -0500
From: "Nickolas E. A. Downey" <nead@neadwerx.com>
Subject: Re: CONTENT TYPE
Message-Id: <3824783E.5A84624F@neadwerx.com>

Personaly I would try to solve this .htaccess files, but that is purely
dependant on your needs.

#!/usr/bin/perl -w

use strict;
use CGI;

$cgi = new CGI;

if( $cgi->remote_host() eq '165.247.44.140' ) {
   print $cgi->redirect('special_url');
}
else {
   print $cgi->redirect('default_url');
}

> #!/usr/bin/perl
> 
> print "Content-type: text/html\n\n";
> $value = "$ENV{'REMOTE_ADDR'}";
> 
> if ($value = "165.247.44.140") {
>    print "Location: http://www.foodexplorer.com/\n\n";
> # else {
> # exit();
> }
> 
> # display the relevant CGI variables
> #


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

Date: Sat, 06 Nov 1999 19:52:36 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: CONTENT TYPE
Message-Id: <8G%U3.48735$23.1841083@typ11.nn.bcandid.com>

In article <801rvh$lno$1@nntp3.atl.mindspring.net>,
David Anderson <david_anderson1@mindspring.com> wrote:
>I want to check an IP address before an html page loads and if
>the IP matches, it bypasess the the login screen.

This is not, in general, a terribly secure method of authentication.

>#!/usr/bin/perl

No -w, no use strict.

>print "Content-type: text/html\n\n";

So you're printing out the content-type and the end of the header.
That means anything you print afterwards will be in the body.

>if ($value = "165.247.44.140") {

You're doing a numeric comparison there; any REMOTE_ADDR whose numeric
value is 165, such as "165.1.2.3" or "165 is not a prime number" will
match.  You'd know this if you were using -w.

>   print "Location: http://www.foodexplorer.com/\n\n";

Printed in the body, because you already printed the end of the header.

>The problem is that the code works fine 

for some definition of 'works fine'.

> but prints the
>url instead of redirecting the user?

Because it's in the body.

>How do I turn off the Content-Type. Since I am using PHP, I'm forced
>to use the Content-type line.

Don't print the Content-Type line or the blank line after it that
terminates the header if you're redirecting the user, whether or not
you're using PHP.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sat, 06 Nov 1999 13:26:34 -0800
From: mbudash@wcws.com (Michael Budash)
Subject: Re: CONTENT TYPE
Message-Id: <mbudash-0611991326340001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>

In article <801rvh$lno$1@nntp3.atl.mindspring.net>, "David Anderson"
<david_anderson1@mindspring.com> wrote:

> I want to check an IP address before an html page loads and if
> the IP matches, it bypasess the the login screen.
> 
> Here is the code:
> 
> #!/usr/bin/perl
> 
> print "Content-type: text/html\n\n";
> $value = "$ENV{'REMOTE_ADDR'}";
> 
> 
> if ($value = "165.247.44.140") {
>    print "Location: http://www.foodexplorer.com/\n\n";
> # else {
> # exit();
> }
> 
> # display the relevant CGI variables
> #
> 
> The problem is that the code works fine but prints the
> url instead of redirecting the user? How do I turn off
> the Content-Type. Since I am using PHP, I'm forced
> to use the Content-type line.
> 
> Any ideas would be greatly appreciated.
> 
> Thank you.

that sure doens't look like php to me...

this does, however:

<?
  if ($REMOTE_ADDR == "165.247.44.140") {
   header("Location: http://www.foodexplorer.com/");
  }
?>

hth-
-- 
Michael Budash ~~~~~~~~~~ mbudash@wcws.com


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

Date: Sat, 06 Nov 1999 21:41:53 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: CONTENT TYPE
Message-Id: <Bg1V3.48854$23.1857780@typ11.nn.bcandid.com>

In article <8G%U3.48735$23.1841083@typ11.nn.bcandid.com>,
Kragen Sitaker <kragen@dnaco.net> wrote:
>In article <801rvh$lno$1@nntp3.atl.mindspring.net>,
>David Anderson <david_anderson1@mindspring.com> wrote:
>>if ($value = "165.247.44.140") {
>
>You're doing a numeric comparison there; any REMOTE_ADDR whose numeric
>value is 165, such as "165.1.2.3" or "165 is not a prime number" will
>match.  You'd know this if you were using -w.

Um, duh.  You're not doing a comparison at all -- you're doing an
assignment.  This condition will set $value to "165.247.44.140" and
always evaluate to true.

== would be numeric comparison.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: 6 Nov 1999 20:25:09 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: CONTENT TYPE
Message-Id: <8022r5$boh$1@gellyfish.btinternet.com>

On Sat, 06 Nov 1999 19:52:36 GMT Kragen Sitaker wrote:
> In article <801rvh$lno$1@nntp3.atl.mindspring.net>,
> David Anderson <david_anderson1@mindspring.com> wrote:
> 
>>if ($value = "165.247.44.140") {
> 
> You're doing a numeric comparison there; any REMOTE_ADDR whose numeric
> value is 165, such as "165.1.2.3" or "165 is not a prime number" will
> match.  You'd know this if you were using -w.
> 

Its worse than that Jim - it appears that he is *assigning* that string
to $value - which will always be true.  I dont believe we are in the
presence of the true code here ...

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: Fri, 05 Nov 1999 11:47:01 -0600
From: Tom Turton <tturton@ntx.waymark.net>
Subject: Continuous "tail" into a buffer/array?
Message-Id: <38231815.6B6B63E2@ntx.waymark.net>

I don't feel I'm quite ready to handle sockets and other more advanced
topics yet, so if anyone has a simple (i.e. rookie) way to do this, I'd
appreciate hearing from you.  But, I'm not against learning the more
advanced way, but a simple pointer to the man pages on sockets won't
help me much; I've been to the books and manpages and am still lost.

What I want is the ability to monitor a constantly growing file and
grep it for strings.  I can do this in Unix with the command:

   /usr/xpg4/bin/tail -f -n -25 <filename> | grep <this_string>

But, I would like to run this command within a Perl script and send
the output to an array.  To further complicate, I'd like to kick off
a couple of these in parent-child processes and capture the data
AND be able to actively examine the array I'm capturing data in.

OK, so here is what I've tried which is definitely NOT working, but
will hopefully illustrate what I am trying to get at:

$infile = < the name of file I'm searching on >;

if ($pid = fork) {
   open (FBUF, "/usr/xpg4/bin/tail -f -n -25 $infile | grep \"this
string\" | ");
   do {
      sleep 5;
      @buffer_1 = (<FBUF>);
      print "@buffer_1\n";
   }
}elsif (defined $pid) {
   open (DBUF, "/usr/xpg4/bin/tail -f -n -25 $infile | grep \"that
string\" | ");
   do {
      sleep 5;
      @buffer_2 = (<DBUF>);
      print "@buffer_2\n";
   }
}


Any clues for clueless would be greatly appreciated!  Thank you


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

Date: Fri, 5 Nov 1999 11:08:37 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Continuous "tail" into a buffer/array?
Message-Id: <MPG.128ccb12fda3b4cc98a1c0@nntp.hpl.hp.com>

In article <38231815.6B6B63E2@ntx.waymark.net> on Fri, 05 Nov 1999 
11:47:01 -0600, Tom Turton <tturton@ntx.waymark.net> says...

 ...

> What I want is the ability to monitor a constantly growing file and
> grep it for strings.  I can do this in Unix with the command:
> 
>    /usr/xpg4/bin/tail -f -n -25 <filename> | grep <this_string>

 ...

> Any clues for clueless would be greatly appreciated!  Thank you

Perhaps this will help you.

perlfaq5: "How do I do a <CODE>tail -f</CODE> in perl?"

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


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

Date: Fri, 05 Nov 1999 14:49:13 -0600
From: Tom Turton <tturton@ntx.waymark.net>
Subject: Re: Continuous "tail" into a buffer/array?
Message-Id: <382342C9.B8177506@ntx.waymark.net>

Larry -

Thanks!  I obviously didn't check out the right manpages, and I feel
totally newbie-ish that the answer was right within my grasp (if I'd
only known where to look).  I had a sneaking suspicion there had to
be a simple answer.

---Tom

Larry Rosler wrote:
> 
> In article <38231815.6B6B63E2@ntx.waymark.net> on Fri, 05 Nov 1999
> 11:47:01 -0600, Tom Turton <tturton@ntx.waymark.net> says...
> 
> ...
> 
> > What I want is the ability to monitor a constantly growing file and
> > grep it for strings.  I can do this in Unix with the command:
> >
> >    /usr/xpg4/bin/tail -f -n -25 <filename> | grep <this_string>
> 
> ...
> 
> > Any clues for clueless would be greatly appreciated!  Thank you
> 
> Perhaps this will help you.
> 
> perlfaq5: "How do I do a <CODE>tail -f</CODE> in perl?"


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

Date: Mon, 08 Nov 1999 00:03:07 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Converting a perl .db file on BSDI to a .pag/.dir file on Solaris
Message-Id: <%qoV3.54839$23.2049640@typ11.nn.bcandid.com>

In article <7stu0m$m1o$1@nnrp1.deja.com>,  <phams@my-deja.com> wrote:
>Objective: Convert a .db file from a BSDI system created by perl 5.005_2
>with emumail(emumail.com) to a .pag/.dir file created on a Solaris
>system running same version of perl.

Is the .db file a Berkeley DB aka DB_File file?  Berkeley DB is
available for Solaris; see www.sleepycat.com.

>I have tried converting on both platforms without any luck. I can pull
>the data out from the original into a text file and import it into the
>other platform. That doesn't seem to work because the data is still
>ignored.

So you've put it in the dbm file on Solaris, you can see it's in the
dbm file, and it's still being ignored?  Maybe the keys and values are
in the wrong format.

>If it helps - Abercrombie Hat to anyone who can get me to the conclusion

No thanks.  I don't even know what it is, but I don't want it.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Tue Nov 02 1999
6 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Fri, 05 Nov 1999 14:24:31 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Copying files.
Message-Id: <3823591F.A5B007C7@mail.cor.epa.gov>

Jesús Iglesias wrote:
> 
> I'd like to do a Perl Script (executed in a W95 PC) to copy some files from
> an NT server to a W95 PC. I imagine it's a simple instruction, but I can't
> find the specific answer in the Web .

A better way is to search through the docs which come with
Perl when you install it on your own system.

Now then, if you're talking about copying over a local network,
you probably want to read about File::Copy [perldoc will do this
for you].  But if you're talking about FTPing a file, you'd
need to use the FTP protocol.  Try Net::FTP instead.  And if
you want yet another protocol, you'll want to look in CPAN
for an appropriate module.  There are a *lot* of different
protocols that you might want to be using.

> I'd also be very grateful if anyone could send me any Web Site with
> networking subjects in Perl.

Go to perl.com and use the search facility there.

Good luck,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 5 Nov 1999 20:26:01 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Copying files.
Message-Id: <7vvegp$8iq$1@gellyfish.btinternet.com>

On Fri, 5 Nov 1999 13:40:48 +0100 "Jesús Iglesias" wrote:
> I'd like to do a Perl Script (executed in a W95 PC) to copy some files from
> an NT server to a W95 PC. I imagine it's a simple instruction, but I can't
> find the specific answer in the Web .
> 

I would simply set up a share and do copy c:\blah f:\blah

> I'd also be very grateful if anyone could send me any Web Site with
> networking subjects in Perl.
> 

perldoc perlipc

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

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


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