[17597] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5017 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 2 18:05:33 2000

Date: Sat, 2 Dec 2000 15:05:09 -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: <975798309-v9-i5017@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 2 Dec 2000     Volume: 9 Number: 5017

Today's topics:
        "use strict" vs my & local (Stan Brown)
    Re: "use strict" vs my & local (Andrew Johnson)
    Re: "use strict" vs my & local <rick.delaney@home.com>
    Re: (no subject) (David H. Adler)
        Anonymous Array Reference ?? (OTR Comm)
    Re: array of unique random numbers <joe+usenet@sunstarsys.com>
    Re: array of unique random numbers (Alan Barclay)
    Re: array of unique random numbers <W.Hielscher@mssys.com>
    Re: Counting (Tad McClellan)
        Grappling wth space (Blstone77)
    Re: Grappling wth space <uri@sysarch.com>
    Re: Grappling wth space (Mark Ferguson)
    Re: Help needed: how to get information (path) where Pe nobull@mail.com
        Help with multipart form <jack.haberle@bigfoot.com>
    Re: I Have Active Perl--Now What? <Petri_member@newsguy.com>
        OT sort(1) (was Re: sorting a file...) <rick.delaney@home.com>
        SAMS-Perl in 24hrs <graphi@-nospam-mouldmaking.freeserve.co.uk>
    Re: SAMS-Perl in 24hrs (Tad McClellan)
        String Manipulation <jbou@bunker79.fsnet.co.uk>
    Re: String Manipulation (Tad McClellan)
    Re: String Manipulation nobull@mail.com
    Re: String Manipulation <jbou@bunker79.fsnet.co.uk>
        Superuser must not run ... (Otto Wyss)
    Re: Superuser must not run ... <VincentMurphy@mediaone.net>
    Re: Superuser must not run ... (Tad McClellan)
    Re: Using goto (Tad McClellan)
    Re: Why? <rosie@dozyrosy.plus.com>
    Re: Why? (Tad McClellan)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 2 Dec 2000 15:43:13 -0500
From: stanb@panix.com (Stan Brown)
Subject: "use strict" vs my & local
Message-Id: <90bmt1$hq6$1@panix3.panix.com>

	I am trying to do the equivelant of a C "static" variable definition.

	That is I want to have a structure (turns out to be a hash oof hashes,
	if it matters) that is visible in a subsrotuine, and retains it's
	values acros calls. I would prefer not to have to decalre it in main,
	and pas it back & forth from the subroutine, since it's state data of
	interest only to that subroutine, But it needs to retain the value as I
	basicly using the subroutine to cache database results.

	I am curently uising "use strict", and this seems to interfere with
	even declaring the structure as "local" in main, and having it visible
	in the subbroutine, which, if I read the doc's corectly should be one
	way of doing this.




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

Date: Sat, 02 Dec 2000 21:30:59 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: "use strict" vs my & local
Message-Id: <nSdW5.30679$Z9.1480015@news1.rdc1.mb.home.com>

In article <90bmt1$hq6$1@panix3.panix.com>,
 Stan Brown <stanb@panix.com> wrote:
> 	I am trying to do the equivelant of a C "static" variable definition.
> 
> 	That is I want to have a structure (turns out to be a hash oof hashes,
> 	if it matters) that is visible in a subsrotuine, and retains it's
> 	values acros calls. I would prefer not to have to decalre it in main,
> 	and pas it back & forth from the subroutine, since it's state data of
> 	interest only to that subroutine, But it needs to retain the value as I
> 	basicly using the subroutine to cache database results.

Create a lexical block and define your private (lexical) variable
and your subroutine within that block, and afterwards only that sub
can access that variable:

    #!/usr/bin/perl -w
    use strict;

    {
        my $static = 41;

        sub foo {
            print "$static\n";
            $static++;
        }

    }

    foo();
    foo();
    __END__

You need to put the block before any code that refers to the
subroutine, or use a BEGIN block to ensure the block is compiled
early.

regards,
andrew

-- 
Andrew L. Johnson   http://members.home.net/andrew-johnson/
      There ain't nothin' in this world that's worth being a snot over.
          -- Larry Wall in <1992Aug19.041614.6963@netlabs.com>


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

Date: Sat, 02 Dec 2000 21:33:24 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: "use strict" vs my & local
Message-Id: <3A296E06.E4B1722A@home.com>

[posted & mailed]

Stan Brown wrote:
> 
>         I am trying to do the equivelant of a C "static" variable definition.

See the section "Persistent Private Variables" in perlsub.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 2 Dec 2000 21:00:42 GMT
From: dha@panix6.panix.com (David H. Adler)
Subject: Re: (no subject)
Message-Id: <slrn92ionq.abh.dha@panix6.panix.com>

On Tue, 28 Nov 2000 16:16:42 GMT, Flint Slacker <flint@flintslacker.com> wrote:
>
>use Image::Size;

 ...and perhaps Subject::Line.  :-)

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
for (('to you', 'dear '.shift)[0,0,1,0]) { print "Happy birthday $_" }
	- perl code for wishing someone a happy birthday
		Courtesy of purl


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

Date: Sat, 02 Dec 2000 22:25:42 GMT
From: otrcomm***NO-SPAM***@wildapache**NO-SPAM***.net (OTR Comm)
Subject: Anonymous Array Reference ??
Message-Id: <3a297046.3634383928@news.wildapache.net>

Hello,

This is probably a strange question, but I need to figure something out.

I have some code:

$card_values = [qw(one two three four)];  
$card_default = qq(one);
%card_types = ('one'=>'Visa','two'=>'Master Card','three'=>'Discover','four'=>'American Express');

print out "\ncard_values = $card_values, card_values0 = @$card_values[0]\n\n" if ($DEBUG gt 0);
           
print $query->popup_menu(-name=>'card_type',
                                -values=>$card_values,
                                -default=>$card_default,
                                -labels=>\%card_types),

that works fine.

However, I would like to be able to read in $card_values from an external configuration file and the
have the popup_menu contain the correct 'values'.

I have an external configuration file where I DO predefine variables (i.e., $var1 = "something') and
then can access the value of $var1 in my script.  However, when I include $card_values = [qw(one two
three four)]; in my configuration file and try to access $card_values in my script, I just get the
string [qw(one two three four)], not the reference to the anonymous array.

Does anyone know how perl interprets the statement:

$card_values = [qw(one two three four)]; 

and how I can get it to interpret:

$card_values = "[qw(one two three four)]";

the same way?

I hope this make some sense.

Thanks,
Murrah Boswell


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

Date: 02 Dec 2000 14:38:09 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: array of unique random numbers
Message-Id: <m3g0k6r4v2.fsf@mumonkan.sunstarsys.com>

Wolfgang Hielscher <W.Hielscher@mssys.com> writes:

> Joe Schaefer wrote:
> > gorilla@elaine.furryape.com (Alan Barclay) writes:
> > > #!/usr/local/bin/perl
> > >
> > > while($count<50){
> > >       my $try=int rand(10000);
> > >       if(not $got{$try}){
> > >               $got{$try}=$count++;
> > >       }
> > > }
> > >
> > > foreach(sort { $got{$a} <=> $got{$b} } keys %got){
> > >       print "value $got{$_} is $_\n";
> > > }
> > 
> > Just curious- why sort them? Is it less random to just
> > use
> > 
> > @values =  keys %got;
> 
> In the foreach ( sort ... ) loop Alan prints out the random numbers in
> the order they have been generated. No assignment is done.

Right.  What I'm asking is (I think :), does the list that 
"keys" returns become less random (due to "reordering") than 
the list created using the original order in which the values 
were generated? (If so, the "sort" would be necessary).

perldoc -f keys

Returns a list consisting of all the keys of the named hash.  (In a
scalar context, returns the number of keys.)  The keys are returned in
an apparently random order.  The actual random order is subject to
change in future versions of perl, but it is guaranteed to be the same
order as either the C<values()> or C<each()> function produces (given
that the hash has not been modified).
 ...

Again, does "apparently random" = "random" (w.r.t. OP's question) ?
I think the answer depends on how hashes are implemented in perl.

-- 
Joe Schaefer


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

Date: 2 Dec 2000 20:25:48 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: array of unique random numbers
Message-Id: <975788704.60894@elaine.furryape.com>

In article <m3g0k6r4v2.fsf@mumonkan.sunstarsys.com>,
Joe Schaefer  <joe+usenet@sunstarsys.com> wrote:
>Right.  What I'm asking is (I think :), does the list that 
>"keys" returns become less random (due to "reordering") than 
>the list created using the original order in which the values 
>were generated? (If so, the "sort" would be necessary).

It's very complicated, but basically under similar conditions,
the same keys will be sorted in the same way.

This program prints '12' twice for me, even though in assignments
1 & 2, 1 is assigned first, and in assignments 3 & 4 2 is
assigned first.

#!/usr/local/bin/perl -w

$a{1}=1;
$a{2}=2;

print keys %a,"\n";

$b{2}=3;
$b{1}=4;

print keys %b,"\n";


BTW, thinking about it later, the sort could be dropped by printing
within the first loop. Both techiques are probably useful in different
ways.


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

Date: Sat, 02 Dec 2000 21:43:32 +0100
From: Wolfgang Hielscher <W.Hielscher@mssys.com>
Subject: Re: array of unique random numbers
Message-Id: <3A295EF4.60164ED1@mssys.com>

Joe Schaefer wrote:
> Right.  What I'm asking is (I think :), does the list that
> "keys" returns become less random (due to "reordering") than
> the list created using the original order in which the values
> were generated? (If so, the "sort" would be necessary).

Oh, sorry, now _I_ see what you ask for.


> Again, does "apparently random" = "random" (w.r.t. OP's question) ?
> I think the answer depends on how hashes are implemented in perl.

Or how hashing is implemented in general. I'm not really an expert with
hashes but if I got it correctly, the hash keys are _sorted_ via keys()
according to the order imposed by the implementation/internal
representation of the hashes. As a consequence, several permutations of
a given list of numbers (see previous postings) may be mapped to exactly
the same permutation via keys(). Intuitively (oh, I'm not an expert on
random numbers too :( ) I would say that this is "less random" in the
sense that several permuted lists are never generated.


Hopefully an expert will eventually read this posting because I'm (also)
interested in turning my intuition into knowledge.

Hth anyway,
Cheers
   Wolfgang


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

Date: Sat, 2 Dec 2000 13:51:39 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Counting
Message-Id: <slrn92ih5r.cg2.tadmc@magna.metronet.com>

Todd Anderson <todd@mrnoitall.com> wrote:

>Any advice is appreciated.


Indent your code so as to indicate its structure.


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


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

Date: 02 Dec 2000 19:26:38 GMT
From: blstone77@aol.com (Blstone77)
Subject: Grappling wth space
Message-Id: <20001202142638.13324.00002404@ng-bd1.aol.com>


Hello, can anyone help me with this problem I am having with spaces in a
string? I have a string which contains keywords. I get rid of spaces from the
beginning and end using this:

  for ($Keywords) {
       s/^\s+//;
       s/\s+$//;
   }

I also get rid of commas between keywords the same substitution way. The
problem is, some people put multiple spaces between keywords, and rather than a
string like

Big Furry things and fruit

  I get..

Big  Fuzzy      things   and fruit

What I am looking for is a way to eliminate all spaces that take up more than
one character postition. How can I do this and can it besimply  incorporated
into the code above? Thanks for any help on this.



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

Date: Sat, 02 Dec 2000 19:34:53 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Grappling wth space
Message-Id: <x7puja8vmr.fsf@home.sysarch.com>

>>>>> "B" == Blstone77  <blstone77@aol.com> writes:

  B> What I am looking for is a way to eliminate all spaces that take up
  B> more than one character postition. How can I do this and can it
  B> besimply incorporated into the code above? Thanks for any help on
  B> this.

perldoc -f tr

	tr/ //s

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: 2 Dec 2000 12:09:34 -0800
From: mefergus@Stanford.EDU (Mark Ferguson)
Subject: Re: Grappling wth space
Message-Id: <90bktu$asj@gsb-latinum.Stanford.EDU>

Blstone77 <blstone77@aol.com> writes:
>
>Hello, can anyone help me with this problem I am having with spaces in a
>string? I have a string which contains keywords. I get rid of spaces from the
>beginning and end using this:
>
>  for ($Keywords) {
>       s/^\s+//;
>       s/\s+$//;
>   }
>
>I also get rid of commas between keywords the same substitution way. The
>problem is, some people put multiple spaces between keywords, and rather than a
>string like
>
>Big Furry things and fruit
>
>  I get..
>
>Big  Fuzzy      things   and fruit
>
>What I am looking for is a way to eliminate all spaces that take up more than
>one character postition. How can I do this and can it besimply  incorporated
>into the code above? Thanks for any help on this.
>

How about

   s/^\s+|\s+$//g;  # leading and trailing space in one go
   s/[,\s+]+/ /g;   # commas and more than one space get one space



-- 
Mark Ferguson <Mark.Ferguson@Stanford.EDU> 


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

Date: 02 Dec 2000 19:44:53 +0000
From: nobull@mail.com
Subject: Re: Help needed: how to get information (path) where Perl script is located?
Message-Id: <u9u28mmwui.fsf@wcl-l.bham.ac.uk>

"DS" <oooo@ooooooo.com> writes:

> I need that information during runtime. Running Perl under Win98. %ENV hash
> does not contain the information needed. Any help is appreciated.

There is no simple method - you'll have to get the module that does it
from CPAN as mentioned in the FAQ.

[I won't tell you the name of the module - looking throgh CPAN at
what's avialable may help answer of questions you've not yet asked ]

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


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

Date: Sat, 02 Dec 2000 22:12:20 GMT
From: RUATurtle <jack.haberle@bigfoot.com>
Subject: Help with multipart form
Message-Id: <90bs42$r44$1@nnrp1.deja.com>

Hi,

I'm trying to write a script to emulate a user entering data via web
pages. (I'm told this will make it easier to do system testing ...)

I'm having a problem POSTing a multipart form.  Snippets from the last
way I've tried follow:

 .
 .
$CF_pairs{'filename'}        = '/home/Bank.asf';
$CF_pairs{'fileref'}        = ["/home/Bank.asf"];
 .
 .

$next_url = url ("http://....ContentFormInsertResult");

$req = POST $next_url,
            Content_Type => 'form-data',
            Content => \%CF_pairs;
$content = $ua->request ($req)->as_string;
print $content;

I'm getting a "Corrupt form data: premature ending" error.


If you haven't guessed already, I'm new at this.  Nobody else here knows
the terrain, either.

The only documentation I've been able to find is that for
lib::HTTP::Request::Common(3).

Can anyone point to any other useful documentation?  Anyone have any
idea where I've gone astray?

TIA for any help!
-Jack


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


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

Date: 2 Dec 2000 10:52:17 -0800
From: Petri Oksanen <Petri_member@newsguy.com>
Subject: Re: I Have Active Perl--Now What?
Message-Id: <90bgd103mc@edrn.newsguy.com>

In article <3A292BDF.148F0702@sirius.com>, Wayne says...
>> I usually go to a DOS box and do 'perl foobar.pl' but if you
>> RTFM that came with the AP installation, you'll find out how
>> to associate the extension so you could just click on the
>> script, if that fluffs your fur.

> I'd like to see you find that in TFM that is provided with the
> package.

Are you are talking about associating the Perl interpreter to files with
extension .PL?
Unless you yourself unchecked that option during the installation, file
association has already been done for you.
An exception to the rule, according to TFM, is if you installed Perl without
administrative rights on your system. In that case file association will be
disabled.

> Just copy the section and send it to me as proof that it is
> in TFM.

ActivePerl has installed a massive set of documentation on your system.
Learn to use it and search in it as soon as you can, you will soon discover what
a great resource it really is.
As for this specific info, it is mentioned in the second link from the top in
the navigation.

Also, check out perlwin32, where it is mentioned that assoc.exe can be used to
create associations on NT.
Another way would be to just doubleclick some file of unknown type and
immediately choose what app to associate it with.
Remember to be logged in with admin rights.

> 1. Is the only item in the Start menu ActivePerl->Online
> Documentation?

Yes.
It's the only one you need!

> 2. How does one uninstall ActivePerl?

Go to "Add/Remove Programs" in the Control Panel.
Are you having problems?
What version of ActivePerl did you install and what system are you running?
Win2K?
Win9x?
If WinNT4, what Service Pack? (check with Start->Run->winver)


Petri Oksanen



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

Date: Sat, 02 Dec 2000 19:45:43 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: OT sort(1) (was Re: sorting a file...)
Message-Id: <3A2954C9.2926F95D@home.com>


Garry Williams wrote:
> 
> >>
> >>     $ sort -t\| -k1,1 -k2,2 <unsorted-filename >sorted-filename
> >
> >That might as well be
> >
> >    $ sort unsorted-filename >sorted-filename
> 
> Not unless the first field is a fixed length field.

That's exactly my point.  Neither one of the above gives a reasonable
sort when the first field is numbers.  And since the second field is
obviously fixed width, I see no reason to prefer an ASCII sort of field
one with a subsort on field two to an ASCII sort of the whole thing.  If
you don't care that 3 comes after 29 then I can't imagine caring if it
comes before or after 30.

> >But it probably really should be
> >
> >    $ sort -t\| -k1n,2 unsorted-filename >sorted-filename
> 
> The data sample indicated that there were non-numeric values in the
> first field.

So?  It will appear first then.  Or maybe some sorts put it last? 
Either way, unless the first field is fixed width, a numeric sort is
clearly better on numbers.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Sat, 2 Dec 2000 22:11:07 -0000
From: "Graphi_" <graphi@-nospam-mouldmaking.freeserve.co.uk>
Subject: SAMS-Perl in 24hrs
Message-Id: <t2isol2q1bsk9b@corp.supernews.co.uk>

Running an excersise in the book (p.53) for Prime numbers. The following
errors are encountered:
!# usr/local/bin/perl -w

$maxprimes=10; #can't modify line 3- not in scalar assignment at primes.pl
near "10;"
$value=1;
$count=0;
while($count > $maxprimes) {
$value=++;                                     #syntax error at primes.pl
line 6, near "++;"
$composit=0;
OUTER: for ($i=2; $i<$value; $i++) {
for($j=$i; $j<value; $J++) {
if (($j*$i)==$value) {
$composit=1;
last OUTER;
}
}
}
if (! $composit) {
$count++;
print "$value is prime\n";
}
}

Anyone know what's wrong?
--
Graphi
Mould Making: http://www.mouldmaking.freeserve.co.uk
Web Design: http://graphi.port5.com

Price per Graphic, Page or full site!





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

Date: Sat, 2 Dec 2000 16:30:21 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: SAMS-Perl in 24hrs
Message-Id: <slrn92iqfd.ctl.tadmc@magna.metronet.com>

Graphi_ <graphi@-nospam-mouldmaking.freeserve.co.uk> wrote:
>Running an excersise in the book (p.53) for Prime numbers. The following
>errors are encountered:
>!# usr/local/bin/perl -w
>
>$maxprimes=10; #can't modify line 3- not in scalar assignment at primes.pl
>near "10;"

I don't get any messages for that line...

>$value=1;
>$count=0;
>while($count > $maxprimes) {


Err, $count is 0, $maxprimes is 10, this loop never executes!


>$value=++;                                     #syntax error at primes.pl
>line 6, near "++;"

   $value++;

>$composit=0;
>OUTER: for ($i=2; $i<$value; $i++) {
>for($j=$i; $j<value; $J++) {
              ^^       ^

   for($j=$i; $j<$value; $j++) {
                 ^        ^


>Anyone know what's wrong?


Yes. The indenting has been broken.

There is also no "use strict" pragma.

And having a loop body than can never be executed is awfully suspicious.


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


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

Date: Sat, 2 Dec 2000 19:08:04 -0000
From: "James Boulter" <jbou@bunker79.fsnet.co.uk>
Subject: String Manipulation
Message-Id: <90bhb9$uch$1@newsg2.svr.pol.co.uk>

Dear all,

I have the string "James <email address>"

How can I get the information into two separate variables without the
brackets.

James





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

Date: Sat, 2 Dec 2000 13:56:56 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: String Manipulation
Message-Id: <slrn92ihfo.cg2.tadmc@magna.metronet.com>

James Boulter <jbou@bunker79.fsnet.co.uk> wrote:
>
>I have the string "James <email address>"
>
>How can I get the information into two separate variables without the
>brackets.


   my($name, $addr) = /(.*?)\s*<(.*)>/;


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


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

Date: 02 Dec 2000 19:49:20 +0000
From: nobull@mail.com
Subject: Re: String Manipulation
Message-Id: <u9sno6mwn3.fsf@wcl-l.bham.ac.uk>

"James Boulter" <jbou@bunker79.fsnet.co.uk> writes:

> Dear all,
> 
> I have the string "James <email address>"
> 
> How can I get the information into two separate variables without the
> brackets.

This depends on exactly how fixed the string format is.

my ($name,$address) = /^(.*) <(.*)>$/

In general the mail header format is way more complex than your
specific example and there are modules avialable for parsing mail
headers.

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


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

Date: Sat, 2 Dec 2000 21:36:00 -0000
From: "James Boulter" <jbou@bunker79.fsnet.co.uk>
Subject: Re: String Manipulation
Message-Id: <90bq0o$crj$1@news5.svr.pol.co.uk>

Thank you very much for your help!
"James Boulter" <jbou@bunker79.fsnet.co.uk> wrote in message
news:90bhb9$uch$1@newsg2.svr.pol.co.uk...
> Dear all,
>
> I have the string "James <email address>"
>
> How can I get the information into two separate variables without the
> brackets.
>
> James
>
>
>




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

Date: Sat, 2 Dec 2000 22:32:51 +0100
From: otto.wyss@bluewin.ch (Otto Wyss)
Subject: Superuser must not run ...
Message-Id: <1ekzjn6.1r2k5gjqwfn12N%otto.wyss@bluewin.ch>

I just wanted to use "perldoc -f select" on a standalone computer as
root and got "Superuser must not run /usr/bin/perldoc without security
audit and taint checks". What does this mean and what do I have to do to
use perldoc as root "without creating a user account"?

O. Wyss 


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

Date: Sat, 02 Dec 2000 21:51:00 GMT
From: Vinny Murphy <VincentMurphy@mediaone.net>
Subject: Re: Superuser must not run ...
Message-Id: <m3lmty30az.fsf@vmurphy-hnt1.athome.net>

>>>>> "Otto" == Otto Wyss <otto.wyss@bluewin.ch> writes:

    Otto> I just wanted to use "perldoc -f select" on a standalone computer
    Otto> as root and got "Superuser must not run /usr/bin/perldoc without
    Otto> security audit and taint checks". What does this mean and what do
    Otto> I have to do to use perldoc as root "without creating a user
    Otto> account"?

From perldoc perldoc

       -U run insecurely
            Because perldoc does not run properly tainted, and is
            known to have security issues, it will not normally
            execute as the superuser.  If you use the -U flag, it
            will do so, but only after setting the effective and
            real IDs to nobody's or nouser's account, or -2 if
            unavailable.  If it cannot relinguish its privileges,
            it will not run.

    Otto> O. Wyss

--vjm


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

Date: Sat, 2 Dec 2000 16:33:46 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Superuser must not run ...
Message-Id: <slrn92iqlq.ctl.tadmc@magna.metronet.com>

Otto Wyss <otto.wyss@bluewin.ch> wrote:

>I just wanted 


You should never _want_ to do something as root.

You should always want to do things as a normal (less privileged)
user.

You should only do things as root that *require* root.


People that do routine things as root should not have the
root password. They do not know enough to be entrusted
with root.


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


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

Date: Sat, 2 Dec 2000 09:34:09 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Using goto
Message-Id: <slrn92i231.cae.tadmc@magna.metronet.com>

Shawn Smith <SPAM_loginprompt@yahoo.com> wrote:
>On Fri, 1 Dec 2000 08:12:49 -0500, tadmc@metronet.com (Tad McClellan)
>wrote:

>>perl (not Perl) compiles your scripts on every run regardless
>>of whether there are gotos or not.
>
>OK. perl is the interpreter, perl is the interpreter, perl is...


You seem to have a grasp on part of the secret Perl handshake  :-)

(But perl is really a compile-and-go thingie. It is _both_
 a compiler and an interpreter. A floor wax and a dessert
 topping.
)


>>To find out how perl runs, consult the misleadingly named Perl doc:
>>
>>   perldoc perlrun
>
>From perlrun:
>"The special value 00 will cause Perl to slurp files in paragraph
>mode. The value 0777 will cause Perl to slurp files whole because
>there is no legal character with that value."
>
>Slurp?


   s/slurp/read the entire file contents all the way up to EOF/;


>Yes. Rereading the camel it said (something like) for maintainability
>gotos should be avoided.


There is nothing Perl-specific about gotos.

Gotos are "bad" in any language.


>Another hurdle is that some of these scripts have functions that are a
>dozen pages long. I "think" these should be broken down into smaller
>functions.


You are likely correct there too.


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


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

Date: Sat, 2 Dec 2000 21:24:45 -0000
From: Rosemary I H Powell <rosie@dozyrosy.plus.com>
Subject: Re: Why?
Message-Id: <MPG.14924d9447fe05a0989741@usenet.plus.net>

In article <gaqV5.18067$II2.1788036@newsread2.prod.itd.earthlink.net> 
dated Thu, 30 Nov 2000 10:42:20 GMT,  our revered colleague Ed Grosvenor 
(secursrver@hotmail.com) was so kind as to advise ...

>  However, I believe that a good portion of users
> of this newsgroup find it easier and more productive to shoot out a quick
> question here than pour over hundreds of pages looking for that specific
> answer.
> 
Maybe they do, but why should they expect OTHER people to do their work 
for them?? It's just as time comsuming and boring for them too. 

Rosemary
-- 
----------------------------------------------------------------
| Rosemary I.H.Powell  EMail: Home: rosie@dozyrosy.plus.com    |
|                             Work: r.i.h.powell@rl.ac.uk      |
|                       http://NeedleworkSamplers.com/         |
|                       http://www.CavalierKingCharles.com/    |
----------------------------------------------------------------


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

Date: Sat, 2 Dec 2000 16:36:18 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Why?
Message-Id: <slrn92iqqi.ctl.tadmc@magna.metronet.com>

Rosemary I H Powell <rosie@dozyrosy.plus.com> wrote:
>In article <gaqV5.18067$II2.1788036@newsread2.prod.itd.earthlink.net> 
>dated Thu, 30 Nov 2000 10:42:20 GMT,  our revered colleague Ed Grosvenor 
>(secursrver@hotmail.com) was so kind as to advise ...
>
>>  However, I believe that a good portion of users
>> of this newsgroup find it easier and more productive to shoot out a quick
>> question here than pour over hundreds of pages looking for that specific
>> answer.
>> 
>Maybe they do, but why should they expect OTHER people to do their work 
>for them?? It's just as time comsuming and boring for them too. 


Because their time is more valuable than (hundreds of) other people's 
time of course.

The OPs are important and busy. People that hang around in newsgroups
are just silly lackeys than can be tricked into doing the OPs
work for them.

It's very Tom Sawyer-ish.


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


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

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


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