[18326] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 494 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Mar 15 14:10:58 2001

Date: Thu, 15 Mar 2001 11:10:25 -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: <984683425-v10-i494@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 15 Mar 2001     Volume: 10 Number: 494

Today's topics:
        Determining current namespace? PerlEx scripts don't def <webmuse@my-deja.com>
    Re: Determining current namespace? PerlEx scripts don't <webmuse@my-deja.com>
    Re: Determining current namespace? PerlEx scripts don't nobull@mail.com
    Re: Echo client one step behind server response? (socke <djberge@uswest.com>
    Re: Echo client one step behind server response? (socke nobull@mail.com
    Re: FAQ 6.5:   How do I substitute case insensitively o (Tad McClellan)
    Re: FAQ 7.12:   What's a closure? <bart.lateur@skynet.be>
    Re: FAQ 7.12:   What's a closure? (Anno Siegel)
    Re: FAQ 7.12:   What's a closure? <uri@sysarch.com>
        Formats <mnarvaja@geocities.xyz.com>
    Re: Formats <bmb@ginger.libs.uga.edu>
    Re: Getting contents of a URL nobull@mail.com
    Re: HTTP Client Question <spohn@mayo.edu>
    Re: HTTP Client Question (Anno Siegel)
    Re: HTTP Client Question (Bob Dilworth)
    Re: HTTP Client Question <spohn@mayo.edu>
    Re: HTTP Client Question <spohn@mayo.edu>
    Re: JUMPING (Peter Scott)
        Keyboard short cuts through perl (LK)
        Keystroke shortcuts (LK)
    Re: Keystroke shortcuts <uri@sysarch.com>
    Re: Memory and Perl <mjcarman@home.com>
    Re: newbie: CGI Error gives path of website <ciaran.mccreesh@useaddressbelow.please>
    Re: Passing Parameters (Tad McClellan)
        pb with a cgi script <Mathieu.Peltier@netcourrier.com>
    Re: Perl 4 <bart.lateur@skynet.be>
    Re: Perl FAQ? (John Joseph Trammell)
    Re: Perl FAQ? <comdog@panix.com>
        Pipe delimited string parsing or Newbie needs a clue <lbrodeur@NOSPAMwdconsulting.com>
    Re: Pipe delimited string parsing or Newbie needs a clu <olthoff@multiboard.com>
    Re: Pipe delimited string parsing or Newbie needs a clu <bmb@ginger.libs.uga.edu>
    Re: Print own "die" message (BUCK NAKED1)
        Read to : <mapow@hi.hinet.hr>
    Re: Read to : <ciaran.mccreesh@useaddressbelow.please>
    Re: Read to : <bmb@ginger.libs.uga.edu>
        setuid don't work sowiso@snailsen.de
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 15 Mar 2001 13:07:10 -0500
From: "Thomas" <webmuse@my-deja.com>
Subject: Determining current namespace? PerlEx scripts don't default to main::?
Message-Id: <kx7s6.213$Y%3.138954@news1.mco>

Hello!

I'm testing PerlEx 1.1.6 on NT4/IIS4.

I have a module that puts loads some variables into any given
namespace. If you don't tell it what namespace you want to use, it
assumes the main namespace:

$mymod->load_vars('foobar');    # load some variables into foobar::
$mymod->load_vars();    # load some variables into main::

When I started testing a script that uses this module in PerlEx, I was
using the default of loading into the main namespace. But the
variables that should have been loaded were all undefined.

So I tested these variables by including main::, and they worked. Thus
I concluded that, for whatever reason, PerlEx loads scripts into a
different namespace somehow. I "proved" this by placing this at the
top of the script:

package main;

And after that, I could access the loaded variables in the main
namespace without using "main::" explicitly when calling the variable.
Strange!

I would rather not call "package main;" explicitly, because I assume
there is an important reason why PerlEx loads scripts in a different
namespace.

So, is there any way I can find out what namespace the script is
currently running in? (That way I can load the variables into that
namespace?)

I half expected a call to "package" with no parameter would return the
current namespace, but that doesn't seem to work.

Thanks for any help...

-thomas





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

Date: Thu, 15 Mar 2001 13:45:37 -0500
From: "Thomas" <webmuse@my-deja.com>
Subject: Re: Determining current namespace? PerlEx scripts don't default to main::?
Message-Id: <m58s6.9$fd.3026@news4.mco>

I have answered my own question... you can use 'caller' to determine
the namespace, duh! Sorry for my ignorance! Here's a tidbit for you
that I picked up in all this, though...

PerlEx runs scripts in a namespace determined by the script file
location.

For example, a script located at c:\webdocs\cgi-bin\script.plex would
have a namespace of:

PerlEx::Precompiler::c_::webdocs::cgi_bin::script_plex

Strange, eh?

-thomas


"Thomas" <webmuse@my-deja.com> wrote in message
news:kx7s6.213$Y%3.138954@news1.mco...
> Hello!
>
> I'm testing PerlEx 1.1.6 on NT4/IIS4.
>
> I have a module that puts loads some variables into any given
> namespace. If you don't tell it what namespace you want to use, it
> assumes the main namespace:
>
> $mymod->load_vars('foobar');    # load some variables into foobar::
> $mymod->load_vars();    # load some variables into main::
>
> When I started testing a script that uses this module in PerlEx, I
was
> using the default of loading into the main namespace. But the
> variables that should have been loaded were all undefined.
>
> So I tested these variables by including main::, and they worked.
Thus
> I concluded that, for whatever reason, PerlEx loads scripts into a
> different namespace somehow. I "proved" this by placing this at the
> top of the script:
>
> package main;
>
> And after that, I could access the loaded variables in the main
> namespace without using "main::" explicitly when calling the
variable.
> Strange!
>
> I would rather not call "package main;" explicitly, because I assume
> there is an important reason why PerlEx loads scripts in a different
> namespace.
>
> So, is there any way I can find out what namespace the script is
> currently running in? (That way I can load the variables into that
> namespace?)
>
> I half expected a call to "package" with no parameter would return
the
> current namespace, but that doesn't seem to work.
>
> Thanks for any help...
>
> -thomas
>
>
>




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

Date: 15 Mar 2001 18:40:05 +0000
From: nobull@mail.com
Subject: Re: Determining current namespace? PerlEx scripts don't default to main::?
Message-Id: <u966hag9kq.fsf@wcl-l.bham.ac.uk>

"Thomas" <webmuse@my-deja.com> writes:

> I have a module that puts loads some variables into any given
> namespace. If you don't tell it what namespace you want to use, it
> assumes the main namespace:

Poor choice, it should default the namespace of the caller, as
returned by caller() function.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 15 Mar 2001 08:10:30 -0600
From: Daniel Berger <djberge@uswest.com>
Subject: Re: Echo client one step behind server response? (socket question)
Message-Id: <3AB0CD56.5EF679ED@uswest.com>

nobull@mail.com wrote:

> Daniel Berger <djberge@uswest.com> writes:
>
> > Subject: Echo client one step behind server response? (socket question)
>
> Question has absolutely nothing to so with sockets. You will see
> exactly the same effect if you do:
>
> perl -pe '$_ = reverse $_' <infile >outfile
>
> The first line of outfile is now blank, the (n)th line of outfile is
> the (n-1)th line of infile reversed.  (The last line of outfile lacks
> a terminator).
>
> This is because if you reverse a string that ends with "\n" the
> reversed string starts with "\n".
>
> >       while(my $msg_in = <$clientSock>){
> >          my $msg_out = (scalar reverse $msg_in);
> >          print $clientSock $msg_out;
> >       }
>
> Change to
>
>        while(my $msg_in = <$clientSock>){
>           chomp $msg_in;
>           my $msg_out = (scalar reverse $msg_in);
>           print $clientSock "$msg_out\n";
>        }
>
> --
>      \\   ( )
>   .  _\\__[oo
>  .__/  \\ /\@
>  .  l___\\
>   # ll  l\\
>  ###LL  LL\\

First, I apologize to anyone who tried to run this code as is.  Please add the
following 2 lines to the echoServer.pl program:

use Carp qw(croak cluck);
use File::Basename;

Also, watch out for comments that get out of wack due to copy/paste.

I had the "chomp" in my code originally, but the client appeared to just hang
when I did that.  The reason?  A couple of lines later I had:

print $clientSock "$msg_out";

instead of:

print $clientSock "msg_out\n";

I've never paid much attention to output format much, being primarily concerned
with reading *from* filehandles.

I guess the program is waiting for an end of line character that it never
receives.  The devil is in the details, eh?

While I'm thinking of it, is there any danger in doing this?: $\ = "\n";

Thanks for your time & patience.

Dan




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

Date: 15 Mar 2001 18:17:15 +0000
From: nobull@mail.com
Subject: Re: Echo client one step behind server response? (socket question)
Message-Id: <u9d7bigams.fsf@wcl-l.bham.ac.uk>

Daniel Berger <djberge@uswest.com> writes:

> nobull@mail.com wrote:

[ my post quoted in full even the sig ]
 
Please trim the qouted material to what is relevant.
> 
> print $clientSock "$msg_out";
> 
> instead of:
> 
> print $clientSock "msg_out\n";
> 
> While I'm thinking of it, is there any danger in doing this?: $\ = "\n";

Many widely used modules assume $\ is null and will fail if it isn't.
IMNSHO $\ should only be modified in small local()ities.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 15 Mar 2001 15:01:08 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: FAQ 6.5:   How do I substitute case insensitively on the LHS, but preserving case on the RHS?
Message-Id: <slrn9b1fbf.5uc.tadmc@tadmc26.august.net>

Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "CKC" == Charles K Clarkson <c_clarkson@hotmail.com> writes:
>
>  CKC> PerlFAQ Server <faq@denver.pm.org>
>  CKC> :   How do I substitute case insensitively on the LHS, but
>  CKC> : preserving case on the RHS?
>
>  CKC>     What is RHS and LHS?
>
>RHS is right hand side. LHS is left as an exercise to the reader.
 ^^^^^^                  ^^^^^^

But shouldn't "LHS" be "LAAETTR" then?


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 15 Mar 2001 14:05:28 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: FAQ 7.12:   What's a closure?
Message-Id: <gli1btot796ed9qggkesrjmnapcsgj3f0q@4ax.com>

Anno Siegel wrote:

>This FAQ excerpt, as well as other places in the documentation,
>insist that a closure be an anonymous subroutine.  In my view, the
>characteristic property of a closure is that it keeps lexicals alive
>that would otherwise have gone out of scope.  But that is also true
>with a named subroutine that is defined inside a bare block:
>
>    {
>        my $state = 0;
>        sub toggle { $state = not $state; }
>    }
>
>So would this not be a closure?  If it said "$toggle = sub { ...}"
>instead, would it be?

There's more to it. According to me (;), you can only speak of a closure
if you can use the same code to have two different instances. You can't
do that with a static sub.

So in that regard, it's very easy to create something like a closure
using OO. The "closure" is actually just a method call, and the
different groups of variables are stored in the object itself.

	$a = new Toggle;
	$b = new Toggle;
	$a->toggle;
	$b->toggle;

	package Toggle;
	sub new {
	    return bless { state => 0 };
	}
	sub toggle {
	    my $toggle = shift;
	    $toggle->{state} ^= 1;
	}

-- 
	Bart.


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

Date: 15 Mar 2001 14:33:15 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: FAQ 7.12:   What's a closure?
Message-Id: <98qjrb$6et$1@mamenchi.zrz.TU-Berlin.DE>

According to Bart Lateur  <bart.lateur@skynet.be>:
> Anno Siegel wrote:
> 
> >This FAQ excerpt, as well as other places in the documentation,
> >insist that a closure be an anonymous subroutine.  In my view, the
> >characteristic property of a closure is that it keeps lexicals alive
> >that would otherwise have gone out of scope.  But that is also true
> >with a named subroutine that is defined inside a bare block:
> >
> >    {
> >        my $state = 0;
> >        sub toggle { $state = not $state; }
> >    }
> >
> >So would this not be a closure?  If it said "$toggle = sub { ...}"
> >instead, would it be?
> 
> There's more to it. According to me (;), you can only speak of a closure
> if you can use the same code to have two different instances. You can't
> do that with a static sub.

But... your method below *is* a static sub.

> So in that regard, it's very easy to create something like a closure
> using OO. The "closure" is actually just a method call, and the
> different groups of variables are stored in the object itself.
> 
> 	$a = new Toggle;
> 	$b = new Toggle;
> 	$a->toggle;
> 	$b->toggle;
> 
> 	package Toggle;
> 	sub new {
> 	    return bless { state => 0 };
> 	}
> 	sub toggle {
> 	    my $toggle = shift;
> 	    $toggle->{state} ^= 1;
> 	}

But here $a and $b behave like additional arguments in the call of toggle().
Perl method calls are even implemented this way, but if they weren't the
behavior would be the same.  That you don't write $a and $b in argument
position is just syntactic sugar.  Would using an argument that contains
data for the sub to manipulate make that sub a closure?

Anno


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

Date: Thu, 15 Mar 2001 18:10:56 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: FAQ 7.12:   What's a closure?
Message-Id: <x7wv9q9a34.fsf@home.sysarch.com>

>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:

  AS> According to Bart Lateur  <bart.lateur@skynet.be>:
  >> Anno Siegel wrote:

  >> >that would otherwise have gone out of scope.  But that is also true
  >> >with a named subroutine that is defined inside a bare block:
  >> >
  >> >    {
  >> >        my $state = 0;
  >> >        sub toggle { $state = not $state; }
  >> >    }
  >> >
  >> >So would this not be a closure?  If it said "$toggle = sub { ...}"
  >> >instead, would it be?

i would not call this a closure but others do. you can get the same
effect by moving the declaration of $state outside the block and making
it a file lexical. the block in this case is only to give tighter
scoping. it may actually allocate a pad (what closures use to refer to
their private data), but semantically i don't call it a closure.

  >> 
  >> There's more to it. According to me (;), you can only speak of a closure
  >> if you can use the same code to have two different instances. You can't
  >> do that with a static sub.

  >> $a = new Toggle;
  >> $b = new Toggle;
  >> $a->toggle;
  >> $b->toggle;
  >> 
  >> package Toggle;
  >> sub new {
  >> return bless { state => 0 };
  >> }
  >> sub toggle {
  >> my $toggle = shift;
  >> $toggle->{state} ^= 1;
  >> }

i don't see any closures there. no anon sub refers to a variable in its
parent's space.

for a real example that uses closures as objects, read pages 298-299 of
OO perl.

here is a closure that has a pair of related subs:

sub make_stack {

	my $stack_ref = [] ;

	return( sub { push @{$stack_ref}, @_ },
		sub { pop @{$stack_ref} } ) ;
}

my ($foo_push, $foo_pop) = make_stack() ;

$foo_push->( 1 .. 3 ) ;
print $foo_pop->() ;

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Thu, 15 Mar 2001 14:29:01 -0300
From: "Marcelo Narvaja" <mnarvaja@geocities.xyz.com>
Subject: Formats
Message-Id: <3ab0fd7e_2@news1.prserv.net>

Hi,
I've found very usefull defining formats for reporting.
But, I need to format the page footer, is there any way
to do it ?
Thanks in advance,
Marcelo





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

Date: Thu, 15 Mar 2001 13:04:28 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Formats
Message-Id: <Pine.A41.4.21.0103151303530.11922-100000@ginger.libs.uga.edu>

On Thu, 15 Mar 2001, Marcelo Narvaja wrote:

> I've found very usefull defining formats for reporting.
> But, I need to format the page footer, is there any way
> to do it ?

There is information about that in perldoc perlform.

Brad




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

Date: 15 Mar 2001 18:26:20 +0000
From: nobull@mail.com
Subject: Re: Getting contents of a URL
Message-Id: <u9bsr2ga7n.fsf@wcl-l.bham.ac.uk>

Chandramohan Neelakantan<cmon_209@hotmail.com> writes:

> Subject: Getting contents of a URL

> I am trying to obtain the contents of a URL like 

Yes, but that doesn't necessarily make that an appropriate subject
line.

> "A journey of a thousand miles begins with a single step"
>                                            - Japanese Proverb

Indeed.  And if when you try to take that first step you find that
your shoelaces are tied together then you should be asking for help
with untieing your laces, not help with long distance travel.

> "Your vendor has not defined Socket Macro AF_INET in Socket.pm"

There is something fundamentally wrong with your Perl installation.
You probably should re-install it.

> I tried reinstalling the module but , it gave the same message.Now I have
> written off that module and I want to know if 
> 
> 1.it can be developed on my own
> 2 other modules are available to accomplish the same 

Anything that tries to use IP sockets in Perl will fail.  Your other
option is to use something like backticks and lynx.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Thu, 15 Mar 2001 08:53:59 -0600
From: "Al Spohn" <spohn@mayo.edu>
Subject: Re: HTTP Client Question
Message-Id: <98ql32$2is$1@tribune.mayo.edu>


Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:98qg38$28g$1@mamenchi.zrz.TU-Berlin.DE...
> According to Al Spohn <spohn@bigfoot.com>:
>
> [...]
>
> > committing some typographical/semantic sin that gets him/her in deep
poop
> > with the local post militia.
>
> "Post militia", eh?  In another thread, or another branch of this one,
> it was "Taliban".  I seriously don't get why this kind of imagery is
> so popular, considering that no usenet poster has *any* power over
> any other poster.  How can you expect to be taken seriously with
> metaphors so blatantly off the mark?

I can't speak for the author of the "Taliban" metaphor, by my "militia"
analogy wasn't meant so much to imply that these individuals carry guns or
would be inclined to send me an email that would literally explode in my
face, but rather to draw attention to those(albeit non-violent) elements of
their mind-set that they apparently have in common with their non-virtual
counterparts: e.g., self-appointed arbeiters of truth,  zero willingness to
discuss divergence from the truth as they see it, and a propensity for
flamboyant demonstrations of (yes) power when their ability and/or
willingness to converse escapes them (the latter two points amply
demonstrated by the need to publicy *plonk* as opposed to quietly making
whatever filtering adjustments suit their fancy.)

Having said that, I will acknowledge that a tendency to rush for the closest
outrageous metaphor is a weakness on my part, and maybe even an attempt to
rattle my own little saber... so in the end I think your point is well
taken.  Hopefully a sliver of truth will be apparent in my rants and raves
despite the frequent distractions of some unfortunate metaphors.

- Al




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

Date: 15 Mar 2001 16:12:48 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: HTTP Client Question
Message-Id: <98qpm0$bg5$1@mamenchi.zrz.TU-Berlin.DE>

According to Al Spohn <spohn@mayo.edu>:
> 
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> news:98qg38$28g$1@mamenchi.zrz.TU-Berlin.DE...
> > According to Al Spohn <spohn@bigfoot.com>:
> >
> > [...]
> >
> > > committing some typographical/semantic sin that gets him/her in deep
> poop
> > > with the local post militia.
> >
> > "Post militia", eh?  In another thread, or another branch of this one,
> > it was "Taliban".  I seriously don't get why this kind of imagery is
> > so popular, considering that no usenet poster has *any* power over
> > any other poster.  How can you expect to be taken seriously with
> > metaphors so blatantly off the mark?
> 
> I can't speak for the author of the "Taliban" metaphor, by my "militia"
> analogy wasn't meant so much to imply that these individuals carry guns or
> would be inclined to send me an email that would literally explode in my
> face, but rather to draw attention to those(albeit non-violent) elements of
> their mind-set that they apparently have in common with their non-virtual
> counterparts: e.g., self-appointed arbeiters of truth,  zero willingness to
> discuss divergence from the truth as they see it, and a propensity for
> flamboyant demonstrations of (yes) power when their ability and/or
> willingness to converse escapes them (the latter two points amply

Why you associate these undesirable properties with "militia", which
is a body of citizens with a military organization, is beyond me.
I'd expect them to be less inclined to judge the truth or discuss
issues in favor of more direct action.

Whether these things are what actually motivates the more grumpy
postings by regulars here is a different question.  I know it isn't
behind mine, and I believe to know many of the others well enough
to say it isn't behind theirs either.

> demonstrated by the need to publicy *plonk* as opposed to quietly making
> whatever filtering adjustments suit their fancy.)

What's wrong with a public *plonk*, if the author decides it's a
way of making a point?  The debate itself is public, why shouldn't
it's effects be?
 
> Having said that, I will acknowledge that a tendency to rush for the closest
> outrageous metaphor is a weakness on my part, and maybe even an attempt to
> rattle my own little saber... so in the end I think your point is well
> taken.  Hopefully a sliver of truth will be apparent in my rants and raves
> despite the frequent distractions of some unfortunate metaphors.

Your point of view may have become clearer, but I don't see much
truth in it.  You don't understand, or don't take into account, the
dynamics of a "popular" newsgroup with a smallish kernel of regulars.
That lets you misjudge for power-hunger what is really closer
to self-defense.

Anno


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

Date: Thu, 15 Mar 2001 16:23:26 GMT
From: avast@hortonsbay.com (Bob Dilworth)
Subject: Re: HTTP Client Question
Message-Id: <3ab0e842.9357992@news.mco.edu>

On 15 Mar 2001 15:38:51 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

>Indeed.  Moreover, the immense popularity of Perl as a "web language"
>takes care that a large part of those postings that are (marginally)
>on topic are put forward by people with little programming experience,
>little interest in Perl as a language an no motivation to learn much
>about both.  It does make folks grumpy, yours truly included.

There's an interesting assumption in the above snippet.  First - just
because someone comes to clpm to ask what you may consider an
inappropriate question does not imply that they have little or no
motivation to learn Perl.  It may be true for some but not for all.
Publicly "plonking" them for "jeopardy" posting serves no purpose
other than, in my view, arrogance.  It is also seems quite mean and
intolerant.  Why waste all that energy on public humiliation when you
can simply ignore the posting?

I frequent a number of other newsgroups, mostly lurking for
information, and of all of them this one has a surprisingly large and
vocal  group of folks who seem to enjoy flaming posters for
infractions of rules.  I understand that their are posting guidelines
out there and that I also understand that it can be difficult (altho
not THAT difficult) to wend one's way though the morass of postings to
find the tasty morsels that are of interest.  I do it (the wending)
with little difficulty.  I also read the heretical "jeopardy" postings
also with very little difficulty.  I've never, ever found it to get in
the way of reading the postings and the responses.

I guess I just don't understand why the public "plonking", the angry
RTFM responses, etc., etc., are necessary.  Doesn't it take time away
from reading the things you want to read?  How hard is it to click the
left mouse button a couple of times to move on to the next posting?
I'm actually very interested in answers to these questions because I
just don't understand where all the anger comes from.

Bob D.


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

Date: Thu, 15 Mar 2001 11:00:30 -0600
From: "Al Spohn" <spohn@mayo.edu>
Subject: Re: HTTP Client Question
Message-Id: <98qsge$5n4$1@tribune.mayo.edu>


Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:98qpm0$bg5$1@mamenchi.zrz.TU-Berlin.DE...
> According to Al Spohn <spohn@mayo.edu>:
> >
> > Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> > news:98qg38$28g$1@mamenchi.zrz.TU-Berlin.DE...
> > > According to Al Spohn <spohn@bigfoot.com>:
> > >
> > > [...]
> > >
> > > > committing some typographical/semantic sin that gets him/her in deep
> > poop
> > > > with the local post militia.
> > >
> > > "Post militia", eh?  In another thread, or another branch of this one,
> > > it was "Taliban".  I seriously don't get why this kind of imagery is
> > > so popular, considering that no usenet poster has *any* power over
> > > any other poster.  How can you expect to be taken seriously with
> > > metaphors so blatantly off the mark?
> >
> > I can't speak for the author of the "Taliban" metaphor, by my "militia"
> > analogy wasn't meant so much to imply that these individuals carry guns
or
> > would be inclined to send me an email that would literally explode in my
> > face, but rather to draw attention to those(albeit non-violent) elements
of
> > their mind-set that they apparently have in common with their
non-virtual
> > counterparts: e.g., self-appointed arbeiters of truth,  zero willingness
to
> > discuss divergence from the truth as they see it, and a propensity for
> > flamboyant demonstrations of (yes) power when their ability and/or
> > willingness to converse escapes them (the latter two points amply
>
> Why you associate these undesirable properties with "militia", which
> is a body of citizens with a military organization, is beyond me.
> I'd expect them to be less inclined to judge the truth or discuss
> issues in favor of more direct action.

My comments aren't directed at anyone who is willing to discuss issues,
whether or not they happen to agree with me.  Rather, they're directed at
those who favor direct action over discussion, which was obviously Abigail's
preference in this case (unless you call *plonk* a means of discussion.)

> Whether these things are what actually motivates the more grumpy
> postings by regulars here is a different question.  I know it isn't
> behind mine, and I believe to know many of the others well enough
> to say it isn't behind theirs either.

I can believe that, but it's not logical to assume that is always the case,
particularly when the person chooses not to elaborate or make a modest
attempt at defending their actions.

> > demonstrated by the need to publicy *plonk* as opposed to quietly making
> > whatever filtering adjustments suit their fancy.)
>
> What's wrong with a public *plonk*, if the author decides it's a
> way of making a point?  The debate itself is public, why shouldn't
> it's effects be?

I guess for me the public *plonk*, particularly after you've gotten the last
word in, is just a childish mechanism for extracting yourself from a
conversation that would otherwise prove perilous for your point of view were
the logic of the thing be allowed to play out.

> > Having said that, I will acknowledge that a tendency to rush for the
closest
> > outrageous metaphor is a weakness on my part, and maybe even an attempt
to
> > rattle my own little saber... so in the end I think your point is well
> > taken.  Hopefully a sliver of truth will be apparent in my rants and
raves
> > despite the frequent distractions of some unfortunate metaphors.
>
> Your point of view may have become clearer, but I don't see much
> truth in it.  You don't understand, or don't take into account, the
> dynamics of a "popular" newsgroup with a smallish kernel of regulars.
> That lets you misjudge for power-hunger what is really closer
> to self-defense.

Ouch. OUCH. :-)  I can understand and believe I appreciate the "smallish
kernal of regulars" concept, but for me that's not enough to buy them any
more lattitude in their behavior than would be expected of the average
person.  In groups where I might qualify as a "regular" I pride myself in
being *more* rather than *less* tolerant of the foibles of new faces in the
group.  Granted, the groups I'm thinking of don't approach the sheer volumes
of this one, which I acknowledge makes being Mr. Rogers more of a strain...
but in an environment where doing nothing doesn't cost you a thing vs. going
out of your way to be a little nasty, that smacks more of a power trip than
self-defense to me.  And there are way too many knowledgeable regulars out
there who don't feel this compulsion to twist the knife for me to have much
patience with those that do.

Thanks very much, by the way, for taking the time to discuss this.

- Al




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

Date: Thu, 15 Mar 2001 11:36:39 -0600
From: "Al Spohn" <spohn@mayo.edu>
Subject: Re: HTTP Client Question
Message-Id: <98quk2$6le$1@tribune.mayo.edu>


Gary O'Keefe <gokeefe@gssec.bt.co.uk> wrote in message
news:3ab0cbc8.16334377@news.gssec.bt.co.uk...
<stuff snipped>
> Granted getting killfiled by Abigail is only a minor use of (a rightly
> reserved) power, denying the nimrod a chance for an answer in
> Abigail's cognitive domain. But, in a small way, it reduces the
> utility of usenet for the nimrod - so it's very definitely the
> exercise of power by one poster over another.

Three cheers for we nimrods of the world :-)

> But power in the hands of the common person is not a bad thing.
> Killfiling someone who fills up your forum with a lot of (or any) crap
> is cool. Just don't go reaching for the usenet weapons of mass
> destruction.

Couldn't agree more, but making a public display implies (for me at least)
that the person's agenda goes well beyond the simple God-given right of
noise reduction.

- Al




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

Date: Thu, 15 Mar 2001 15:43:29 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: JUMPING
Message-Id: <Bq5s6.30866$V6.122826@news1.gvcl1.bc.home.com>

In article <_QMr6.29880$V6.116601@news1.gvcl1.bc.home.com>,
  I wrote:
>In article <p4Mr6.2004176$%C1.26239451@Flipper>,
> "Waarddebon" <Waarddebon@chello.nl> writes:
>>In my script I use a check on a variable. If this variable contains a
>>certain value an other cgi-script must be loaded. How can I accomplish this
>>?
>>
>>for example:
>>if ($xx eq '2') {
>>#### Load the other script ####
>
>perldoc -f do
>perldoc -f require
>perldoc -f exec
>perldoc -f system
>perldoc perlop, look for 'bacticks'

'backticks'

>Which one is right for you depends on what you mean by 'load'.

Evidently the actual meaning of 'load' in this context was something else again.

You can't redirect a POST to another POST; see 
http://ppewww.ph.gla.ac.uk/~flavell/www/post-redirect.html.

-- 
Peter Scott


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

Date: Thu, 15 Mar 2001 16:14:02 GMT
From: lkenny@fisheries.org (LK)
Subject: Keyboard short cuts through perl
Message-Id: <3ab0d22a.2191942@wingate>

Is there anyway to get perl to use the keyboard shortcuts?

E.G.  ctrl-X to cut


LK



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

Date: Thu, 15 Mar 2001 16:14:02 GMT
From: lkenny@fisheries.org (LK)
Subject: Keystroke shortcuts
Message-Id: <3ab0d992.4088417@wingate>

Is there a way to get perl to use keystroke shortcuts when reading a
document?  If so,  how, or where can I look to find out how.  (I
already tried the perlfaq but didn't find anything)

LK



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

Date: Thu, 15 Mar 2001 18:29:43 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Keystroke shortcuts
Message-Id: <x7u24u997r.fsf@home.sysarch.com>

>>>>> "L" == LK  <lkenny@fisheries.org> writes:

  L> Is there a way to get perl to use keystroke shortcuts when reading a
  L> document?  If so,  how, or where can I look to find out how.  (I
  L> already tried the perlfaq but didn't find anything)

first, you posted this twice with different subjects and bodies. don't
do that.

second, what are you talking about? where are these keyboard strokes
coming from? perl can read them but then it is reading from the keyboard
and not from a document.

so figure out how to express what you really want and post again. the
PSI::ESP module is telling that you can't do what you want since what
you want makes no sense.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Thu, 15 Mar 2001 08:32:57 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: Memory and Perl
Message-Id: <3AB0D299.AAE29B51@home.com>

Collin Borrlewyn wrote:
> 
> [...]
> How can I use less memory when writing my scripts?

This is an FAQ, and if you saw the substr() and vec() stuff you've
likely read it. Unfortunately, that's about all it says. There was a big
thread (started by me) here a week or two ago to update its entry. The
(almost) final version is in the message with this ID:

3AA56BEC.A7F9F0CD@home.com

Or, if you prefer, search on dejagoogle for this subject line:

RFC: FAQ3 update -- Using less memory

It has lots of pointers on being nicer to your system resources.

-mjc


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

Date: Thu, 15 Mar 2001 18:10:22 +0000
From: Ciaran McCreesh <ciaran.mccreesh@useaddressbelow.please>
Subject: Re: newbie: CGI Error gives path of website
Message-Id: <uDfR9GAOWQs6IwtH@harlawroad.freeserve.co.uk>

In article <98qd5q$st1$1@news1.xs4all.nl> (whatever that means), marc
<SorryGot@DirtyMail.com> writes
>this is probably a simple one, whenever I try to type a cgi
>file that does not exist I get a page telling me:
>
>Can't open perl script "C:\Inetpub\...  and so on...
>
>How do I turn the path info off?

This isn't a perl question, but... If you're using Apache you can edit
the error documents (often in <installdir>\conf\httpd.conf on Win32), if
not I've no idea...

HTH,
Ciaran

-- 
Ciaran McCreesh
mail:        keesh@users.sourceforge.net
web:         http://www.opensourcepan.com/


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

Date: Thu, 15 Mar 2001 15:01:09 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Passing Parameters
Message-Id: <slrn9b1gt6.5uc.tadmc@tadmc26.august.net>

plop740@mail.ru <plop740@mail.ru> wrote:
>I need to pass one parameter when I call a cgi script by a html form
>(POST), and that parameter to be used in the script.


Make a "hidden" <form> element containing the parameter.

Note that your question has nothing at all to do with Perl. If
you were writing your CGI programs in Java or Visual Basic,
the answer would be the same.


>I suppose the method is to call script.cgi?parameter or something like
>that, but how to use it after, in the script ?


You access it the same way you access non-hidden form values.

The browser will handle the encoding of the parameter, the CGI.pm
module will decode it for you.


>You have guessed that I am a newbie, I suppose :-)


It is important that you develop the ability to "partition" your
problem, so that you know how to go about researching a fix.

You do not have a Perl question. You have a CGI or HTML question.

You should have asked in a newsgroup where your question was
on-topic such as:

      comp.infosystems.www.authoring.cgi
      comp.infosystems.www.authoring.html


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Thu, 15 Mar 2001 17:24:10 +0100
From: Mathieu Peltier <Mathieu.Peltier@netcourrier.com>
Subject: pb with a cgi script
Message-Id: <3AB0ECAA.25DBEB24@netcourrier.com>

Hi,

I would like to write a CGI script in order to upload a file (with
CGI.pm) and run a custom program (C) on it. The program can generate an
error, and I have to deal with. Why the following code is bad?

----------------------------
(...)
# $tmpfilname contains the upload file 

# results
print $q->h2('Results:');

$pid = open(RESULTS,"-|");
unless ( defined($pid) ) {
    error( $q, "Couldn't open pipe to subprocess." );
}

if ( $pid ) {
    # processus pere
    while (<RESULTS>) {
        print;
    }
    close RESULTS;

} else {
    # processus fils
    # $COMMAND contains the name of the C program
    exec $COMMAND, $tmpfilename;
    print $q->p( "Couldn't exec command." );
    exit 1;
}    
----------------------------

When an error occurs (core dump) in my C program, "Could'nt exec
command" is never displayed. When i modify $COMMAND in order to make an
error, the result looks like : 

-----------------------------
Title
File to proceed:
File name: p1.
Results:
   Content-Type: text/html; charset=ISO-8859-1
   Title
   File to proceed:
   File name: p1.
   Results:
   Couldn't exec the Equational Constraint Solver.
-----------------------------

Can someone help me? In advance thank you.

-- 
Mathieu Peltier


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

Date: Thu, 15 Mar 2001 14:10:18 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl 4
Message-Id: <2cj1btsp1cfhrnhqlh7qk61meqcpcb7p7s@4ax.com>

Kiwitter@qns.de wrote:

>no my os is System V unix  :-)

So why do you ask for a Linux version?    <boggle>

-- 
	Bart.


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

Date: Thu, 15 Mar 2001 15:23:58 GMT
From: trammell@bayazid.hypersloth.net (John Joseph Trammell)
Subject: Re: Perl FAQ?
Message-Id: <slrn9b1las.gj3.trammell@bayazid.hypersloth.net>

On Wed, 14 Mar 2001 22:32:13 -0600, kellyboy <kellyboy@nospanner> wrote:
> true,,,but these faq that yahoo came up still doesn't have answer to my
> question...  :-)

I bet you a brewskie that either (a) the answer is in the bundled
Perl documentation, or (b) you're asking the wrong question.  :-)

I say this from experience -- there's a lot of good stuff in the FAQ.
Poke around in www.perldoc.com if you have the time.



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

Date: Thu, 15 Mar 2001 11:12:25 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: Perl FAQ?
Message-Id: <comdog-4795B4.11122515032001@news.panix.com>

In article <tb04b34mpo0885@corp.supernews.com>, "kellyboy" 
<kellyboy@nospanner> wrote:

> Boy... I ve got two book on perl but still dont find what Im looking for...
> I 've tried the Net and its hard to find the 'specific' answer because such
> "info" im looking for on the Net is not really organized as I hoped...I
> tried search engine such as yahoo and thier responds is really way off point
> from the search word I used... so thats why I (in frustration) posted this
> "faq" question cux I needed a short cut to answer  :-)

have you tried Perldoc.com?

    http://www.perldoc.com

-- 
brian d foy <comdog@panix.com>



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

Date: Thu, 15 Mar 2001 16:51:40 GMT
From: "Lawrence Brodeur" <lbrodeur@NOSPAMwdconsulting.com>
Subject: Pipe delimited string parsing or Newbie needs a clue
Message-Id: <wq6s6.16415$R_6.1740398@newsread2.prod.itd.earthlink.net>

Hi, thanks for taking the time to look at this.

I have a file of pipe delimited records which I need to parse.

I need to modify each field in each record and write that to a new file.

I have been going around in circles with while and split and am at a loss.

While I've never been a strong proponant of spoon feeding, can someone
please help?

tia


larry




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

Date: Thu, 15 Mar 2001 13:04:53 -0500
From: "Darryl Olthoff" <olthoff@multiboard.com>
Subject: Re: Pipe delimited string parsing or Newbie needs a clue
Message-Id: <98r087$nq$1@panther.uwo.ca>

> I have a file of pipe delimited records which I need to parse.
>
> I need to modify each field in each record and write that to a new file.
>
> I have been going around in circles with while and split and am at a loss.
>
> While I've never been a strong proponant of spoon feeding, can someone
> please help?

open(SRC, filename) || die("Unable to open source file: filename\n");
open(DST, '>' . dest_filename) || die("Unable to open new file\n");
while (<SRC>) {
  chomp;
  ($field1, $field2...) = split(/\|/, $_);
  $field1 = 'something new';
  printf(DST "%s\n", join('|', $field1, $field2...));
};
close(SRC);
close(DST);
unlink(filename);
rename(dest_filename, filename);




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

Date: Thu, 15 Mar 2001 13:13:24 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Pipe delimited string parsing or Newbie needs a clue
Message-Id: <Pine.A41.4.21.0103151309040.11922-100000@ginger.libs.uga.edu>

On Thu, 15 Mar 2001, Lawrence Brodeur wrote:

> Hi, thanks for taking the time to look at this.
> 
> I have a file of pipe delimited records which I need to parse.
> 
> I need to modify each field in each record and write that to a new file.
> 
> I have been going around in circles with while and split and am at a loss.
> 
> While I've never been a strong proponant of spoon feeding, can someone
> please help?


use Psi::ESP;

split /\|/;


I could be wrong.  :-)

Brad



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

Date: Thu, 15 Mar 2001 12:02:40 -0600 (CST)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Print own "die" message
Message-Id: <11808-3AB103C0-3@storefull-243.iap.bryant.webtv.net>

 
Re: Print own "die" message   
 
brondsema@my-deja.com 
> open(F, "file.txt") or die ("Can't open datafile: $!"); 

Thanks, Dave. I guess your post showed up a little late, though. I've
got that part and it seems simple to me now without having to use
CGI::Carp qw(fatalsToBrowser).

I've now trying to die with "system" (see topic change). Printing a
failure with a shell operation or using "system" appears to be a horse
of a different color, and more difficult.
   
--Dennis



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

Date: Thu, 15 Mar 2001 17:50:29 +0100
From: "MaxyM" <mapow@hi.hinet.hr>
Subject: Read to :
Message-Id: <98qrvu$cvfq$1@as121.tel.hr>


Let's say:

my $var1="Adi:2000:yes:res";

question:

how to read $var1 so that the results are:

Adi
2000
yes
res

sign ":" separates.






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

Date: Thu, 15 Mar 2001 18:12:11 +0000
From: Ciaran McCreesh <ciaran.mccreesh@useaddressbelow.please>
Subject: Re: Read to :
Message-Id: <sTyRpJA7XQs6IwNO@harlawroad.freeserve.co.uk>

In article <98qrvu$cvfq$1@as121.tel.hr> (whatever that means), MaxyM
<mapow@hi.hinet.hr> writes
>my $var1="Adi:2000:yes:res";

foreach $item (split /:/, $var1) {
  print "$item\n";
}

if I understand you...

Ciaran

-- 
Ciaran McCreesh
mail:        keesh@users.sourceforge.net
web:         http://www.opensourcepan.com/


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

Date: Thu, 15 Mar 2001 13:14:36 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Read to :
Message-Id: <Pine.A41.4.21.0103151314160.11922-100000@ginger.libs.uga.edu>

On Thu, 15 Mar 2001, MaxyM wrote:
> my $var1="Adi:2000:yes:res";
> 
> question:
> 
> how to read $var1 so that the results are:
> 
> Adi
> 2000
> yes
> res
> 
> sign ":" separates.

See perldoc -f split


Brad



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

Date: Thu, 15 Mar 2001 15:21:39 +0100
From: sowiso@snailsen.de
Subject: setuid don't work
Message-Id: <3AB0CFF3.50DD2B5F@snailsen.de>

Hi,
I want to write a script tha run under root permissions also it was
start y someone else.
my simple test script for setuid look like this:

#!/usr/bin/perl -w
print "real user: ".getpwuid($<)."\n";
print "eff user: ".getpwuid($>)."\n";


the owner of the file ist root and i have set the suid bit with 'chmod
u+s test.pl'
when I start the script as root I got the follwing output:
real user: root
eff user: root

when the user sowiso runs the script I only got this error:
Can't do setuid

if I change the owner of the file to sowiso and runs it as root I got:
real user: root
eff user: sowiso

starting it as user sowiso I got the same error as before :-(

can someone tell me what i make wrong?

nils


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

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 V10 Issue 494
**************************************


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