[16617] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4029 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 16 03:05:29 2000

Date: Wed, 16 Aug 2000 00:05:15 -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: <966409514-v9-i4029@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 16 Aug 2000     Volume: 9 Number: 4029

Today's topics:
    Re: ARRAY of HASH values <glodalec@yahoo.com>
    Re: ARRAY of HASH values <jeff@vpservices.com>
        array weirdness. johnvert@my-deja.com
    Re: array weirdness. <lr@hpl.hp.com>
        Byte Size of a Scalar -- How? <grichards@flashcom.net>
    Re: Certain Items in a string <lr@hpl.hp.com>
    Re: CHOMP not working <vrillusions@mail.com>
    Re: crypt function kevin+usenet@suberic.net
        DBI <webmaster@fpos.agava.ru>
    Re: Dereferencing a hash in CGI.PM (Keith Calvert Ivey)
    Re: From 1,000,000 To 1.000.000 Please .. (Keith Calvert Ivey)
    Re: From 1,000,000 To 1.000.000 Please .. <rga@io.com>
    Re: Help a little needed from regex expert please (Keith Calvert Ivey)
        Help with a line of code please! <info@cirestaurant.com>
    Re: Help with a line of code please! (Neil Kandalgaonkar)
        help with c2ph or pstruct truckaxle@my-deja.com
    Re: how can I optimize a tied hash for speed <webqueen@my-deja.com>
    Re: how can I optimize a tied hash for speed <webqueen@my-deja.com>
    Re: Mail with attachments (David Efflandt)
    Re: need help with msql and perl (Keith Calvert Ivey)
    Re: need help with msql and perl <lr@hpl.hp.com>
    Re: Net::Dns broken, gethostbyname OK (David Efflandt)
    Re: Pattern match - Extract info from a page <valued_customers@emai.com>
    Re: Pattern match - Extract info from a page <valued_customers@emai.com>
    Re: Perl - Blinking Text (Gwyn Judd)
    Re: Perl - Blinking Text (Philip 'Yes, that's my address' Newton)
    Re: Perl - Blinking Text (BUCK NAKED1)
    Re: Perl - Blinking Text (BUCK NAKED1)
        postscript.. <webqueen@my-deja.com>
    Re: Problem with IIS4 <lr@hpl.hp.com>
    Re: Quiting a: while (<STDIN>) (Tony L. Svanstrom)
    Re: Quiting a: while (<STDIN>) (Tony L. Svanstrom)
    Re: Quiting a: while (<STDIN>) (Tony L. Svanstrom)
    Re: setuid question (?) (David Efflandt)
        Trouble finding keys of multidimesional array <danny@lennon.postino.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 16 Aug 2000 06:37:40 +0200
From: Mouse <glodalec@yahoo.com>
Subject: Re: ARRAY of HASH values
Message-Id: <399A1A94.CA4@yahoo.com>

Michael Carman wrote:
> 
> Mouse wrote:
> >
> > I have a subroutine which returns array of hashes.
> 
> No you don't. :)
> 
> > sub SYSGROUP_select
> > {
> >    my $sth = $dbh->prepare(qq(SELECT * FROM sysgroup)) ;
> >    $sth->execute ;
> >
> >    @ARRAY=();
> >    while (@row = $sth->fetchrow_array( ))
> 
> You declared $sth with my(), why not do the same for @row?
> 
> >    {
> >       %rec=();
> 
> You *need* to do 'my %rec' here instead. Explanation to follow.
> 
> >       $rec{ sysname } = $row[0];
> >       $rec{ sysdesc } = $row[1];
> >       push(@ARRAY,%rec);
> 
> This flattens your hash, pushing both values *and keys* onto @ARRAY.
> What you want to do is push on a reference to %rec.
> 
>     push(@ARRAY, \%rec);
> 
> Why? Arrays (and hashes) can only contain scalar values, not other
> arrays or hashes. References are scalars. Now, back to needing to
> localize %rec with my(): Since you're pushing a reference onto your
> array, you need it to be a different reference each time. (Otherwise you
> would just have many pointers to the same thing.) Using my() forces %rec
> to be a new variable each time through the loop.
> 
> >    }
> >    return @ARRAY ;
> > }
> >
> > Now I would like to read something like $ARRAY[3]{sysname}.
> >
> >   my @ARRAY=SYSGROUP_select();
> >   foreach $HASH (@ARRAY)
> >   {
> >      my %rec=%$HASH;
> 
> At least here you're expecting a hashref. You just don't have one.
> 
> >      print $rec{ sysname }," ",$rec{ sysdesc },"\n";  <--- Doesnt work
> 
> Are you running with strict and -w? What did the diagnostic say?
> Something about "not a HASH reference" maybe? This part is okay (though
> I'd write it differently). Fix the problem in your subroutine and I
> think you'll be okay.
> 
> -mjc

Hi !

Isnt that funny whenever I am asking something, I get tutorial of how to
use variables,which names
to use for variable etc...

Every variable I use has prefix "my", I just didnt write it, since I put
an example from my head.
I just needed a simple answer to solve my problem. And I got it. 
First change I needed was push(@ARRAY,{%rec}) instead of
push(@ARRAY,%rec)
Second, I must use $HASH->{name} instead of $HASH{name}

Thanks anyway.
Regards


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

Date: Tue, 15 Aug 2000 23:03:08 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: ARRAY of HASH values
Message-Id: <399A2E9C.97D9F12C@vpservices.com>

Mouse wrote:
> 
> Michael Carman wrote:
> > ...
> >
> 
> Isnt that funny whenever I am asking something, I get tutorial of how to
> use variables,which names
> to use for variable etc...
> 
> Every variable I use has prefix "my", I just didnt write it, since I put
> an example from my head.

Oh wonderful, you send in a script that is different than the one you
have problems with and then berate someone for offering advice on the
script you did send instead of reading your mind to know about the
script you didn't send.  I am sure this makes everyone very eager to
help you in the future.

-- 
Jeff


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

Date: Wed, 16 Aug 2000 05:32:36 GMT
From: johnvert@my-deja.com
Subject: array weirdness.
Message-Id: <8nd91k$naj$1@nnrp1.deja.com>

Hi, this question may seem trivial, but I can't find a logical
explanation for it: why does:
my @list=([1,2,3,4,5]);
print @{$list[0]};

outputs the string: 12345
while: print "@{$list[0]}";
outputs the string: 1 2 3 4 5?

Thanks,
 -- john


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


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

Date: Tue, 15 Aug 2000 23:26:26 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: array weirdness.
Message-Id: <MPG.1403d3ee4b63494798ac82@nntp.hpl.hp.com>

In article <8nd91k$naj$1@nnrp1.deja.com>, johnvert@my-deja.com says...
> Hi, this question may seem trivial, but I can't find a logical
> explanation for it: why does:
> my @list=([1,2,3,4,5]);
> print @{$list[0]};
> 
> outputs the string: 12345
> while: print "@{$list[0]}";
> outputs the string: 1 2 3 4 5?

perlfaq5: "Why do I get weird spaces when I
print an array of lines?"

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


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

Date: Tue, 15 Aug 2000 23:11:44 -0700
From: "Gabe" <grichards@flashcom.net>
Subject: Byte Size of a Scalar -- How?
Message-Id: <spkc0n45r5j138@corp.supernews.com>

File is uploaded via CGI, how can I learn its byte size so I can reject
files too big.

I tried saying if ($bytesread > 70000) {Reject();} but Perl didn't
understand.

Current code follows:

 my $file = $cgi->param('main');
 my $thumb = $cgi->param('thumb');
 my $thumbname = $fileid . 't.jpg';
 my $filename = $fileid . '.jpg';
 no strict;
 open (PIC, ">>/home/racquel/www/photos/$filename") or die &error;
 binmode $file;
 binmode PIC;
 while (my $bytesread = read($file,my $buffer,1024)) {
    print PIC $buffer;
 }
 close PIC;
 open (THUMB, ">>/home/racquel/www/photos/thumbs/$thumbname") or die &error;
 binmode $thumb;
 binmode THUMB;
 while (my $bytesread = read($thumb,my $buffer,1024)) {
     print THUMB $buffer;
 }
 close THUMB;

Gabe





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

Date: Tue, 15 Aug 2000 22:50:02 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Certain Items in a string
Message-Id: <MPG.1403cb62e35e07fd98ac81@nntp.hpl.hp.com>

[My apologies to Abigail, who (unless I also am plonked, which I doubt) 
will now have to see a Godzilla! post.  Awareness of my power to infict 
such pain has inhibited me from responding several times already, but 
now I must yield to force majeur.]

In article <3999D679.2B87FFB@stomp.stomp.tokyo>, 
godzilla@stomp.stomp.tokyo says...
> marxjkj123 wrote:
>  
> > Problem: I need to select certain items within a string.
>  
> > for example, I have a string($iw_Workarea) and I need to select
> > everything from Workarea on and put it into a variable called $test.
> > Basically, omitting everything preceeding \\Workarea.

 ...

> > $iw_Workarea = "Y:\\default\\main\\Web_Logic\\Workarea\\WL_Property_WA
>  
> > Result would should look like, $test = "Workarea\\WL_Property_WA";

 ...

> Once you straighten out your data, these two snippets:
> 
> $string =~ s!\\!//!g;

Convert each backslash to two forward slashes.

> $new_string =~ s!//!\\\\!g;

Convert each pair of forward slashes to two backslashes.

Hmmm.  Not idempotent, is it?
 
 ...

> For this line:
> 
> $start = index ($string, "Workarea");
> 
> your word, Workarea, can be an argument variable.
> 
> A known bug is a case of the same directory name
> twice or a number of multiple instances in an 
> address path, which is not very bright but, could 
> be. Some systems operators are not what I consider 
> Rocket Scientist material.

Then use rindex() instead of index()!
 
> My presumption is you have a minimum of
> twenty-five mounted hard drives or an
> extraordinary amount of partitions.
> Perhaps a combination of both. Y?

Off-topic and wrong.  Modern partition managers allow one to assign any 
drive letter arbitrarily.

 ...

> #!/usr/local/bin/perl
> 
> print "Content-Type: text/plain\n\n";

Always assuming a CGI program.  How boring!

> $string = "Y:\\default\\main\\Web_Logic\\Workarea\\WL_Property_WA";
> 
> $string =~ s!\\!//!g;

Whatever reason there is for this transformation is beyond my limited 
comprehension.  Especially because it leads to a wrong answer.

> $start = index ($string, "Workarea");
> 
> $new_string = substr ($string, $start, ((length ($string)) - $start));

The third argument is superfluous when one wants the entire end of the 
string.
 
> $new_string =~ s!//!\\\\!g;

So here comes the incorrect inverse transform.

> print $new_string;
> 
> exit;
> 
> 
> 
> PRINTED RESULTS:
> ________________
> 
> 
> Workarea\\WL_Property_WA

Which now has two backslashes where the original has just one.

Well, surely your creative English obfuscatory skills will rationalize 
this error.  I can hardly wait. 

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


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

Date: Wed, 16 Aug 2000 01:49:41 GMT
From: Todd Eddy <vrillusions@mail.com>
Subject: Re: CHOMP not working
Message-Id: <3999F340.D7E08401@mail.com>

THANK YOU!  Yea I knew that multiple white spaces are one, and that the
</FONT></TD> being on a second line doesn't do a thing to how its displayed,
just me being picky ;)

I was able to solve with just "$_[3] =~ s/\s+$//; # strip training
CR/LF/space/fish" part.  So it was one of those that was causing the problem.
Thank you alot.

*thought to self*
"Now that this half is done, now I have to set up the form processing script
that writes the info people enter into the file"  (ie, you'll probably being
hearing more from me)  ;)


Colin Keith wrote:

> In article <3998A1C8.33DEC691@mail.com>, vrillusions@mail.com wrote:
> >Notice how the </FONT></TD> is on a new line?  Thats what I am trying to
>
> Of course, you do realise that it doesn't make the slightest bit of
> difference in HTML, multiple white spaces are folded into just 1 unless
> you're inside <PRE> or <XMP> tags.
>
> >I tried the chomp function in both places to see if it made a
> >difference, and it didn't.  Here is the datafile:
> >
> >1|Todd|1|vrillusions@mail.com|Geoto|Streetsboro, OH
> >1|Lenny|1|mack@thehdcafe.com|FuzzyLogix|Akron, OH
> >0|Jim|1|jim@aol.com|GymSlayer|Somewhere, IN
> >1|Conan|0|Conan@aol.com|Conan the Barbarian|Unknown, CA
>
>   # do header bit making the header/tables
>   open(FH, "<datafile") || die "Content-Type: text/html\n\n Ack - $!";
>
>   my($td_font) = '  <TD><FONT FACE="Verdana, Arial" SIZE=2>';
>   my($font_td) = '</FONT></TD>';
>   while(<FH>){
>     /^\d\|(\w+)\|\d\|(.+)\@([a-zA-Z0-9\.-]+)\|([^\|]+)\|(.+?)\s*$/;
>     print "<TR ALIGN=\"LEFT\">\n",
>         "$td_font<A HREF=\"mailto:$2\@$3\">$1</A>$font_td\n",
>         "$td_font$4$font_td\n",
>         "$td_font$5$font_td\n</TR>\n\n";
>   }
>
> or:
>   while(<FH>){
>     @_ = (split('\|', $_))[1,3,4,5];
>     next if($#_ != 3); # for any spaces/broken lines
>     $_[3] =~ s/\s+$//; # strip training CR/LF/space/fish
>     print "<TR ALIGN=\"LEFT\">\n",
>         "$td_font<A HREF=\"mailto:$_[1]\">$_[0]</A>$font_td\n",
>         "$td_font$_[2]$font_td\n",
>         "$td_font$_[3]$font_td\n</TR>\n\n";
>   }
>
> Cus its hot and I'm lazy :)
> The ([^|]+) is because I've seen some weird stuff in people's call signs,
> also note the \|'s because | in a regexp means to 'or', so a|b 'a' or 'b'
> (which is why its such a pain that everyone uses it as a separating
> character) Note also that this does *no* checking for validity of the data
> (there is a .+ and [^|] in the regexp, so people can put dodgy code in
> there+. (See, whoever it was that picked me up on this, I haven't
> forgotten:)
>
> Col.
>
> ---
> Colin Keith
> Systems Administrator
> Network Operations Team
> ClaraNET (UK) Ltd. NOC

--
Todd Eddy
vrillusions@mail.com
http://www.vrillusions.com/




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

Date: 16 Aug 2000 02:24:10 +0100
From: kevin+usenet@suberic.net
Subject: Re: crypt function
Message-Id: <8ncqfq$5bj$1@localhost.ie.suberic.net>

In article <3999d081.10891009@news1.tninet.se>,
Jonas Nilsson <jonas.nilsson@mbox326.swipnet.se> wrote:
>I have a text file with username:password, the password is crypt. I
>want to have an: "e-mail me my password because I forgot it"
>-function. When I do that I only get the crypted version. How do I
>decrypt the password.

you don't.  crypt is a one way function.  alternatively you could
run a cracking program on it.  perl is not the best tool for this but
from my permanent newbie-cracker position i can offer:

 ------------------------------
#!/usr/bin/perl
use POSIX qw(isprint);

foreach $c (1..255) {
    push(@c, chr($c)) if isprint(chr($c));
}

sub brute {
    my($s, $e, $d) = @_;

    my($l, $r);
    if (length($d) > 8) {
	return "";
    } elsif (length($d) > 3) {
	if (crypt($d, $s) eq $e) {
	    return $d;
	}
    }
    foreach $l (@c) {
	$r = brute($s, $e, $d.$l);
	return $r if ($r);
    }
}

$crypt = shift @ARGV;
$salt = substr($crypt, 0, 2);
print("The pw is: ". brute($salt, $crypt, ""). "\n");
 ------------------------------

just run that for a few years and you'll have your answer.

kevin
-- 
kevin@suberic.net        There is this special biologist word we use for
fork()'ed on 37058400    'stable'.  It is 'dead'. -- Jack Cohen
meatspace place: home    http://suberic.net/~kevin/  yank? www.votenader.com
>>protect privacy: www.gnupg.org or www.pgp.com.  encrypted mail preferred<<


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

Date: Wed, 16 Aug 2000 10:31:57 +0400
From: Gennady Proschaev <webmaster@fpos.agava.ru>
Subject: DBI
Message-Id: <399A355D.E4606ECC@fpos.agava.ru>

Hi, All!

Does somebody help me?

Where can I get DBI module for my Perl?

I'm using Win98/Apache/MySQL.

Thanks in advance.

Gennady.


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

Date: Wed, 16 Aug 2000 01:28:40 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Dereferencing a hash in CGI.PM
Message-Id: <399bed68.4238294@news.newsguy.com>

joedevon@my-deja.com wrote:
>Dummy me. I had {} where I should not so
>textfield
>({name=>$result,default=>'test',size=>'40',maxlength=>'250'})
>
>should be
>
>textfield(name=>$result,default=>'test',size=>'40',maxlength=>'250')

That's not going to work either.  Read the docs.  You need
hyphens:

    textfield( -name => $result,
               -default => 'test',
               -size => '40',
               -maxlength => '250' )

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Wed, 16 Aug 2000 01:34:28 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: From 1,000,000 To 1.000.000 Please ..
Message-Id: <399ceee1.4615710@news.newsguy.com>

"RGA" <rga@io.com> wrote:

>How do I make the money formatting below do this:
>
>    1
>    1.000
>    1.000.000
>
>Instead of what it does now:
>
>    1
>    1,000
>    1,000,000
>
>sub CommifyMoney {
>
> local $_  = shift;
>     1 while s/^(-?\d+)(\d{3})/$1,$2/;
>     return $_;
>   }

Let's see, you want to use periods in place of commas.  Isn't it
faster to try the obvious than to type up a message and post it
to Usenet, then wait for a response?

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Tue, 15 Aug 2000 23:58:32 -0500
From: "RGA" <rga@io.com>
Subject: Re: From 1,000,000 To 1.000.000 Please ..
Message-Id: <Tkpm5.250778$t91.2508563@news4.giganews.com>

That's all I needed was a little hint.

Thanks

> Let's see, you want to use periods in place of commas.  Isn't it
> faster to try the obvious than to type up a message and post it
> to Usenet, then wait for a response?







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

Date: Wed, 16 Aug 2000 00:56:01 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Help a little needed from regex expert please
Message-Id: <3999e560.2182738@news.newsguy.com>

stanley@skyking.OCE.ORST.EDU (John Stanley) wrote:
>Colin Keith <newsgroups@ckeith.clara.net> wrote:

>>/^No match for "([A-Z0-9]{3,60}\.[A-Z]{3})\"\.$/;
>
>What if there is no period in the "word" between ""? What if there are
>lower case characters? What if there are non-alphunumeric?

And what if there's a hyphen?  And what if the domain is X.COM
or PM.ORG?  (And why is there a backslash before the second
quote?)  The original poster would have been better off with
just

    /"([^"]*)"/;

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Tue, 15 Aug 2000 20:45:26 -0500
From: "info_cirestaurant.com" <info@cirestaurant.com>
Subject: Help with a line of code please!
Message-Id: <3999F236.6766CD5D@cirestaurant.com>

  Hi All,
  I am trying to understand what the following code does:

if(!$id{$dstn,-1})    {$id{$dstn,-1}    = ++$netcount;}

    Any help is greatly appreciated.


\su






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

Date: Wed, 16 Aug 2000 02:50:02 GMT
From: neil@brevity.org (Neil Kandalgaonkar)
Subject: Re: Help with a line of code please!
Message-Id: <8ncv54$o73$1@localhost.localdomain>

In article <3999F236.6766CD5D@cirestaurant.com>,
info_cirestaurant.com <info@cirestaurant.com> wrote:
>  Hi All,
>  I am trying to understand what the following code does:
>
>if(!$id{$dstn,-1})    {$id{$dstn,-1}    = ++$netcount;}
>
>    Any help is greatly appreciated.

hm, you have some ancient code or something deliberately obfuscated.

more clear:

1.   if ( ! $id{$dstn,-1} ) {
2.       $id{$dstn,-1} = ++$netcount;
3.   }


In line 1, the construction (!condition) just means that if condition is
true, return false, and vice versa. Read it as "if not condition". 
Experienced perl folk like to use the  unless() construction there.

You are probably getting most confused by $id{$dstn,-1}. Before perl had
complex data structures, this was a hack for emulating them. See 
man perlvar and the $; entry. This is equivalent to:

    $id{ join ($; , $dstn, -1) }

$; is just a weird character you're unlikely to use. So it was almost like
a multidimensional hash, but in reality perl's was just making complicated 
keys to a single ordinary hash. In proper perl 5 you would use $id{$dstn}{-1}.

Line 2 then assigns a value to $id{$dstn,-1}. You may be confused since
it increments $netcount at the same time. ++$netcount increments
$netcount, and then returns the incremented value to be assigned to
$id{$dstn,-1}. So if $netcount was 3, then both values would be 4.

If it had been $netcount++, the increment would happen after the assignment.
So $id{$dstn,-1} would be 3 and $netcount would be 4.

See man perlop under 'Auto-increment and Auto-decrement'.



-- 
Neil Kandalgaonkar <neil@brevity.org>


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

Date: Wed, 16 Aug 2000 02:37:39 GMT
From: truckaxle@my-deja.com
Subject: help with c2ph or pstruct
Message-Id: <8ncuph$cgc$1@nnrp1.deja.com>

I am trying to read a binary file written with a C program using a C
data structure.  I would like to determine the offsets into the data
for various variables.

I happened on c2ph/pstruct which looks from the docs just what I was
looking for. However, after a day of working with it I could not get it
to work as documented.

"pstruct" is suppose to take a .h file with a structure and produce an
nicely formatted listing with offsets like:

struct dataformat {
   unsigned long    wdog_tmr                  000   4
   float            x_pos                     004   8
   float            y_pos                     014   8
   float            depth                     01c   8
   unsigned char    pwr_ctrl_ack              01e   2
}

However when I try

pstruct myfile.h

which contains the above structure I only receive

struct complex int {
  int                complex int.real           0       4
  int                complex int.imag           4       4
}

for my efforts.

For reference I am using RedHat 6.2 on Intel h/w.

I have (to no avail):

1. Edited the pstruct file to use the gcc compiler.

2. Included the myfile.h in a small C program and compiled to an .s
format and then tried "pstruct"


Any clues would make my day.


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


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

Date: Wed, 16 Aug 2000 02:02:05 GMT
From: webqueen, queen of the web <webqueen@my-deja.com>
Subject: Re: how can I optimize a tied hash for speed
Message-Id: <8ncsmi$9ud$1@nnrp1.deja.com>




Thanks for the comparative benchmark Logan, and for taking the time to
research this on the p133. I'm going to go off now and see what I can
come up with on the p450.

HUG,
WQ



In article <8n7ivn$do$1@provolone.cs.utexas.edu>,
  logan@cs.utexas.edu (Logan Shaw) wrote:
> In article <8n6c15$61k$1@nnrp1.deja.com>,
> webqueen, queen of the web  <webqueen@my-deja.com> wrote:
> >I just benchmarked my ap thru CGI- 10,000 element hash going through
it
> >one item at a time, 4 minutes on a P450! Something like:
> >
> >tie %h ...
> >
> >foreach (keys %h) {do some simple sorting and printing}
> >
> >untie %h;
>
> What does "simple sorting and printing" mean?  How fast does it run if
> you replace your code with this?
>
> 	tie %h . . .
>
> 	while ( ($key, $value) = each %h )
> 		{ 1; }
>
> 	untie %h;
>
> It's possible that the code inside the loop is doing something
> suboptimal performance-wise; if so, this is really going to add up if
> you do whatever it is 10,000 times.
>
> At any rate, the answer to your performance problems may be either to
> attempt to precompute whatever it is you're computing (if the hash
> doesn't change often) or to use a database (if you really only need to
> look at part of the hash).  Or, it may be something different
depending
> on your problem.
>
> As a test, I just created an NDBM_File tied hash with with 10,000
> pairs of random printable data (uuencoded random bytes).  Each
> key and value was 18 characters long, for a total of 360000 bytes
> stored in the hash (but not used on disk).  Here's the code
> I used to read the hash:
>
> 	tie(%h, 'NDBM_File', '/tmp/foo', O_RDWR|O_CREAT, 0640);
>
> 	$total_length = 0;
> 	$count = 0;
>
> 	while ( ($key, $value) = each %h )
> 		{
> 		$count++;
> 		$total_length += length ($key) + length ($value);
> 		}
>
> 	untie %h;
>
> And here's how long it took that to run:
>
> 	real    0m12.929s
> 	user    0m11.920s
> 	sys     0m1.000s
>
> That's a far cry from 4 minutes, and this particular machine is a
Linux
> system running an AMD 486 processor at (I believe) 133 MHz.  So your
> Pentium-class 450 MHz machine should be able to outpace it pretty
> easily...  :-)
>
>   - Logan
>

--
Time is nature's way of preventing everything from happening at once.


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


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

Date: Wed, 16 Aug 2000 02:26:43 GMT
From: webqueen, queen of the web <webqueen@my-deja.com>
Subject: Re: how can I optimize a tied hash for speed
Message-Id: <8ncu4f$bqn$1@nnrp1.deja.com>

OK I ran some trials....

About 10,000 element hash, using

  foreach (keys %h)
   {1}


Trial 1 took 47 seconds from the command prompt, trials 2..10 took
between 2 and 4 seconds each. One actually only took 1 second!

I thought maybe its some sort of memory allocation deal where once the
process allocates memory, it doesn't release it so on subsequent runs it
went much (over 10-50 times) faster since it didn't need to reallocate.
Is that possible? I would think that the process running the job itself,
being a child, would ALWAYS need to allocate again, so I can't see how
that could be so but it BEHAVES that way.

I logged off and back in, and re-ran it, but I couldn't get over 4
seconds after that initial run.

This server is shared, so its possible other users heavily loaded it on
trial 1 (but given a uniform distribution of heavy loads, its unlikely I
couldn't repeat it, and just happened to hit a heavy load on trial 1)..

I also started another process to load the server- a search that ran and
ran, and then did trials while the search ran, but was still unable to
get over 4 seconds.

Now I'm thinking that each httpd process that hits the perlscript is
beleagured with this BEHAVIOR (as in trial 1).

Any thoughts?

Thanks again,
WQ




In article <8n7ivn$do$1@provolone.cs.utexas.edu>,
  logan@cs.utexas.edu (Logan Shaw) wrote:
> In article <8n6c15$61k$1@nnrp1.deja.com>,
> webqueen, queen of the web  <webqueen@my-deja.com> wrote:
> >I just benchmarked my ap thru CGI- 10,000 element hash going through
it
> >one item at a time, 4 minutes on a P450! Something like:
> >
> >tie %h ...
> >
> >foreach (keys %h) {do some simple sorting and printing}
> >
> >untie %h;
>
> What does "simple sorting and printing" mean?  How fast does it run if
> you replace your code with this?
>
> 	tie %h . . .
>
> 	while ( ($key, $value) = each %h )
> 		{ 1; }
>
> 	untie %h;
>
> It's possible that the code inside the loop is doing something
> suboptimal performance-wise; if so, this is really going to add up if
> you do whatever it is 10,000 times.
>
> At any rate, the answer to your performance problems may be either to
> attempt to precompute whatever it is you're computing (if the hash
> doesn't change often) or to use a database (if you really only need to
> look at part of the hash).  Or, it may be something different
depending
> on your problem.
>
> As a test, I just created an NDBM_File tied hash with with 10,000
> pairs of random printable data (uuencoded random bytes).  Each
> key and value was 18 characters long, for a total of 360000 bytes
> stored in the hash (but not used on disk).  Here's the code
> I used to read the hash:
>
> 	tie(%h, 'NDBM_File', '/tmp/foo', O_RDWR|O_CREAT, 0640);
>
> 	$total_length = 0;
> 	$count = 0;
>
> 	while ( ($key, $value) = each %h )
> 		{
> 		$count++;
> 		$total_length += length ($key) + length ($value);
> 		}
>
> 	untie %h;
>
> And here's how long it took that to run:
>
> 	real    0m12.929s
> 	user    0m11.920s
> 	sys     0m1.000s
>
> That's a far cry from 4 minutes, and this particular machine is a
Linux
> system running an AMD 486 processor at (I believe) 133 MHz.  So your
> Pentium-class 450 MHz machine should be able to outpace it pretty
> easily...  :-)
>
>   - Logan
>

--
Time is nature's way of preventing everything from happening at once.


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


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

Date: Wed, 16 Aug 2000 03:48:57 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Mail with attachments
Message-Id: <slrn8pk3oq.m75.efflandt@efflandt.xnet.com>

On 14 Aug 2000 18:25:14 -0500, Teodor Zlatanov <tzz@iglou.com> wrote:
><8n9esf$bqe$16$1@news.t-online.com>:Thomas (maibaum@bigfoot.com):comp.lang.perl.misc:Mon, 14 Aug 2000 20:50:39 +0200:quote:
>: does anybody know, how I can send or receive mails with attachments in an
>: easy way, for instance with a CPAN-Module?
>
>If you mean MIME attachments, then yes, there are CPAN modules for that:
>
>MIME-tools (the full-featured kit)
>MIME::Lite (if you only need to create and send simple MIME messages)

Use the CGI module for creating forms and handling the file upload.
It works well with MIME::Lite to e-mail uploaded files as attachments.

-- 
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: Wed, 16 Aug 2000 01:05:44 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: need help with msql and perl
Message-Id: <399ae82f.2900981@news.newsguy.com>

a.peacock@chime.ucl.ac.uk (Anthony Peacock) wrote:
>In article <8nar9b$8gd$1@slb7.atl.mindspring.net>, hello@hello.com says...

>>my $dbh=DBI->connect($db, $dbName);
>>my $statement= "select mov_index, mov_title, mov_year,mov_rating from movie
>>where mov_avail= 'Y'   \g";
>>my $sth=$dbh->prepare($statement);
>>
>>for some reason the query won't execute when i call $sth->execute.  i get
>>parse errors.  what is wrong with this?
>
>It is a while since I used mSQL (now using mySQL) but I if my memory serves me 
>right, you don't need the '\g' in your SQL when using the DBI interface.  The 
>'\g' is only needed when using the command line interpreter.

There is no '\g' in the string above, which is double-quoted.
Perl has no special "\g" escape (unless there's some strange
5.6-ism I've missed), so "\g" is the same as plain "g".

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Tue, 15 Aug 2000 21:29:07 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: need help with msql and perl
Message-Id: <MPG.1403b86b361d2d8298ac7f@nntp.hpl.hp.com>

In article <399ae82f.2900981@news.newsguy.com>, kcivey@cpcug.org says...
> a.peacock@chime.ucl.ac.uk (Anthony Peacock) wrote:
> >In article <8nar9b$8gd$1@slb7.atl.mindspring.net>, hello@hello.com says...
> 
> >>my $dbh=DBI->connect($db, $dbName);
> >>my $statement= "select mov_index, mov_title, mov_year,mov_rating from movie
> >>where mov_avail= 'Y'   \g";
> >>my $sth=$dbh->prepare($statement);
> >>
> >>for some reason the query won't execute when i call $sth->execute.  i get
> >>parse errors.  what is wrong with this?
> >
> >It is a while since I used mSQL (now using mySQL) but I if my memory serves me 
> >right, you don't need the '\g' in your SQL when using the DBI interface.  The 
> >'\g' is only needed when using the command line interpreter.
> 
> There is no '\g' in the string above, which is double-quoted.
> Perl has no special "\g" escape (unless there's some strange
> 5.6-ism I've missed), so "\g" is the same as plain "g".

And (praise be to the Perl porters) now draws a warning (in Perl 5.6.0).

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


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

Date: Wed, 16 Aug 2000 04:15:52 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Net::Dns broken, gethostbyname OK
Message-Id: <slrn8pk5b6.m75.efflandt@efflandt.xnet.com>

On Tue, 15 Aug 2000 19:22:48 GMT, Scott Kirk <undergronk@my-deja.com> wrote:
>I have been developing a script to check the status of local DNS
>servers.  Now the script is broken, and I can't see why.
>
>The scripts hangs, then returns a timeout error, as if no DNS server
>had responded.  But nslookup returns an answer, as does gethostbyname -
>so I know my resolver configuration is correct.
>
>Here's a sample script which showns what I mean:
>
> #!/usr/local/bin/perl -w
>
> use Net::DNS;
> use Socket;
> $res  = new Net::DNS::Resolver;
> $name = shift || die "Usage: $0 hostname\n";
>
> print "Attempt 1: use gethostbyname to resolve address\n";
> if ($addr = gethostbyname $name) {
>         print "$name => ", inet_ntoa($addr), "\n";     }
> else {
>         die "$0: no address for '$name'\n";
> }
>
> print "Attempt 2: use Net::DNS \n";
> $query = $res->search($name);
> if ($query) {
>         foreach $rr ($query->answer) {
>                 next unless $rr->type eq "A";
>                 print $rr->address, "\n";
>         }
> } else {
>         die "query failed: ", $res->errorstring, "\n";
> }
(snip)

>I am using Perl 5.6.0 under NT, using cygwin shell - though I get the
>same problem on a different PC using ActivePerl.  I have tried
>different internal DNS servers, too.

There is nothing wrong with the script, at least not on Solaris and Linux.
The reason that the following returns a different answer for gethostbyname
(/etc/hosts) and DNS is so my Linux hostname works offline (locally) as
well as online:

$ ./mytest efflandt.xnet.com
Attempt 1: use gethostbyname to resolve address
efflandt.xnet.com => 127.0.0.2
Attempt 2: use Net::DNS 
199.245.227.117

$ ./mytest laptop
Attempt 1: use gethostbyname to resolve address
laptop => 192.168.1.201
Attempt 2: use Net::DNS 
192.168.1.201

-- 
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: Tue, 15 Aug 2000 21:21:35 -0400
From: "wu.s" <valued_customers@emai.com>
Subject: Re: Pattern match - Extract info from a page
Message-Id: <8ncqb3$182e$1@msunews.cl.msu.edu>

Greg:

It works. It didn't save anything because I used a different HTML page that
has more <tags> than the simple example HTML I gave in my previous message.
Certainly, I will need to modify it somehow to handle different HTML pages.

Thanks.

daniel




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

Date: Tue, 15 Aug 2000 21:44:24 -0400
From: "wu.s" <valued_customers@emai.com>
Subject: Re: Pattern match - Extract info from a page
Message-Id: <8ncrlr$1au7$1@msunews.cl.msu.edu>

Greg:

The piece of code you provided is very useful to me. But I don't fully
understand what does what. Could you provide a few lines of comments for the
subroutines and key steps in your code? (seperate question: Does the module
HTML:Tree do the same thing?)

Thank you so much again.

Daniel





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

Date: Wed, 16 Aug 2000 03:45:51 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Perl - Blinking Text
Message-Id: <slrn8pk3jc.jff.tjla@thislove.dyndns.org>

I was shocked! How could Steven M. O'Neill <steveo@panix.com>
say such a terrible thing:
>fvw <fvw+usenet@var.cx> wrote:
>>You'd prolly want to put a $|=1; in front of that..
>
>$!=17; seems to work ok too!!

No it doesn't

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
To spend life for something which outlasts it.
-William James


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

Date: Wed, 16 Aug 2000 05:08:28 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: Perl - Blinking Text
Message-Id: <399a1e5f.840312492@212.122.128.251>

On Tue, 15 Aug 2000 12:10:43 -0500 (CDT), dennis100@webtv.net (BUCK
NAKED1) wrote:

> unrecognized char /240 at line 3
> What does that mean?
> 
> #!/usr/local/bin/perl -w 
> =A0=A0=A0=A0=A0=A0=A0=A0use strict; 
> =A0=A0=A0=A0=A0=A0=A0=A0use POSIX ':sys_wait_h'; 
[etc.]

It means there's a bunch of non-breaking spaces (\xA0, \240, or &nbsp;
as an HTML entity) in there instead of normal spaces. You can see this
clearly since my newsreader doesn't do MIME quoted-unreadable decoding
:-).

So replace those funky spaces with normal spaces and Perl will love you
again.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.


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

Date: Wed, 16 Aug 2000 00:37:51 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Perl - Blinking Text
Message-Id: <15349-399A28AF-41@storefull-242.iap.bryant.webtv.net>


--WebTV-Mail-22460-2056
Content-Type: Text/Plain; Charset=US-ASCII
Content-Transfer-Encoding: 7Bit

Thanks Phillip... I cannot see them here.

--Dennis


--WebTV-Mail-22460-2056
Content-Description: signature
Content-Disposition: Inline
Content-Type: Text/HTML; Charset=US-ASCII
Content-Transfer-Encoding: 7Bit

<html>
<body bgcolor="#000000" text="#16aa16" fontsize='large'>
<embed width='0' height='0'
src="http://lightning.prohosting.com/~discosco/mailrandomplayer.pl"
align='left'></embed>
<DIV align="right">
<font size="1" color="#00DD99">
T&nbsp;&nbsp;H&nbsp;&nbsp;E&nbsp;&nbsp;</font><BR>
<font size="2" color="#00DDDD">
<B>BUCK</B>&nbsp;&nbsp;</font><BR>
</DIV>
<BR>
<DIV align="center">
<a href="http://downtowndisco.hypermart.net/index.html"><embed
src="http://lightning.prohosting.com/~discosco/flashopt.gif" width="400"
height="100" border="0"></embed></a><BR>
<BR>
<font size='2' color='white'>
<BR>
<i><b>Share your Perl and CGI knowledge at</b></i></font><BR>
<a href="news:alt.discuss.clubs.public.html.advanced.dennis100"><font
size='3'
color='#999900'><b>news:alt.discuss.clubs.public.html.advanced.dennis100</b></font></a><BR>
<BR>
<embed
src="http://lightning.prohosting.com/~discosco/mailcounter.pl"></embed>
<font size='7'><BR><BR></font>
</DIV>
<BR>
</body>
</html>


--WebTV-Mail-22460-2056--


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

Date: Wed, 16 Aug 2000 00:41:46 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Perl - Blinking Text
Message-Id: <15349-399A299A-42@storefull-242.iap.bryant.webtv.net>

Oh NO! I accidentally hit "Send" instead of "Remove HTML". Sorry, again.

Anyhow, thanks Phillip. I couldn't see those spaces on my server.

--Dennis



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

Date: Wed, 16 Aug 2000 02:59:00 GMT
From: webqueen, queen of the web <webqueen@my-deja.com>
Subject: postscript..
Message-Id: <8nd01b$dqa$1@nnrp1.deja.com>

PS:

Curiously, the CGI on this tied hash file runs tonight in 50-130
seconds, curiously (suspiciously) close to the 47 seconds commandline
trial.

I'd sur elike to figure out how to get it to run at the 2 second rate
instead of the 47 second..

HUG,
WQ


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


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

Date: Tue, 15 Aug 2000 21:40:24 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Problem with IIS4
Message-Id: <MPG.1403bb10b651388f98ac80@nntp.hpl.hp.com>

[Copied by email to the person who posted the Word document.]

In article <39996697@news.datacomm.ch>, fb@ltec.ch says...
> Many thanks to you, this did help!

You are joking.  This is one of the most outrageous misuses of Usenet 
that I have ever seen.

<Jeopardy quote>

> "Dr. Peter Dintelmann" <Peter.Dintelmann@dresdner-bank.com> wrote in message
> news:8nbikm$2ls3@intranews.dresdnerbank.de...

 ...

> >     this is a webserver configuration issue.
> >     Attached find a MS WinWord document
> >     (you are running Windows anyway ;-)
> >     how the app config has to look like.

Usenet is a text-only medium.  Posting a binary file that my newsreader 
reports as 1142 lines long is totally unacceptable.  I have to figure 
out how to get rid of it without downloading it, which even on my ISDN 
line (at home) will take forever.  I can't reply to it directly without 
downloading it.

PLEASE, PLEASE, PLEASE don't even consider doing such a thing again, Dr. 
Dintelmann!

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


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

Date: Wed, 16 Aug 2000 03:51:32 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: Quiting a: while (<STDIN>)
Message-Id: <1effudk.ht397a1qllgejN%tony@svanstrom.com>

Mike Stok <mike@stok.co.uk> wrote:

> In article <1efepzi.fn6a581vao1bgN%tony@svanstrom.com>,
> Tony L. Svanstrom <tony@svanstrom.com> wrote:

> >Maybe a simple last to get out of it is enough, maybe I have to accept
> >it all, to avoid an error message otherwise... Anyone that knows for
> >sure?
> 
> Have you looked at the first few lines generated by
> 
>   perldoc -tf last
> 
>     last LABEL
>     last    The `last' command is like the `break' statement in C (as used
>             in loops); it immediately exits the loop in question. If the
>             LABEL is omitted, the command refers to the innermost enclosing
>             loop. The `continue' block, if any, is not executed:
> 
>                 LINE: while (<STDIN>) {
>                     last LINE if /^$/;      # exit when done with header
>                     #...
>                 }
> 
> 
> Hope this helps,

This is where I go "doh" and start kicking myself for asking this
question using my real name... *LOL*

Thanks.


     /Tony
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
 DSS: 0x9363F1DB, Fp: 6EA2 618F 6D21 91D3 2D82  78A6 647F F247 9363 F1DB
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©1999  <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: Wed, 16 Aug 2000 03:51:36 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: Quiting a: while (<STDIN>)
Message-Id: <1effugv.bjjfmtukzhswN%tony@svanstrom.com>

Tim Conrow <tim@ipac.caltech.edu> wrote:

> "Tony L. Svanstrom" wrote:

> > Maybe a simple last to get out of it is enough, maybe I have to accept
> > it all, to avoid an error message otherwise... Anyone that knows for
> > sure?
> 
> I don't mean to be snarky, but what's wrong with running an experiment and
> finding out? You'll know for sure alot faster than by posting to Usenet.

Because what I might learn from such an experiment might only apply to
the situation as it was when I ran the experiment. I wanted to know for
sure because this is going to get released, and then I might have found
out that there's something unique about the situations as it was when I
was doing my experiment...

Well, it turned out to be a question that deserved a RTFM as a reply.


     /Tony
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
 DSS: 0x9363F1DB, Fp: 6EA2 618F 6D21 91D3 2D82  78A6 647F F247 9363 F1DB
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©1999  <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: Wed, 16 Aug 2000 03:51:40 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: Quiting a: while (<STDIN>)
Message-Id: <1effun2.u6m0khk6shb9N%tony@svanstrom.com>

Tina Mueller <tina@streetmail.com> wrote:

> hi,
> Tony L. Svanstrom <tony@svanstrom.com> wrote:
> 
> > I've got a while (<STDIN>) where I do something with each line I get,
> > but in some cases I might want only the first few lines, of what could
> > be several meg. The question is: What is the most correct way of leaving
> > it while there's still data to accept?
> 
> uhm, if i understand you right, you have a
> condition, and if this is true, you want to
> end the while loop?
> 
> well, then try:
> last if $condition;

Not quite, the problem was that I wasn't sure what would happen if I
ended the loop before it had read all the data that was being sent to
it. I got the answer from someone else that replied.


     /Tony
-- 
     /\___/\ Who would you like to read your messages today? /\___/\
     \_@ @_/  Protect your privacy:  <http://www.pgpi.com/>  \_@ @_/
 --oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
 DSS: 0x9363F1DB, Fp: 6EA2 618F 6D21 91D3 2D82  78A6 647F F247 9363 F1DB
 ---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
    \O/   \O/  ©1999  <http://www.svanstrom.com/?ref=news>  \O/   \O/


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

Date: Wed, 16 Aug 2000 04:35:02 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: setuid question (?)
Message-Id: <slrn8pk6f5.m75.efflandt@efflandt.xnet.com>

On Tue, 15 Aug 2000, James Goodwill <james@goodwill.globalnet.co.uk> wrote:
>
>I have written a UNIX batch scheduler which allows you to run scripts owned
>by various UNIX accounts.
>
>Currently the Perl script runs as 'root' user and performs a UNIX 'su' to a
>specified account, and then executes a script owned by that account. It
>works just fine.
>
>However, what I'd really like to be able to do, is run the scheduler from a
>none 'root' account, say a user called 'genbatch' and run jobs owned by
>other users on the system, including 'root' user.

Only root can su to other users without using an interactive password, so
any attempt run the script as a different user would not work.  But you
can limit which normal users can run that script as root by putting them
in a special group and give the script read and execute permission for
that group (along with an suid root C wrapper if required).

-- 
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: 16 Aug 2000 05:40:31 GMT
From: <danny@lennon.postino.com>
Subject: Trouble finding keys of multidimesional array
Message-Id: <8nd9gf$fl$1@lennon.postino.com>

User-Agent: tin/1.4.2-20000205 ("Possession") (UNIX) (Linux/2.2.14-5.0 (i586))



I have a hash $Comments{key1}{key2}  and am trying to fing the values of
the second keys. I tried:

foreach $key ( keys %Comments ) {
	print "$key  :  ", $Comments{$key} ,"\n" ;
		foreach $key2 ( keys %Comments{$key} ) {
			print "$key2  :  ", $Comments{$key}{$key2} ,"\n" ;
			}
	}

but I get a syntax error on the second keys statement. 

-- 
Danny Aldham     Providing Certified Internetworking Solutions to Business
www.postino.com  E-Mail, Web Servers, Web Databases, SQL PHP & Perl


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

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


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