[8518] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2134 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 19 11:18:46 1998

Date: Thu, 19 Mar 98 08:00:50 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 19 Mar 1998     Volume: 8 Number: 2134

Today's topics:
    Re: Are There Any Snazzy Perl Editors for Windows? (Andy Lester)
    Re: Assign lines of a text file into an array <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: Assign lines of a text file into an array (Andrew M. Langmead)
    Re: Assign lines of a text file into an array <merlyn@stonehenge.com>
        can't emulate -P <wangli@nortel.ca>
    Re: cpio in a perl script? (Jack Ostroff)
    Re: Fastest way to grep through a file? (Agent Hall)
        File Download Script <karent@iamerica.net>
    Re: Good Perl book (Tom Grydeland)
    Re: Help (Jason Gloudon)
    Re: Help (Jason Gloudon)
    Re: Help (Andrew M. Langmead)
        How do you create a directory? Please enlighten!? <mark@imp.net>
    Re: How to populate a 2D array from a file. (Kevin Reid)
    Re: Is there a "Newsgroup" for Newbies to Perl? <jbc@west.net>
    Re: Is there a way to dynamically link subroutines? <mrp@sanger.ac.uk>
        LVALUE <mrp@sanger.ac.uk>
    Re: LVALUE <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: Networking Problem ? Perl or Red Hat ? (Clinton Pierce)
        New version of the Angel Network Monitor available <paganini@paganini.net>
    Re: Newbie-Help with simplest CGI program <jbc@west.net>
    Re: NPH script problem on IIS <bowlin@sirius.com>
        oraperl ref books?? bpszenny@baynetworks.com
    Re: password protection for web site? (BobbyD)
    Re: password protection for web site? <flavell@mail.cern.ch>
    Re: password protection for web site? <marcs@znep.com>
        Please help with regexp problem <alan@consultancy-services.ferret.com>
    Re: Qui sera assez fort pour repondre a ca ?? (Lanning)
    Re: Redirect according to refferer <alan@consultancy-services.ferret.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 19 Mar 1998 15:39:34 GMT
From: petdance@maxx.mc.net (Andy Lester)
Subject: Re: Are There Any Snazzy Perl Editors for Windows?
Message-Id: <6ere7m$nst$1@usenet87.supernews.com>

: >I also love PFE. When using it with Perl, a handy thing is to tell

: Sounds good, where do we get it ?

I don't suppose you actually tried using a search engine to find "PFE",
didja?  Prob'ly not.

: NOTE - In order to discourage unsolicited e-mail, the address in the
: header may have .ferret added. Please remove this before replying.

So that would be alan@consultancy-services.com, right?  Got it.  Thanks.

xoxo, Andy

--
--
Andy Lester:        <andy@petdance.com>       http://tezcat.com/~andy/
Chicago Shows List: <shows@ChicagoMusic.com>  http://ChicagoMusic.com/



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

Date: 19 Mar 1998 14:03:41 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Assign lines of a text file into an array
Message-Id: <7xafam3k9e.fsf@beavis.vcpc.univie.ac.at>

Re: Assign lines of a text file into an array, C
<csml1@ukc.ac.uk> said:

C> Is it possible to assign each line of a text file into an
C> associative array where the key will be the line number
C> and the value will be a string variable containing the
C> whole line?

Yes.

But what has this got to do with perl per se?

Or maybe you have some perl code that doesn't do what you
want, and you'd like someone to look at it and tell you
what's wrong?

tony


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

Date: Thu, 19 Mar 1998 15:07:03 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Assign lines of a text file into an array
Message-Id: <Eq2nBr.JEn@world.std.com>

Eric Bohlman <ebohlman@netcom.com> writes:

>It's trivially easy once you remember that $. contains the line number 
>from the most recently read filehandle.  Here's one of many ways to do it:

>my %lines=map {$.,$_} <FILE>;

That doesn't work. Since map gives a list context, the entire
filehandle is read (and $. updated) before the lines are passed to
map. All the keys will be the same (the number of the last line.)
overwrite each other in the hash, and only the last line will remain.

You need to either use a scalar context for the filehandle, (so that
you can get the value of $. after that line has been read.) or forget
about $. and maintain your own counter.

$lines{$.} = $_ while <FILE>;

or 

$count =1 
%lines = map { $count++,$_ } <FILE>;
-- 
Andrew Langmead


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

Date: 19 Mar 1998 08:43:26 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Assign lines of a text file into an array
Message-Id: <8c1zvy3cv5.fsf@gadget.cscaper.com>

>>>>> "Eric" == Eric Bohlman <ebohlman@netcom.com> writes:

Eric> It's trivially easy once you remember that $. contains the line
Eric> number from the most recently read filehandle.  Here's one of
Eric> many ways to do it:

Eric> my %lines=map {$.,$_} <FILE>;

Uh, no.  The value used for $. there will be the value *after* the entire
file has been read.  You'll probably want something like this:

	my %lines = do {
		my @file = <FILE>;
		my $n = 0;
		map { ++$n, $_ } @file;
	};

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 166 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Thu, 19 Mar 1998 09:33:32 -0500
From: "Liming Wang" <wangli@nortel.ca>
Subject: can't emulate -P
Message-Id: <6eraes$3dd@nbdchc4.ca.nortel.com>

Here is the code:

#!/usr/bin/perl -P
#if 0
print "no show\n";
#endif
print "line\n";

When I do: perl comment1.p, I got the msg:
Can't emulate -P on #! line at comment1.p line 1.

I am using Perl 5.004_02 on NT (Sarathy's port).

TIA.





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

Date: 19 Mar 1998 14:08:33 GMT
From: jack_h_ostroff@groton.pfizer.com (Jack Ostroff)
To: "Keith Ford" <keford@ingr.com>
Subject: Re: cpio in a perl script?
Message-Id: <6er8t1$npa1@mascagni.pfizer.com>

In article <01bd52b3$8863afe0$35d38781@magic.b10.ingr.com>, "Keith Ford" <keford@ingr.com> writes:
> I am trying to get the following perl script to execute properly when
> invoked through a web server.  The two UNIX platforms I have tested on
> fail.  No error message in the log files.  The final "Done" is not printed.
>  The cpio file is opened but ends up with 0 size.  It works when run by
> hand, but not when invoked through HTTPD.
> 
> #!/usr/bin/perl
> 
> $ENV{'HOME'} = '/tmp';
> $ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin';
> $ENV{'SHELL'} = '/bin/ksh';
> 
> print "Content-type: text/html\n\n";
> print "<pre>\n";
> open(NEWPRODFILE,"| cpio -o -O test.cpio") || die ("open NEWPRODFILE\n");
> print NEWPRODFILE "test.pl\n";
> close(NEWPRODFILE);
> print "Done!\n";
> exit(0);
> 
> -- 
> -- Keith Ford, Micro Magic, 205-971-9711
> -- http://www.magicbbs.com
> 
There's a good chance it's a problem with file permissions.
Try using -w, use strict, and adding $! to the die.
Also add a die to the close (especially important for pipes)


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

Date: 19 Mar 1998 09:19:24 -0500
From: hallm4@cortez.sss.rpi.edu (Agent Hall)
Subject: Re: Fastest way to grep through a file?
Message-Id: <6er9hc$6fec@cortez.sss.rpi.edu>

>The biggest performance boost you could make is to stop perl from
>recompiling the regular expression each time. If the pattern doesn't
>change during the course of the program, take a look at the /o

That would probably help. :-) 

>But if you load huge amounts of data into memory, the OS is likely to
>page some of the data to disk (virtual memory) so that you are at disk

possibly, but since the system i'm on allows me to almost malloc() a gig,
i'm not too worried. <grins> that, and my data files max out at 26K, and
I only do one at a time..

[snipped explanation of perl's readline]

Ah, that explains a few things. I wasn't sure how Perl actually 'did'
(internally) the reading.

>One more point, have you evey noticed the Benchmark module that is
>included with perl? It is a great way of comparing the relative speeds
>of small program snippets. See the Benchmark man page for details.

I considered it, but since the perl port I work with has numerous things
left out and not working, I decided to bypass testing it out. I had
a few other things to do rather than play with code that may not work.
(I'm just a bit jaded because of all the _other_ things I've tried to
install and get working...)

I had a few spare minutes this morning, and I gave it a try. Imagine my
surprise when it actually worked. :-) 

Thanks to all for the suggestions!

Just another Perl newbie.




-- 
<HTML><META HTTP-EQUIV="Refresh"
CONTENT="8;URL=http://www.wankers.com"><BODY bgcolor="red"
text="black"><BLINK><STRONG><FONT SIZE=+7> <P>HTML is *BAD* in
Usenet!<P>Turn it off now!<P></STRONG></BLINK></BODY></HTML>


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

Date: Thu, 19 Mar 1998 08:47:33 -0600
From: Prairie View Academy <karent@iamerica.net>
Subject: File Download Script
Message-Id: <35113005.6C574CF9@imerica.net>

I am trying to write a script that when given an id number for a file,
it sends a location header to a web browser to download that file and
logs which file was sent.  Should I use an associative array to match
the files with the id numbers?  Please help a newbie with any ideas on
implmentation you have.  Thank you.

Trey Chandler
evelkomo@imerica.net
(that is supposed to read iamerica.net)



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

Date: 19 Mar 1998 15:54:20 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: Good Perl book
Message-Id: <slrn6h2ftc.l.Tom.Grydeland@mitra.phys.uit.no>

On 18 Mar 1998 18:41:32 GMT,
lvirden@cas.org <lvirden@cas.org> wrote:

> The reason I bring this up is that folk learning perl need to think about
> keeping some reference material handy as well.
> 
> Anyone written something similar to the perl reference 'card' for the
> CPAN library?

I've only downloaded Johan Vromans' Quick Reference Guide from CPAN a
few days ago.  Printed beautifully, camel and all.

Perhaps that's what you want?

> <URL:mailto:lvirden@cas.org> Quote: In heaven, there is no panic,

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: Thu, 19 Mar 1998 15:14:13 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Help
Message-Id: <slrn6h2dfk.iuk.jgloudon@manitoba.bbn.com>

In article <6eqf5m$jl9$1@agate.berkeley.edu>, Birjinder Singh Anant wrote:
>
>	Use of uninitialized value at ./split.pl line 10<BIRJ> chunk 1(-6)

It would have been nice to say which line was line 10. I don't trust my
counting to numbers this high.

>open (BIRJ, "/home/birjinder/public_html/birj_cgi/birj.txt");

what about :

open (BIRJ, "/home/birjinder/public_html/birj_cgi/birj.txt") 
   or die " Can't open so and so : $!";

If you're really parsing Text::CSV, the module availble via www.perl.com, by
that name has already solved your problem.

-- 
Jason Gloudon


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

Date: Thu, 19 Mar 1998 15:20:27 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Help
Message-Id: <slrn6h2dra.iuk.jgloudon@manitoba.bbn.com>

In article <6eqf5m$jl9$1@agate.berkeley.edu>, Birjinder Singh Anant wrote:
>
>                $char = getc();
>        }else {
>                $char = nextChar;
                        $nextChar ?
>                $nextChar = "";
>        }

-- 
Jason Gloudon


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

Date: Thu, 19 Mar 1998 15:30:52 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Help
Message-Id: <Eq2oFH.Es3@world.std.com>

bsanant@uclink.berkeley.edu (Birjinder Singh Anant) writes:


>while (<BIRJ>) {
> 
> 
>my(@records) = &splitLine($_);
[stuff deleted]
>#splitLine returns an array made from elements on the line
> 
> 
>sub splitLine {
> 
>my($field) = "";
>my($char) = "";
>my($nextChar) = "";
>my($j) = 0;
>my(@array);
>my($inQuote)=0;

You read a line in the while loop, and pass it to splitLine(), but
then in splitLine(), you ignore the arguments you pass (which will be
in the @_ array) and start reading the _next_ line with getc().

How about if you split the string into an array of single character
strings.

my @chars = split // shift; # (Hey a good perl poetry idea.)

and replace the calls to getc() with 

$char = shift @chars;

There is also at least one typo that "-w" or "use strict" would have
picked up.

Finally, are you sure the FAQ entry on parsing CSV data won't do what
you want.
-- 
Andrew Langmead


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

Date: Thu, 19 Mar 1998 10:28:14 -0500
From: "Mark Polakow" <mark@imp.net>
Subject: How do you create a directory? Please enlighten!?
Message-Id: <6erdss$qhe$1@viper.america.net>

Ok. be gentle, Im a begginner programmer. I am working on a web-based file
management program and I have it doing everything but i don't know the code
or method for creating directories? I know about unlink and rmdir can
someone please send me a snippet of code that deletes a directory or
otherwise, and in real simple words, point me in the direction... Thank you
very much in advance!




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

Date: Thu, 19 Mar 1998 09:30:15 -0500
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: How to populate a 2D array from a file.
Message-Id: <1d63meh.8hsjzd2o9veoN@slip166-72-108-84.ny.us.ibm.net>

> >But wouldn't it be faster to use unshift?
> 
> I sure hope not! Perl uses arrays, as far as I know (as opposed to linked
> lists), and keeps explicit track of their length; hence push should be
> quicker. Lessee:

Oops. My mistake. I had push and shift backwards.

-- 
  Kevin Reid.      |         Macintosh.
   "I'm me."       |      Think different.


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

Date: Thu, 19 Mar 1998 06:53:56 -0800
From: John Callender <jbc@west.net>
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <35113184.D804164E@west.net>

I R A Aggie wrote:
> 
> In article <35100503.433D1225@scn.org>, Beeb <alleycat@scn.org> wrote:
> 
> +Since most newbies are using it for CGI,
> what is
> + really needed is a SHORT online tutorial that EXPLICITLY, without
> + assuming Perl familiarity, goes thruough the basics of using Perl to
> + write a simple CGI script.
> 
> Those sorts of folks really shouldn't a) be writing CGI applications,
> and b) using perl to do it.
> 
> Perl will cheerfully hand them enough rope to hang themselves, and
> there
> are plenty of individuals who would be willing to exploit weaknesses
> in CGI scripts to use and abuse systems.

All the more reason. As with the release of tools like CBW or Satan, you
can't put the genie back into the bottle just by squeezing your eyes
shut and wishing really hard. These people are out there, for good or
evil. They're being asked to do this CGI stuff that they barely
understand, Perl is easy enough to "give them enough rope," and they're
going to do this with or without the help of people who think it's
lamentable that they're doing it. Until enough of them get educated to
the risks of bad code, they'll be churning out bad code (AND insulting
the sensibilities of traditionalists in this group by posting the same
silly questions over and over and over).

So some beginner-oriented resources (preferably, resources that don't
impugn their intelligence by calling them "idiots") would probably be a
good idea. For an investment of a small fraction of the effort currently
going into the game of "see how clever I can be in devising newbie
put-downs," some very useful resources could be created.

--
John Callender
jbc@west.net
http://www.west.net/~jbc/


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

Date: Thu, 19 Mar 1998 15:00:26 +0000
From: Matthew Pocock <mrp@sanger.ac.uk>
Subject: Re: Is there a way to dynamically link subroutines?
Message-Id: <35113309.1C2F5EFB@sanger.ac.uk>

I don't know if this helps, but you can say 'require $var', where $var
contains a file name, so this removes the file coppying. Also, if the
required file contains the data within a subrutine, the subrutine will not
be executed untill you ask it to be. Alternatively, you could have the
functions in the file but not in a subroutine, in which case they will be
evaluated as the file is loaded by require. Lastly, if for any reason you
needed to swap over the data file during run time, the function version
will fall over, complaining that the function is already defined, but the
statements outside of a function will not.

Hope that helps

matthew

Gene A Brock wrote:

> I am working on a program that loads in many Perl variables, and it
> would be great if I could include the data as a subroutine after
> saving it in Perl syntax.  The problem is, I don't know the name of
> the file to require beforehand.  I must ask the user, then load his
> /her data.  So initially, I included a set temporary file, then copied
> the file that the user requested to that temporary file, and tried
> to require the copied file as a subroutine.  It compiles, but I always
> get a run-time error "<STDIN> chunk 3."  Is there any way to dynamically
> change code during run-time?  If anyone could answer my question, I
> would greatly appreciate it.
>
> Gene Brock
> gbrock@email.sjsu.edu



--
 Jack: Yes, but you said yourself that a severe chill was not hereditary.
 Algernon: It usen't to be, I know, but I daresay it is now. Science is
always making wonderful improvements in things.
                      Oscar Wilde.  The Importance of Being Earnest (2.5)





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

Date: Thu, 19 Mar 1998 14:39:35 +0000
From: Matthew Pocock <mrp@sanger.ac.uk>
Subject: LVALUE
Message-Id: <35112E26.A96D5A0D@sanger.ac.uk>

Does anybody know how to write a function that returns an lvalue? It
would be used like this:

sub myFunc {
    ...
    return $var;
}

and

 myFunc() = 42;

The idea being to assign 42 to whatever myFunc returns. Then you could
have objects that behave like this:

 $obj->i = 10; # set member i of obj to 10

Matthew

--
 Jack: Yes, but you said yourself that a severe chill was not hereditary.
 Algernon: It usen't to be, I know, but I daresay it is now. Science is
always making wonderful improvements in things.
                      Oscar Wilde.  The Importance of Being Earnest (2.5)





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

Date: 19 Mar 1998 16:42:31 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: LVALUE
Message-Id: <7x90q63cwo.fsf@beavis.vcpc.univie.ac.at>

Re: LVALUE, Matthew <mrp@sanger.ac.uk> said:

Matthew> The idea being to assign 42 to whatever myFunc
Matthew> returns. Then you could have objects that behave
Matthew> like this:

Matthew>  $obj->i = 10; # set member i of obj to 10

I think you might be confusing methods with hash keys?

But you already can do this:

sub i {
    my ($self, $val) = @_;
    return $self->{i} if ! defined $val;
    $self->{i} = $val;
    $val;
}

then

$obj->i      returns the current value of $obj->{i}
$obj->i(42)  sets $obj->{i} to 42

Is that what you want to do?

-- 
Tony Curtis, Systems Manager, VCPC,      | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/

"Everything I am, I learned on the back of cereal boxes" ~ RJ, "Over the Hedge"


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

Date: 19 Mar 1998 15:02:23 GMT
From: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
To: michaely@alphanet.net.au
Subject: Re: Networking Problem ? Perl or Red Hat ?
Message-Id: <6erc1v$mcu1@eccws1.dearborn.ford.com>

In article <6epkv3$2gr$1@nnrp1.dejanews.com>,
	michaely@alphanet.net.au writes:
>Sorry for disturbing you !
>
>One our our Client/Server applications was written on Perl 5.003 and
>were running on RHS (Red Hat Linux Server)4.1 and 4.2 happily.
>
>On updating one our servers to RHS 5.0 the Server part of the system
>refused to answer to any client calls. Event to a client on the same
>m/c; but the client on the RHS 5.0  can calls to Servers on RHS 4.1 and
>4.2 without problems.
>
>Could this be a Perl problem or RHS problem (ie. new security on opening
>
>IP ports?).
>
>The modules that I am using is the SOcket, FileHandle ! So is there any
>difference of  these two modules between version 5.003 and version
>5.004_01 ?
>
>Your kind advise and relay of this to appropiate personal is very much
>apprecaited!!

First of all, some code would have been nice to look at.  Software is 
easier to debug when there's software to debug.

List of Things You Need To Look At:

1. Is the Server code written correctly?  Did you check all of the exit
   statuses from all of the socket-setup calls?  Really? socket, bind,
   listen, accept, etc...can all fail for a myriad of reasons.  Also,
   remember, fork() fails too.

2. Is your server listening correctly?  Look at the output from "netstat"
   and see if your server is listening.

3. Is SOMEONE ELSE already listening on the port?  Check out /etc/services
   or /etc/inetd.conf (or whatever-the-hell RH Linux uses...)

4. Are your clients working OK?

5. Can you connect to the server in other ways?  (telnet, etc...) Is your
   net working?  DNS lookups, Routing, etc... can all cause headaches.

6. Have you tried something silly like using a small program from the Camel
   or a sample that came with the module to see if ANYTHING works?

7. If you used Socket and Filehandle, you ARE going directly through the
   module interfaces to setup the sockets aren't you?  You're not trying
   to setup stuff on the side, are ya?

8. If this is TCP, try telnetting to the port on the server where the
   server process is listening.  Do you get a "Connection Refused"?  Then
   probably nobody's listing on the port (or it's TCP-Wrapped somehow).
   Do you get a connection?  (That's good, check for a buggy server) 
   Does it just never connect?  (Check your networking.)

Try a few of these things.   This has, for me, found 90% of my networking
problems.

-- 
+------------------------------------------------------------------------+
|  Clinton A. Pierce    |   "If you rush a Miracle Man,   | http://www.  |
|  cpierce1@ford.com    |     you get rotten miracles"    | dcicorp.com/ |
| fubar@ameritech.net   |--Miracle Max, The Princess Bride| ~clintp      |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*



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

Date: Thu, 19 Mar 1998 08:15:03 -0600
From: Marco Paganini <paganini@paganini.net>
Subject: New version of the Angel Network Monitor available
Message-Id: <6er95f$98t$1@nnrp1.dejanews.com>

I've just finished a new version of The Angel Network Monitor.

This new beta 0.6 fixes some bugs that caused a Segmentation
Fault in some circumstances.

The Angel Network monitor is a perl program that can be used
to monitor various aspects of your hosts. You can monitor
disk space, disk load, check tcp ports etc. Everything is
reported in an HTML table with optional javascript alerts
and java banners.

The program (and documentation) can be found at:
http://www.paganini.net/angel

Thanks for your attention
Paga

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Thu, 19 Mar 1998 06:44:53 -0800
From: John Callender <jbc@west.net>
To: Doug Evans <doug@ccinet.com>
Subject: Re: Newbie-Help with simplest CGI program
Message-Id: <35112F65.5864F004@west.net>

Doug Evans wrote:
> 
> I got an error, from both, that says, "Can't find string terminator
> "End_of_Multiline_Text" anywhere before EOF at C:\PERL\bin\howdy.pl
> line 2.

This sounds to me like your not properly terminating a HERE-document (or
whatever you call it) quoted string. I've run into this before when I
did things like having an errant space or tab either before or after the
string-terminating copy. For example:

$foo =<<End_of_Multiline_Text;
stuff
more stuff
still more stuff, all of which goes in /$foo.
End_of_Multiline_Text

The last line above must consist *exactly* of "End_of_Multiline_Text".
Any variations, such as "	End_of_Multiline_Text" (leading tab) or
"End_of_Multiline_Text " (trailing space) will give the error message
you described. You'll also get it with any capitalization errors, e.g.,
"End_Of_Multiline_Text" (big "Oh").

Hope that helps.

--
John Callender
jbc@west.net
http://www.west.net/~jbc/


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

Date: Thu, 19 Mar 1998 07:12:20 -0800
From: Jim Bowlin <bowlin@sirius.com>
To: perlguy@technologist.com
Subject: Re: NPH script problem on IIS
Message-Id: <351135D4.AE9E5207@sirius.com>

I have this working with CGI.pm under IIS3.  
There is a NPH demo program that comes with the CGI.pm module.

HTH -- Jim Bowlin

Brent Michalski wrote:
> 
> Hi,
> 
> I am trying to get a script to send output to the users browser without
> buffering it.
> 
> I have tried the following but it always buffers the output until the
> script is done...
> 
> 1)  Used the CGI.pm (:nph) and CGI->nph(1) calls.
> 
> 2)  Flushed buffer after every write with $|=1
> 
> 3)  Named file nph-filename.cgi (Uses Perl.exe)
>   - Note:  When I do this, my browser opens a window so "Save As" or
> "Open" the file.  If I Open it, the output is sent to Notepad.
> 
> 4)  Tried using PerlIS  (Get socket error)
> 
> All I want to do is process data in a while loop, and each time through
> the loop, let the user know what has happened so far.
> 
> "SHOULD" be a simple task.
> 
> Thanks in advance,
> 
> Brent Michalski


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

Date: Thu, 19 Mar 1998 09:00:05 -0600
From: bpszenny@baynetworks.com
Subject: oraperl ref books??
Message-Id: <6erbpt$bl4$1@nnrp1.dejanews.com>

Hello,

Does anyone know of a good referance book on oraperl?

Thanks.

bpszenny@baynetworks.com

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 19 Mar 1998 14:27:51 GMT
From: lilbit@tribeca.com (BobbyD)
Subject: Re: password protection for web site?
Message-Id: <6era17$fmu@news.inforamp.net>

In article <350FCC1B.B6E27B36@west-server.com>, Richard.Walker@west-server.com says...
>
>> How doe I go about making my web site password protected? - and indeed
>> does it work??
>
>Do you know what software is running on the web server?  The methods vary
>greatly based on this detail...
>
>>  Cann't anyone just get to a page "beyond" the password protected
>> page???
>
>If you do it right, then the whole directory and all subdirs will be
>protected.

Is it possible when a directory is password protected to exempt a
specific .html page?  I'm pretty sure I've seen it done on a site
but maybe the file was in another directory that wasn't protected.
Tell me more about this REFERER method of keeping people away from
a page u don't want them to see unless from one specific link.

Thanks



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

Date: Thu, 19 Mar 1998 15:23:55 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: password protection for web site?
Message-Id: <Pine.A41.3.95a.980319152133.42820A-100000@rsplus02.cern.ch>


f'ups narrowed...

On 19 Mar 1998, BobbyD wrote:

> >Do you know what software is running on the web server?  The methods vary
> >greatly based on this detail...
 ..
> Is it possible when a directory is password protected to exempt a
> specific .html page? 

Yes.  You quoted this:

> >Do you know what software is running on the web server?  The methods vary
> >greatly based on this detail...

I suggest you read it, too.




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

Date: 19 Mar 1998 14:56:26 GMT
From: Marc Slemko <marcs@znep.com>
Subject: Re: password protection for web site?
Message-Id: <6erbmq$n8s$1@scanner.worldgate.com>

In <6era17$fmu@news.inforamp.net> lilbit@tribeca.com (BobbyD) writes:

>In article <350FCC1B.B6E27B36@west-server.com>, Richard.Walker@west-server.com says...
>>
>>> How doe I go about making my web site password protected? - and indeed
>>> does it work??
>>
>>Do you know what software is running on the web server?  The methods vary
>>greatly based on this detail...
>>
>>>  Cann't anyone just get to a page "beyond" the password protected
>>> page???
>>
>>If you do it right, then the whole directory and all subdirs will be
>>protected.

>Is it possible when a directory is password protected to exempt a
>specific .html page?  I'm pretty sure I've seen it done on a site

Sure, but it would depend on what web server you are using.



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

Date: Thu, 19 Mar 1998 11:08:12 +0000
From: Alan Silver <alan@consultancy-services.ferret.com>
Subject: Please help with regexp problem
Message-Id: <$IlbRNAcyPE1Ew6p@consultancy-services.com>

Hello,

I have been battling my way through Learning Perl and have vaguely got
the hang of regular expressions. I am faced with a problem that I can
only partly solve and was hoping that a regexp guru might be able to
help.

Suppose I am reading an HTML file from stdin and I want to convert all
image references to be absolute (ie so that they end up being of the
form href="http://www.ferret.com/furry/gibbon/gerbil.gif"). I have
written the following bit of code (below) that will convert any
references of the form href="/furry/gibbon/gerbil.gif", but am now stuck
with how to do the next step.

It seems that I need to be able to tell when a image reference does not
start with an "http://" and does not start with a "/". In this case, I
need to insert the host, domain and path which I have previously found.

Anyway, code so far is ...

$host="http://www.ferret.com";
$path="/furry/gibbon";

while (<>) {
  s@(src|SRC)=\"(/.*)\"@$1=\"$host$2\"@ig;
}

Now, by the time the substitution above has taken place, all references
will be either full (ie start with "http://etc") or will be relative (ie
don't start with http or /). How do I tell ?

Please explain what your regexp does as I would like to understand them
(as well as have code that works).

Thanx in advance,

Alan

NOTE - In order to discourage unsolicited e-mail, the address in the
header may have .ferret added. Please remove this before replying.

-- 

Sent By   : Alan Silver 
Fish Page : http://www.geocities.com/Heartland/Hills/6749/fishtank.html

It's not an optical illusion, it just looks like one


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

Date: 19 Mar 1998 14:01:22 GMT
From: slanning@buphy.bu.edu (Lanning)
Subject: Re: Qui sera assez fort pour repondre a ca ??
Message-Id: <6er8fi$ace$1@news1.bu.edu>

Tom Christiansen (tchrist@mox.perl.com) wrote:
: Ocurre que lo que buscas si trova nel famosmsimo FAQ di Perl, lo 
: cual viene incluido mjme con il tuo propio sistema de Perl.

: vez existen grupos dans lesquels se suele piy auf franzvsisch 
: schrieben, such as perchance fr.comp.lang.perl, n'est-ce pas?

Was ist das, "metasarcasm"? No, quizas que sera sarcasm about
sarcasm. Como describir sarcasm on many levels and en muchas
lenguas? I call it hilarious...

-- Lanning


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

Date: Thu, 19 Mar 1998 11:27:01 +0000
From: Alan Silver <alan@consultancy-services.ferret.com>
Subject: Re: Redirect according to refferer
Message-Id: <MHTnyYAFEQE1EwNg@consultancy-services.com>

Peter <delphiask@sale-net.com.au> wrote ...
>Hi all.
>
>I need a script that I can run on my server that redirects a user to
>another web page depending on who the refferer is.
>
>I have a web page mirrored around the world on different servers. The
>Perl script needs to be on my system. On the web page is an icon
>saying whatever but something like "The web page host is here". Lets
>say this is on www.somewhere.com/page.htm
>
>If a user clicks on this link, it calls the Perl script on my server.
>It reads a text file looking for the above refferer and when it finds
>it it than redirects the browser to thier homepage. If no refferer is
>found or the info is not sent, then it sends them to a default page.
>
>Can anyone tell me where I might find such a script or would anyone be
>interested in writing one for me for a price or exchange?
>
>Many thanks, Peter May.
>Please CC: to delphiask@sale-net.com.au as news is very slow.

Firstly, this is a CGI question, not a Perl question. You can do it in
just about any language.

What you need to do is send back a Location: header with the URL of the
page where you want to send them. Let's say you kept your list of URLs
in %url :-

# assume $refurl is the referring URL
$newurl = $url{$refurl;}      # so $newurl is where they want to go
if ($newurl eq "") {$newurl=$defaulturl;}
print "Location: $newurl\n\n";

You will need to check the exact syntax of the Location header. Any CGI
book will tell you this, or head over to the CGI newsgroup and have a
look at their FAQ.

Hope this helps,

Alan


NOTE - In order to discourage unsolicited e-mail, the address in the
header may have .ferret added. Please remove this before replying.

-- 

Sent By   : Alan Silver 
Fish Page : http://www.geocities.com/Heartland/Hills/6749/fishtank.html

It's not an optical illusion, it just looks like one


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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 2134
**************************************

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