[15827] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3240 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 2 21:05:23 2000

Date: Fri, 2 Jun 2000 18:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <959994310-v9-i3240@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 2 Jun 2000     Volume: 9 Number: 3240

Today's topics:
    Re: @INC Assistance mcnuttj@missouri.edu
    Re: C to perl? <tcuffel@exactis.com>
    Re: Can't seem to find the Form post data mcnuttj@missouri.edu
    Re: Can't seem to find the Form post data <tony_curtis32@yahoo.com>
    Re: Case-Insensitive String Comparison <herr_stumpfenstiel@lycosmail.com>
    Re: CGI-scripts <gellyfish@gellyfish.com>
    Re: Cookies stopped working w/Perl 5.6 (jason)
    Re: Disk requirements for installing PERL5 on UNIX? <gellyfish@gellyfish.com>
    Re: END{} alternative? (jason)
    Re: Installation of Perl5004_05 <gellyfish@gellyfish.com>
    Re: Is Perl for me? <gellyfish@gellyfish.com>
    Re: making the source unreadable <chris.strombergerNOchSPAM@wnco.com.invalid>
    Re: my Foo $self = shift; (Kai Henningsen)
        Newbie needs help..... fenderstratocaster@my-deja.com
    Re: Newbie needs help..... <lr@hpl.hp.com>
    Re: Newbie needs help..... (jason)
    Re: Newbie <gellyfish@gellyfish.com>
    Re: NT & Sockets <red_orc@my-deja.com>
    Re: NT & Sockets (Clinton A. Pierce)
    Re: Perl unusable as a programming language <epa98@doc.ic.ac.uk>
        relative paths to modules / libraries <sean77@dds.nl>
    Re: relative paths to modules / libraries (David Efflandt)
        Should I submit a patch to perlsyn? (John Harden Borwick)
        System Call Error - Data Area Too Small - Win NT 9jerry9@my-deja.com
    Re: webget failure (David Efflandt)
    Re: Why is while inside a while so slow <gellyfish@gellyfish.com>
    Re: Why is while inside a while so slow <rrauer@mitre.org>
    Re: Will flock(...) wait? <gellyfish@gellyfish.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 2 Jun 2000 22:47:48 GMT
From: mcnuttj@missouri.edu
Subject: Re: @INC Assistance
Message-Id: <8h9dik$gql$1@dipsy.missouri.edu>

In your perl script, before your "use blah.pm" you need:

use lib 'c:\perl\lib';

That will add "c:\perl\lib" to @INC.

--J

spurcell <skpurcell@hotmail.com> wrote:
: Hello,
: My Perl physically lives at c:\perl
: And the lib is at c:\perl\lib

: Anyway, I am getting an error when I run a perl script that says it cannot
: find my GDBM_File at:
: Here is the error:
: Can't locate GDBM_File.pm in @INC (@INC contains: C:/usr/bin/Perl/lib
: C:/Perl/site/lib .) at D:\gdbm.pl line 6

: Anyway, my perl used to live there years ago, but it does not physically
: live at c:/Perl.

: I went to my control panel, system, environment, and have double checked my
: path variable. It says C:\Perl;C:\Perl\lib

: So does anyone know what I am doing wrong? Do I need to change another
: variable elsewhere to get the @INC to understand where my real perl lives?

: Thanks
: Scott




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

Date: Fri, 2 Jun 2000 16:18:08 -0500
From: "Tim" <tcuffel@exactis.com>
Subject: Re: C to perl?
Message-Id: <c8WZ4.5338$Rx.552224@den-news1.rmi.net>


Jürgen Exner wrote in message <39358f97@news.microsoft.com>...
>"brian d foy" <brian@smithrenaud.com> wrote in message
>news:brian-ya02408000R3105001649120001@news.panix.com...
>> In article <39356C66.DDC60593@none.com>, Michel <nobody@none.com> posted:
>>
>> > Can anyone tell me how to translate a C program to perl? Or where can I
>> > get c2perl?
>>
>> there are things that you can do in C that you can't do in Perl.
>[...]
>
>That's not right.
>Perl and C are both Turing languages, therefore you can do exactly the same
>things in both languages (or pretty much in any programming language).


There seem to be some confusion about Church's Thesis, so here it is:

    Any physical computing device can be simulated by a Turing machine
    in a number of steps polynomial in the resources used by the computing
    device.

It is commonly taken to mean anything you can do in one language you can
do in another.  This is true, but only in a limited sense of "anything you
can do".

All Turing machines care about is input and output.  So what Church's
Thesis really means is for any program in one language, it is possible
to produce a program in a different language that produces the same
output for any given input.

So the posts about allocating memory, taking addresses, or writing device
drivers are missing the point.  Church's Thesis is not about language
features or suitability to a given purpose...it only means for any given
C program, there exists a Perl program that can change input into output
in the same way.

-T





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

Date: 2 Jun 2000 23:04:45 GMT
From: mcnuttj@missouri.edu
Subject: Re: Can't seem to find the Form post data
Message-Id: <8h9eid$jde$1@dipsy.missouri.edu>

Personally, I just rewrote these functions myself, mostly because for
something this (relatively) simple, I wanted to know exactly what was
going on, and the perl code I saw to do this seemed obfuscated to me.

Anyway, here's what I did.  Works only for POST.  GET will fail:

#### BEGIN CODE SNIPPET ####
for ( my $x=0 ; $x < $ENV{CONTENT_LENGTH} ; $x++ ) ;

	# Get the input from STDIN, which is how POST works.
	$char = getc;

	# '+' equals ' ' in POST.
	if ( $char eq '+' ) $char = ' ';

	# '%' denotes metacharacters.  Translate them into ASCII.
	if ( $char eq '%' ) {
		$char = (getc).(getc);
		$char = chr(hex($char));
		# Don't forget to increment your counter.
		$x=$x+2;
	}

	# Accumulate the adjusted character list.
	$inputscalar .= $char;
}

# Split the input up into name/value pairs.
@inputlist = split /&/, $inputscalar;

# Now split up the pairs and store the data in %input.
foreach $pair ( @inputlist ) {
	($key, $value) = split /=/, $pair;
	$input{$key} = $value;
}
#### END CODE SNIPPET ####

Now all your input variables, whatever they are can be accessed as 'keys
%input'.  They're values are 'values %input' or just $input{$key}.  All
metacharacters (that I know about) have been converted to what the user
actually typed.

If anybody can see anything obviously ugly about this code, let me know.
I'm using this exact stuff in production on one of my servers.  It seems
to work for the different types of input I use, but I may have missed
something.

I recommend using local variables in some cases above so things like $x,
$char, $value, $pair don't clutter up your namespace.  In my case, this is
all in a fairly short module, so I don't have that problem.  :-)

Hope that helps!

--J

Makarand Kulkarni <makarand_kulkarni@my-deja.com> wrote:
:>
:> where does the posted information hide?

: Read the CGI faq.




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

Date: 02 Jun 2000 18:20:46 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Can't seem to find the Form post data
Message-Id: <87og5j1xgx.fsf@limey.hpcc.uh.edu>

>> On 2 Jun 2000 23:04:45 GMT,
>> mcnuttj@missouri.edu said:

> for ( my $x=0 ; $x < $ENV{CONTENT_LENGTH} ; $x++ ) ;

How big is CONTENT_LENGTH?  This approach is a well-known
hole.  Also, parsing char-by-char is how you'd do it in C,
perl has lots of string goodies which makes life easier.

> If anybody can see anything obviously ugly about this
> code, let me know.  I'm using this exact stuff in
> production on one of my servers.  It seems to work for
> the different types of input I use, but I may have
> missed something.

Use the CGI module, it does all of this (properly) and is
standard with perl distributions.  Let Lincoln take the
strain :-)

One line in all your programs, works for all <form>
methods.

    use CGI qw(:standard);   # or whatever options...

hth
t


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

Date: Sat, 3 Jun 2000 01:06:13 +0200
From: "Herr Stumpfenstiel" <herr_stumpfenstiel@lycosmail.com>
Subject: Re: Case-Insensitive String Comparison
Message-Id: <8h9ehi$cdq73@mx2.hrz.uni-essen.de>

"Tad McClellan" <tadmc@metronet.com> schrieb im Newsbeitrag
news:slrn8jfml0.qb.tadmc@maxim.metronet.com...>
>
> You could use (even when there _are_ metacharacters):
>
>    $var1 =~ /\Q$var2/i;   # or, $var2 = quotemeta($var2); before this stmt
>
>
Seems as if I've just learned something :-) Thanks!




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

Date: 2 Jun 2000 23:45:26 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: CGI-scripts
Message-Id: <8h9de6$o0j$1@orpheus.gellyfish.com>

In comp.lang.perl.misc Peter L. Berghold <peter@lberghold.net> wrote:
> In article <01bf8912$9e07ef40$0100007f@alexey>, "Alexey Dibrivniy" <alexey@selena.kherson.ua> wrote:
> 
>> Please, who knows how to make a downloads counter (or even usual visits or
>> clicks counter) script in Perl, send me a sample. And are there any
>> programs for debugging scripts ?
>> 
>> Thank you very much for your help.
> 
> Try doing a web search on "counter scripts" or "Matts Free Script"
> and you'll run into l loads of them free for the downloading.

I'm not entirely convinced that'll be much help but hey ...

/J\
-- 
If something goes wrong at the plant, blame the guy who can't speak
English.
-- 
fortune oscar homer


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

Date: Sat, 03 Jun 2000 00:33:33 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Cookies stopped working w/Perl 5.6
Message-Id: <MPG.13a2ef7ee2ca03e2989706@news>

[ item posted to comp.lang.perl.misc and CCed to Eric M. Winslow ]

Eric M. Winslow writes ..
>"jason" <elephant@squirrelgroup.com> wrote in message
>news:MPG.13a235f1a9b8ba27989700@news...
>> ericwinslow@yahoo.com writes ..
>> >print $r->header('cookie'=>$shit);
>>                   ^^
>> something's missing here
>>
>>   perldoc CGI::Cookie
>
>If I'm not mistaken, CGI.pm has the cookie functions within it. No need to
>call in CGI::Cookie. And if this were the case it shouldn't be working under
>5.005 as it is.

you misunderstood .. the thing that was missing was not the perldoc line 
(which you would no doubt have discovered had you tried it)

the thing that's missing is indicated above with the carets .. you will 
find out what it is by reading the documentation for the CGI::Cookie 
module .. you will see the documentation for that module by issuing the

  perldoc CGI::Cookie

command at a command prompt on a system with Perl installed

and - *IF* it is working under 5.005 then it was a bug - which has now 
been fixed (you should NOT go by whether it works or not - but by 
whether it matches the documentation or not)

-- 
 jason - elephant@squirrelgroup.com -


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

Date: 2 Jun 2000 23:23:17 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Disk requirements for installing PERL5 on UNIX?
Message-Id: <8h9c4l$jom$1@orpheus.gellyfish.com>

[ comp.lang.perl doesnt exist ]

In comp.lang.perl.misc Rusty Williamson <rwilliamson@uno.gers.com> wrote:
> Hi!
> 
> I've looked and looked and can not find how much disk space is required to
> install the latest stable version of PERL on UNIX.  Has anyone seen this
> posted anywhere or know what I'll need?

You can find this from the perlhist manpage which lists the sizes of
most distributions.  The 5.6.0 distribution directory takes up 36118528
bytes after building perl on my system - I would guess that you might
want to allow a little under twice that for diskspace.

/J\
-- 
Well, I can tell the difference between butter and 'I can't believe it's
not butter'.
-- 
fortune oscar homer


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

Date: Sat, 03 Jun 2000 00:56:00 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: END{} alternative?
Message-Id: <MPG.13a2f4ca5895c2c9989707@news>

Hemant Shah writes ..
>  I would like to create a lock directory so that only one instance of my 
>  program runs at time. I would like to automatically remove the lock file
>  when program exits normally or is interupted via <Ctrl>-C or other signals.

there are better ways of doing locking .. try

  perldoc -f flock

>When I start the first instance, the lock directory is created. While first
>instance is running if I start second instance, the program exits with error
>message, but the lock directory is deleted.
>
>The end block is not yet called, why does it delete the lock directory?

as you asked it to be .. from the perltoot documentation

  perldoc perltoot

"This works just like the END function in traditional modules, meaning 
that it gets called whenever your program exits unless it execs or dies 
of an uncaught signal."

ie. the END sub gets called when you do an exit()

>If I interrupt the program with <CTRL>-C, the lock directory is not deleted.

because (unless you've left out some important part of your code) it's 
an uncaught signal .. sounds exactly in line with the documentation

>I am looking for something like a trap statement in Korn shell or an atexit()
>function in C.

check out Signals in

  perldoc perlipc

what you really want is just to have the unlocking be the last statement 
in your normal program flow (not in a special END sub)

-- 
 jason - elephant@squirrelgroup.com -


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

Date: 2 Jun 2000 23:14:41 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Installation of Perl5004_05
Message-Id: <8h9bkh$i30$1@orpheus.gellyfish.com>

On Fri, 2 Jun 2000 14:11:44 +0800 Andrew Lam Tug Wye wrote:
> Hi,
> 
> I was trying to install perl5004_05 and had followed the instructions. I
> have the following message when I do a 'make' .
> I have installed gcc as my compiler and had set a path for it. The following
> is the error message. Will appreciate any help or advise.
> 
> 
> 'sh cflags libperl.a miniperlmain.o' miniperlmain.c
>     CCMD=gcc -DPERL_CORE -c -I/usr/local/include -O
> sh: gcc: not found
> *** Error code 1
> make: Fatal error: Command failed for target 'miniperlmain.o'
> 

Er.  You havent got a compiler in your path - believe me.

/J\
-- 
Well, let's just call them, uh, Mr. X and Mrs. Y. So anyway, Mr.X would
say, 'Marge, if this doesn't get your motor running, my name isn't Homer
J. Simpson.'
-- 
fortune oscar homer


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

Date: 2 Jun 2000 23:43:20 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Is Perl for me?
Message-Id: <8h9da8$nj5$1@orpheus.gellyfish.com>

On 31 May 2000 00:14:26 GMT Abigail wrote:
> On Tue, 30 May 2000 04:46:56 -0700,
> Garbage <peterhardingNOpeSPAM@yahoo.com.invalid> wrote:
> 
> ++ 3. Is it in great demand by ISP's?
> 
> Not at all. ISPs just need bobs to support windows users.
> 

Well, I *work* for an ISP and I feel like *I'm* in great demand but
that could be for a multitude of reasons. 

/J\
-- 
''To Start Press Any Key''. Where's the ANY key? I see Esk, Catarl ,
and Pig-Up. There doesn't seem to be any ANY key. Woo! All this computer
hacking is making me thirsty. I think I'll order a TAB.
-- 
fortune oscar homer


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

Date: Fri, 02 Jun 2000 15:06:35 -0700
From: cstromberger <chris.strombergerNOchSPAM@wnco.com.invalid>
Subject: Re: making the source unreadable
Message-Id: <07e2f6a0.dc7badb8@usw-ex0104-033.remarq.com>

Bart Kappenburg <b.kappenburg@rcondw.rug.nl> wrote:
>Hello,
>
>How can I make the source of a perl-script unreadable? I want
to sell a
>script but I don't want the buyers to see how I did it...
>
>Plz help
>
>
>Bart
>
>


Take it from a Perl (and Unix) newbie, unreadability is an
intrisic part of Perl.


* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



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

Date: 02 Jun 2000 20:32:00 +0200
From: kaih=7f5KDBiHw-B@khms.westfalen.de (Kai Henningsen)
Subject: Re: my Foo $self = shift;
Message-Id: <7f5KDBiHw-B@khms.westfalen.de>

abe@ztreet.demon.nl (Abe Timmerman)  wrote on 02.06.00 in <3bdfjsgvbhvaien31r6t2b7k9u8g94vmp4@4ax.com>:

> On 02 Jun 2000 14:22:00 +0200, kaih=7f50wpZmw-B@khms.westfalen.de (Kai
> Henningsen) wrote:
>
> > kaih@khms.westfalen.de (Kai Henningsen)  wrote on 02.06.00 in
> > <7f4wXLC1w-B@khms.westfalen.de>:
> >
> > > Sure looks to me like someone invented a new feature and neglected to
> > > write the documentation for it.
> >
> > Someone directed me to an older thread on this, and I see people getting
> > directed to all manner of places that don't document this (duh!).
> >
> > But the high point surely is Randal claiming man fields documents it.
> > (Nope, it doesn't.)
> Yep, it does, and Sam Holden already quoted it.
>
> DESCRIPTION
>     The `fields' pragma enables compile-time verified class fields.
> .... (see Sam's post)

I've seen it. In fact, seeing that particular man page prompted my first  
post.

From which you can deduce that I don't think what's there is even halfway  
reasonable documentation. Not even remotely up to the usual Perl  
documentation standards.

> - every instance of the class should be a typed lexical:
> 	my Foo $obj = Foo->constructor();

Define "typed lexical". What is legal in that place in the my construct?  
And what, precisely, does Perl do when something is there? And is there  
other stuff that can be typed?

> I don't understand, are there more people with you looking at the fields
> manpage?

It seems other people have asked the exact same question, and still  
believe they have not gotten an answer to their question.

Hell, point me to, say, a mail exchange on p5p discussing this new  
feature, or something similar, and I'd be willing to try and write some  
documentation for it.

Kai
-- 
http://www.westfalen.de/private/khms/
"... by God I *KNOW* what this network is for, and you can't have it."
  - Russ Allbery (rra@stanford.edu)


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

Date: Fri, 02 Jun 2000 23:52:44 GMT
From: fenderstratocaster@my-deja.com
Subject: Newbie needs help.....
Message-Id: <8h9hc7$gmg$1@nnrp1.deja.com>

I just bought a book on perl, and am trying the first script. It says
to use any text editor (i'm using notepad) and save the file (I saved
it as hello.pl). Then on the ms-dos prompt, i should type "perl hello".
When I do this, it says "Can't open perl script hello: No such file or
directory". My book tells me that the problem could be that I am not in
the same directory as the file named hello, but I don't know what
directory that is, or how to get to that directory. Can anyone tell me
what to do.

And just in case you need this, the script is:

#!usr/bin/perl

print "Hello, World!\n";


And the MS-DOS prompt where i've been typing "perl hello" is:

C:\PERL>


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


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

Date: Fri, 2 Jun 2000 17:37:02 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Newbie needs help.....
Message-Id: <MPG.13a1f30d91c8f25398ab20@nntp.hpl.hp.com>

[You choice of Subject: means that many potential readers won't even see 
your post.  Describe the problem next time, not yourself.]

In article <8h9hc7$gmg$1@nnrp1.deja.com> on Fri, 02 Jun 2000 23:52:44 
GMT, fenderstratocaster@my-deja.com <fenderstratocaster@my-deja.com> 
says...
> I just bought a book on perl, and am trying the first script. It says
> to use any text editor (i'm using notepad) and save the file (I saved
> it as hello.pl). Then on the ms-dos prompt, i should type "perl hello".
> When I do this, it says "Can't open perl script hello: No such file or
> directory". My book tells me that the problem could be that I am not in
> the same directory as the file named hello, but I don't know what
> directory that is, or how to get to that directory. Can anyone tell me
> what to do.

Try either:

   perl hello.pl

or

   perl hello.pl.txt

The latter because by default, Notepad slams '.txt' onto the end of your 
filename.

If these don't work, use the Windows 'Start:Find:Files or Folders' 
capability to find hello.*, then use the full pathname or change to that 
directory first, as your book says to.

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


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

Date: Sat, 03 Jun 2000 01:04:11 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Newbie needs help.....
Message-Id: <MPG.13a2f6af606dc6fc989708@news>

fenderstratocaster@my-deja.com writes ..
>I just bought a book on perl, and am trying the first script. It says
>to use any text editor (i'm using notepad) and save the file (I saved
>it as hello.pl). Then on the ms-dos prompt, i should type "perl hello".
>When I do this, it says "Can't open perl script hello: No such file or
>directory". My book tells me that the problem could be that I am not in
>the same directory as the file named hello, but I don't know what
>directory that is, or how to get to that directory. Can anyone tell me
>what to do.

two problems as far as I see it

1) notepad will by default always add a .txt extension to your filenames 
when you save them unless you put the filenames in quotes (something I 
learnt here only the other day)

2) your book is either incorrect or you're misinterpreting it .. if you 
save the file as hello.pl then you should be typing

  perl hello.pl

at the command prompt .. however do a

  dir

first to see what your hello program is actually called .. because it 
might be called "hello.pl.txt"

-- 
 jason - elephant@squirrelgroup.com -


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

Date: 2 Jun 2000 23:48:57 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Newbie
Message-Id: <8h9dkp$om5$1@orpheus.gellyfish.com>

On Thu, 01 Jun 2000 16:54:18 -0400 !bull wrote:
> 
> 
> nobull@mail.com in a moment of utter stupidity wrote:
> 
>> Please consult the FAQ before posting _especially_ in a field/NG where
>> you are new.
>>
>> You should also find the person responsible for giving you access to
>> Usenet shake them warmly by the throat and explain to them that they
>> should not be letting people loose on Usenet without this advice.
>>
> You ever hear the saying "If you don't have anything nice (in this
> case helpfull) to say ....."  You know the rest I know you do !
> Give us a break and just try to be helpfull and not insulting.

I dont believe anyone has been insulting here except you.

/J\
-- 
Oh, that's hot. There isn't a man alive that wouldn't get turned on by
that. Well, g'night.
-- 
fortune oscar homer


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

Date: Fri, 02 Jun 2000 22:38:56 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: NT & Sockets
Message-Id: <8h9d1u$dnm$1@nnrp1.deja.com>

In article <3937FE3E.3762A16@sei.cmu.edu>,
  Ted Marz <tfm@sei.cmu.edu> wrote:
> I don't know, but I suspect this is part of the semantics of your read,
> and has little or nothing to do with the actual socket.
>
> rather than using $newvalue=<$socket>, using send() and recv() will
> probably get past this.  The problem with this is that since you are
> operating on a stream,
> rather than datagrams, that you may have to catenate a couple of recv
> responses together to parse a (completed) input.
>

If you code with that in mind, and use all 4 parameters of sysread, it
will do the concatenation for you . . .


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


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

Date: Fri, 02 Jun 2000 23:32:12 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: NT & Sockets
Message-Id: <0uXZ4.98494$h01.711432@news1.rdc1.mi.home.com>

[Posted and mailed]

In article <eyPB#xLz$GA.326@cpmsnbbsa09>,
> 
> Unless all of the packets end with NL it takes around 8 seconds before the
> read operation times out.  The read looks like this:
> $newvalue = <$socket>;

Uuhh..  Stupid question, but using <> in a scalar context reads until the 
next $/ (logical newline) is received.  Is that what you want?  You're 
saying no...but that's how you're reading the socket.  Line-by-line.

-- 
    Clinton A. Pierce              Teach Yourself Perl in 24 Hours! 
  clintp@geeksalad.org         for details see http://www.geeksalad.org
"If you rush a Miracle Man, 
	you get rotten Miracles." --Miracle Max, The Princess Bride


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

Date: 02 Jun 2000 23:52:31 +0100
From: Edward Avis <epa98@doc.ic.ac.uk>
Subject: Re: Perl unusable as a programming language
Message-Id: <xn9snuvsnkg.fsf@pinga.doc.ic.ac.uk>

gbacon@HiWAAY.net (Greg Bacon) writes:

>If a programmer is
>tinkering with some code and comes up with something cool and unusual,
>i.e., outside that implicit box of his experience, his first thought
>should be, 'Cool!  I wonder whether that's documented.'  C, for example,
>isn't all that different; consider Duff's Device.  The advantage of
>Perl, however, is that you can communicate directly with the language's
>developers and users through many different channels and reasonably
>expect to receive a good response.

But do you really want to put up with hordes of beginning Perl
programmers asking 'what should this do?' on clpm for the next twenty
years? :-)

-- 
Ed Avis
epa98@doc.ic.ac.uk


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

Date: Fri, 2 Jun 2000 16:05:29 +0200
From: "Seansan" <sean77@dds.nl>
Subject: relative paths to modules / libraries
Message-Id: <39383cd2$0$3200@reader3>

I wrote two library files that have to be executed before anything else in a
cgi script.
So i refernced them on the fisrt 2-3 lines of a file using require.
require lib::getpost
So the file is in subdir getpost
and the file is named getpost.pm
OK, so far it works, but this main cgi script calls other cgi scripts in
subdirectories and then the problem occurs. I cant referemce them anymore.
I would have to do " ../lib/getpost.pm " on a prompt.

Is there a way I can reference the absolute path to the lib directory and
include the whole path to @INC ??

Or can I require and then use the absolute path ??

I just want to be able to refernce my lib files from anywhere on my server
space, not depending on where I am ??

Thanks in advance.







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

Date: 3 Jun 2000 00:31:45 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: relative paths to modules / libraries
Message-Id: <slrn8jgkfj.nf.efflandt@efflandt.xnet.com>

On Fri, 2 Jun 2000 16:05:29 +0200, Seansan <sean77@dds.nl> wrote:
>I wrote two library files that have to be executed before anything else in a
>cgi script.
>So i refernced them on the fisrt 2-3 lines of a file using require.
>require lib::getpost
>So the file is in subdir getpost
>and the file is named getpost.pm
>OK, so far it works, but this main cgi script calls other cgi scripts in
>subdirectories and then the problem occurs. I cant referemce them anymore.
>I would have to do " ../lib/getpost.pm " on a prompt.

The working directory is usually the directory of the script (but might
not be).  You cannot assume anything about the path in a require'd script
or module.  But you can set a global variable first that can be accessed
by a require'd script.

>Is there a way I can reference the absolute path to the lib directory and
>include the whole path to @INC ??

use lib '/full_path_to/mymodules';	# unshifts this path to @INC

>Or can I require and then use the absolute path ??
>
>I just want to be able to refernce my lib files from anywhere on my server
>space, not depending on where I am ??

That could be what 'use lib' is for.

-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: 1 Jun 2000 20:12:55 GMT
From: jhborwic@unity.ncsu.edu (John Harden Borwick)
Subject: Should I submit a patch to perlsyn?
Message-Id: <8h6g47$r0e$1@uni00nw.unity.ncsu.edu>

From reading perlsyn, it seems to me that the author meant myname(), not my(),
as per the following patch.  Does this seem to be the case?

*** perlsyn.pod Sun May 28 03:39:38 2000
--- perlsyn_new.pod     Thu Jun  1 16:03:42 2000
***************
*** 53,59 ****
      sub myname;
      $me = myname $0           or die "can't get myname";

! Note that my() functions as a list operator, not as a unary operator; so
  be careful to use C<or> instead of C<||> in this case.  However, if
  you were to declare the subroutine as C<sub myname ($)>, then
  C<myname> would function as a unary operator, so either C<or> or
--- 53,59 ----
      sub myname;
      $me = myname $0           or die "can't get myname";

! Note that myname() functions as a list operator, not as a unary operator; so
  be careful to use C<or> instead of C<||> in this case.  However, if
  you were to declare the subroutine as C<sub myname ($)>, then
  C<myname> would function as a unary operator, so either C<or> or

-- 
John Borwick


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

Date: Fri, 02 Jun 2000 23:05:24 GMT
From: 9jerry9@my-deja.com
Subject: System Call Error - Data Area Too Small - Win NT
Message-Id: <8h9ejb$euf$1@nnrp1.deja.com>

I'm using Win NT 4.0 Web Server to run CGI scripts.
Perl is v5.004_04 from Mortice Kern Systems Inc.

I'm attempting to copy files using the 'system ("xcopy x y") or the perl
copy().


The files are not being copied and I'm getting the following error
message (printing the '$!' [dollar bang] 'OS_ERROR' variable):

         "The data area passed to a system call is too small."



Also, when I tried to use the 'File::Copy' module for copy(), I was
given the following error message:

         "Logon failure: unknown user name or bad password."



Is anyone familiar with why these errors would occur?


---------------------------------------------------------------------
Here's some of the code -

 $REQ_FILE_NAME = "NT_date_time.req" ;

(1)
  $status = system ("xcopy d:\\build_request\\$REQ_FILE_NAME
         d:\\build_tools\\build_request\\$REQ_FILE_NAME /f/k/r < $YES");

  print ("<PRE>\nStatus: $!\n</PRE>") ;


(2)
   $status = copy ("d:\\build_request\\$REQ_FILE_NAME",
                "f:\\build_tools\\build_request\\$REQ_FILE_NAME") ;

   print ("<PRE>\nStatus: $!\n</PRE>") ;



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


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

Date: 3 Jun 2000 00:49:47 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: webget failure
Message-Id: <slrn8jglhe.nf.efflandt@efflandt.xnet.com>

On Fri, 02 Jun 2000 01:48:47 GMT, Deja User <binary3418@my-deja.com> wrote:
>Hi, there:
>
>  I'm a novice user of Perl. I want to fetch a document from a
>Web site and process it. With a search in Deja, I get to know
>that there is a example called webget comming along with the
>Perl document. I found it and made a copy of it. But it didn't
>seem to work for this:
>
>  webget www.perl.com /guanaco.html
>
>  On a Win98 box running ActivePerl v 5.6, I got the following
>error message:
>
>    cannot connect to http daemon on www.perl.com
>
>  On a Linux box running Perl 5.005_03, I got
>
>    IO::Socket::INET: Connection refused
>    cannot connect to http daemon on www.perl.com
>
>  What's wrong?

Maybe it was down, you have an error in your script, your DNS is not
working, or you are blocking that port with ipchains.  This is an example
of the perlipc webget example requesting a non-existing file on a Linux
box running Perl 5.005_03:

$ ./webget localhost /hoky.html
HTTP/1.1 404 Not Found
Date: Sat, 03 Jun 2000 00:41:10 GMT
Server: Apache/1.3.9 (Unix)  (Red Hat/Linux)
Connection: close
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>404 Not Found</TITLE>
</HEAD><BODY>
<H1>Not Found</H1>
The requested URL /hoky.html was not found on this server.<P>
</BODY></HTML>


-- 
David Efflandt  efflandt@xnet.com  http://www.de-srv.com/
http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/  http://cgi-help.virtualave.net/



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

Date: 2 Jun 2000 23:12:07 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Why is while inside a while so slow
Message-Id: <8h9bfn$hji$1@orpheus.gellyfish.com>

On Fri, 02 Jun 2000 09:04:46 -0700 Ron Auer wrote:
> I need to read a large flat file.  I started testing with a test flat
> file of 480,000 lines.
> 
> 	I put in a while loop to read the file, then I put a while loop inside
> this to perform some checks.  Took hours to run.  So I did a benchmark.
> 
> 	I did the while loop to read the flat file and incremented a counter
> and printed the counter.  Took 3 1/2 minutes.  Then I added the inside
> while loop and the time increased to 94 minutes.  And, the inside while
> loop only looped once (for testing purposes).  The code follows, any
> thoughts as to why it takes to long?  Any thoughts on how to get around
> this?  Thanks.
> 
> 	$start_time=`date`;	
> 	$ctr=0;	
> 	while (<>){
> 		$ctr++
> 		print $ctr , "\n";
> 	}
> 	$end_time = `date`;
> 	print "Start time: ", $start_time, "end time: ", $end_time, "\n";
> 
> This while loop took 3 1/2 minutes.  So then I added the inside while
> loop:
> 
> 	$start_time=`date`;
> 	$ctr=0;
> 	$ktr=0;
> 	@array =qw(one two);
> 	while (<>){
> 		$ctr++;
> 		print $ctr , "\n";
> 
> 		while (<@array>) {

You are now globbing on the contents of @array and creating from that
a second local $_ for each time round the outer loop.  You might want to
lose the <>'s around the @array and perhaps use something like :

                foreach $foo ( @array ) {

instead.

> 			$ktr++;
> 			}
> 	$end_time = `date`;
> 	print "Start time: ", $start_time, "end time: ", $end_time, "\n";
> 
> 

/J\
-- 
Oh, Marge. I thought I had an appetite for destruction, but all I wanted
was a club sandwich.
-- 
fortune oscar homer


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

Date: Fri, 02 Jun 2000 16:32:55 -0700
From: Ron Auer <rrauer@mitre.org>
Subject: Re: Why is while inside a while so slow
Message-Id: <39384426.908CFBC8@mitre.org>

Ok, I feel real silly now.  I worked on this pgm last night and got tied
up with the while inside while - easy and clean - B U T  SLOW.

Changed to a foreach loop and shaved off tons of time.

Changed strategy and used hash (see example next line) and sped it up
more.  I learned a lot about processing large files.  So much to learn,
so little time!

   if (exists $host_names{$hostname} )

	Thnx - Ron


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

Date: 2 Jun 2000 22:35:00 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Will flock(...) wait?
Message-Id: <8h99a4$agf$1@orpheus.gellyfish.com>

On Fri, 02 Jun 2000 08:36:41 -0400 Alan Lehotsky wrote:
> In article <8h86de$a1h$15$1@news.t-online.com>, "Thomas Plehn" 
> <thommy-p@bigfoot.com> wrote:
> 
>>>>Hi,
>>>>can anyone help me with these flock questions?
>>>>
> ...
> 
> 
>>>>
>>>>I wondered what will happen if LOCK_EX is called while another script is
>>>>reading from the file without any lock.
>>>>
>
>    Unix file locking is ALWAYS advisory.  It only works if all
> accessors announce their intentions.
> 

Infact the System V Interface Definition *does* permit of mandatory locking
but you will have to be on a system that supports it such as HP/UX, Solaris
or Linux or whatever and you will have to lock via fcntl() directly - this
is also byte-range locking rather than file locking.  You will probably
want to ask some Linux user to send you the file :

  /usr/src/linux/Documentation/mandatory.txt

Which is a good explanation of it - then ask in some Unix group in the
first place.  (I have to admit I've never been bothered with it).

/J\
-- 
I saw this movie about a bus that had to SPEED around a city, keeping
its SPEED over fifty, and if its SPEED dropped, it would explode! I
think it was called, 'The Bus That couldn't Slow Down.'
-- 
fortune oscar homer


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

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


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