[24494] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6674 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jun 10 06:06:00 2004

Date: Thu, 10 Jun 2004 03:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 10 Jun 2004     Volume: 10 Number: 6674

Today's topics:
        Accessing an object in a sub-routine <csgcsg39@hotmail.com>
    Re: Accessing an object in a sub-routine <usenet@morrow.me.uk>
    Re: Accessing an object in a sub-routine <gnari@simnet.is>
    Re: Help me with threads issue ! <vetro@online.no>
    Re: Help me with threads issue ! <usenet@morrow.me.uk>
    Re: Help me with threads issue ! <vetro@online.no>
    Re: how do I convert a file into its 8 bit 0/1 pattern  <Joe.Smith@inwap.com>
    Re: Invisible Array Loop Counter? (Thomas Church)
    Re: Invisible Array Loop Counter? (Anno Siegel)
    Re: Invisible Array Loop Counter? <Joe.Smith@inwap.com>
    Re: Passing custom sessionID to cookie 'value' <segraves_f13@mindspring.com>
        Perl TIMOUT (Achille)
    Re: Perl TIMOUT <usenet@morrow.me.uk>
    Re: Perl TIMOUT <andre.wisniewski@gmx.de>
    Re: reading variable and fixed length records <Joe.Smith@inwap.com>
        reverse IP lookup for check all doimains on the server <gp@nospm.hr>
    Re: sub returning nothing (Anno Siegel)
    Re: Variable hash names? <uri.guttman@fmr.com>
    Re: Variable hash names? <hjs@cadence.com>
    Re: Variable hash names? <postmaster@castleamber.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 10 Jun 2004 09:36:20 +0100
From: "C GIllespie" <csgcsg39@hotmail.com>
Subject: Accessing an object in a sub-routine
Message-Id: <ca96i4$eh9$1@ucsnew1.ncl.ac.uk>

Dear All,

I'm not too sure on the exact terminology, so I hope you will bare with me
:)

In my small script, I have:

my $varA = $f->fault;

How do I pass $f to a subountine, i.e.

sub sub1(
$_->fault; #This is wrong!
)
sub1($f);

Declaring $f as global variable is one way, but are there any others?

Thanks

Colin




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

Date: Thu, 10 Jun 2004 08:45:21 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Accessing an object in a sub-routine
Message-Id: <ca9731$435$3@wisteria.csv.warwick.ac.uk>


Quoth "C GIllespie" <csgcsg39@hotmail.com>:
> 
> In my small script, I have:
> 
> my $varA = $f->fault;
> 
> How do I pass $f to a subountine, i.e.
> 
> sub sub1(
> $_->fault; #This is wrong!

Sub args come in in @_. Read perldoc perlsub.

sub sub1 {
    $_[0]->fault;
}

> )
> sub1($f);

Ben

-- 
Musica Dei donum optimi, trahit homines, trahit deos.    |
Musica truces molit animos, tristesque mentes erigit.    |   ben@morrow.me.uk
Musica vel ipsas arbores et horridas movet feras.        |


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

Date: Thu, 10 Jun 2004 08:55:28 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Accessing an object in a sub-routine
Message-Id: <ca97ie$1qp$1@news.simnet.is>


"C GIllespie" <csgcsg39@hotmail.com> wrote in message
news:ca96i4$eh9$1@ucsnew1.ncl.ac.uk...

> my $varA = $f->fault;
>
> How do I pass $f to a subountine, i.e.
>
> sub sub1(
> $_->fault; #This is wrong!
> )
> sub1($f);

$_[0]

gnari







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

Date: Thu, 10 Jun 2004 10:25:48 +0200
From: "Vetle Roeim" <vetro@online.no>
Subject: Re: Help me with threads issue !
Message-Id: <opr9ddpaqp3hk3cf@quickfix.opera.com>

On Wed, 9 Jun 2004 19:08:42 +0000 (UTC), Ben Morrow <usenet@morrow.me.uk>  
wrote:

>
> Quoth cji_work@yahoo.com (Charlie):
>> I need some help from you about the thread issue I have.
>> What I want to do is to simulate multi users to access one web server.
>> I want to simulate as many as 200 users to assess that web server to
>> check the performance from both the web server and the backend DB.
>>
>> The ways that I emploment it are:  1). to have the apache(version
>> 1.3.31)  installed on the Linux platform. 2) I am using the perl
>> 5.8.4, along with some perl modules, such as Mechanize, threads to
>> create the test scripts. And I put the test scripts under the dir of
>> (Apache)/cgi-bin/.
>
> Under linux (or any other platform which implements fork decently) there
> is no point in using ithreads unless you need the functionality of
> threads::shared (and even then, you can use forks.pm from CPAN to
> simulate it). Forking will be both faster and safer.

   Interesting. I tested my example in <opr9bx92bs3hk3cf@quickfix.opera.com>
   with forks.pm, and at first it seemed to work. However, if I modify
   the object inside the thread, the changes do not seem to propagate to
   the originating thread as it does _without_ forks.pm.

   I've searched on google (including groups.google.com) for information
   on threading in Perl, and I'm under the impression that it has improved
   alot lately.


> Ben
>



-- 
Touch eyeballs to screen for cheap laser surgery!


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

Date: Thu, 10 Jun 2004 08:41:58 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Help me with threads issue !
Message-Id: <ca96sm$435$1@wisteria.csv.warwick.ac.uk>


Quoth "Vetle Roeim" <vetro@online.no>:
> On Wed, 9 Jun 2004 19:08:42 +0000 (UTC), Ben Morrow <usenet@morrow.me.uk>  
> wrote:
> 
> >
> > Quoth cji_work@yahoo.com (Charlie):
> >> I need some help from you about the thread issue I have.
> >> What I want to do is to simulate multi users to access one web server.
> >> I want to simulate as many as 200 users to assess that web server to
> >> check the performance from both the web server and the backend DB.
> >>
> >> The ways that I emploment it are:  1). to have the apache(version
> >> 1.3.31)  installed on the Linux platform. 2) I am using the perl
> >> 5.8.4, along with some perl modules, such as Mechanize, threads to
> >> create the test scripts. And I put the test scripts under the dir of
> >> (Apache)/cgi-bin/.
> >
> > Under linux (or any other platform which implements fork decently) there
> > is no point in using ithreads unless you need the functionality of
> > threads::shared (and even then, you can use forks.pm from CPAN to
> > simulate it). Forking will be both faster and safer.
> 
>    Interesting. I tested my example in <opr9bx92bs3hk3cf@quickfix.opera.com>
>    with forks.pm, and at first it seemed to work. However, if I modify
>    the object inside the thread, the changes do not seem to propagate to
>    the originating thread as it does _without_ forks.pm.

I have to say I've never used forks; but did you use forks::shared as
well as forks? I would be inclined *not* to use forks myself, but
implement some other IPC mechanism as needed.

>    I've searched on google (including groups.google.com) for information
>    on threading in Perl, and I'm under the impression that it has improved
>    alot lately.

Perl ithreads now effectively perform a fork in userland, without using
copy-on-write. This has removed the problems with 5005threads, sure, but
it has also removed any point in using threads on an OS which can fork.
The OS will *always* be able to do it faster.

Ben

-- 
  The cosmos, at best, is like a rubbish heap scattered at random.
                                                         - Heraclitus
  ben@morrow.me.uk


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

Date: Thu, 10 Jun 2004 10:55:35 +0200
From: "Vetle Roeim" <vetro@online.no>
Subject: Re: Help me with threads issue !
Message-Id: <opr9de2xg73hk3cf@quickfix.opera.com>

On Thu, 10 Jun 2004 08:41:58 +0000 (UTC), Ben Morrow <usenet@morrow.me.uk>  
wrote:

[...]
>>    Interesting. I tested my example in  
>> <opr9bx92bs3hk3cf@quickfix.opera.com>
>>    with forks.pm, and at first it seemed to work. However, if I modify
>>    the object inside the thread, the changes do not seem to propagate to
>>    the originating thread as it does _without_ forks.pm.
>
> I have to say I've never used forks; but did you use forks::shared as
> well as forks? I would be inclined *not* to use forks myself, but
> implement some other IPC mechanism as needed.

   Doh! I forgot about that one ... It worked perfectly when I included
   forks::shared. :)

   Btw; if I read the POD for forks correctly, then this shouldn't work
   (see the TODO section). Um... ?


>>    I've searched on google (including groups.google.com) for information
>>    on threading in Perl, and I'm under the impression that it has  
>> improved
>>    alot lately.
>
> Perl ithreads now effectively perform a fork in userland, without using
> copy-on-write. This has removed the problems with 5005threads, sure, but
> it has also removed any point in using threads on an OS which can fork.
> The OS will *always* be able to do it faster.

   I'm going to try to create some kind of thread/process pool, so the speed
   of creating new threads/processes will hopefully not be much of an issue.

   I'll experiment a little bit with/without forks and see how things work
   out. :)


>
> Ben
>



-- 
Touch eyeballs to screen for cheap laser surgery!


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

Date: Thu, 10 Jun 2004 06:36:44 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: how do I convert a file into its 8 bit 0/1 pattern ?
Message-Id: <0kTxc.63973$3x.54438@attbi_s54>

Jack wrote:

> I want to capture the exact 0/1 bitstream from a datafile.  How do I
> accomplish this ?

Just read in the data and write it back out.

The data will come in as individual bytes (8 bits each) and
the exact 1/0 bitstream of 8-bit bytes will be written out.

Now, if you wish to convert a single 8-bit byte into 8 separate characters of
"1" and "0" each, that is a different problem.  But you did not ask for that.
	-Joe


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

Date: 9 Jun 2004 23:18:05 -0700
From: tchurch@gmail.com (Thomas Church)
Subject: Re: Invisible Array Loop Counter?
Message-Id: <ea0cdb4c.0406092218.6a3b362a@posting.google.com>

Paul Lalli <ittyspam@yahoo.com> wrote in message news:<20040601201845.A18263@dishwasher.cs.rpi.edu>...
> On Tue, 2 Jun 2004 ctcgag@hotmail.com wrote:
> 
> > It seems that Perl has a special "undef" structure which is shared by all
> > empty array slots (rather than giving each one it's own "real" undef sv*).
> > Of course, the guts of perl must know about this, so that if something is
> > assigned to something pointing to this special structure it knows to break
> > the link, rather than sharing the new value with all other empty array
> > slots.  Apparently this confuses Data::Dumper.   I would consider it a bug
> > in Data::Dumper.
> 
> This would seem to support that analysis:
> 
> use strict;
> use warnings;
> use Data::Dumper;
> 
> my @arr;
> $#arr = 4;
> print Dumper(\@arr);
> $arr[2] = 'foo';
> print Dumper(\@arr);
> 
> __END__
> $VAR1 = [
>           undef,
>           ${\$VAR1->[0]},
>           ${\$VAR1->[0]},
>           ${\$VAR1->[0]},
>           ${\$VAR1->[0]}
>         ];
> $VAR1 = [
>           undef,
>           ${\$VAR1->[0]},
>           'foo',
>           ${\$VAR1->[0]},
>           ${\$VAR1->[0]}
>         ];

Forgive me if I'm overlooking something obvious, but I can't get this "bug" to
do anything. I was trying to play around with this, but couldn't get it to
work. Even when I paste your code in verbatim, I still don't get anything
special. Running *exactly* your code:

$VAR1 = [
          undef,
          undef,
          undef,
          undef,
          undef
        ];
$VAR1 = [
          undef,
          undef,
          'foo',
          undef,
          undef
        ];

Is there some feature of Data::Dumper that I'm missing? I'm just intrigued as
to why this would happen for some people, and [possibly] not for others. I'm
running Perl 5.8.1 through cygwin on WinXP. Thanks.


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

Date: 10 Jun 2004 06:58:32 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Invisible Array Loop Counter?
Message-Id: <ca90qo$jdd$1@mamenchi.zrz.TU-Berlin.DE>

Thomas Church <tchurch@gmail.com> wrote in comp.lang.perl.misc:
> Paul Lalli <ittyspam@yahoo.com> wrote in message

[...]

> > use strict;
> > use warnings;
> > use Data::Dumper;
> > 
> > my @arr;
> > $#arr = 4;
> > print Dumper(\@arr);
> > $arr[2] = 'foo';
> > print Dumper(\@arr);
> > 
> > __END__
> > $VAR1 = [
> >           undef,
> >           ${\$VAR1->[0]},
> >           ${\$VAR1->[0]},
> >           ${\$VAR1->[0]},
> >           ${\$VAR1->[0]}
> >         ];
> > $VAR1 = [
> >           undef,
> >           ${\$VAR1->[0]},
> >           'foo',
> >           ${\$VAR1->[0]},
> >           ${\$VAR1->[0]}
> >         ];
> 
> Forgive me if I'm overlooking something obvious, but I can't get this "bug" to
> do anything. I was trying to play around with this, but couldn't get it to
> work. Even when I paste your code in verbatim, I still don't get anything
> special. Running *exactly* your code:
> 
> $VAR1 = [
>           undef,
>           undef,
>           undef,
>           undef,
>           undef
>         ];
> $VAR1 = [
>           undef,
>           undef,
>           'foo',
>           undef,
>           undef
>         ];
> 
> Is there some feature of Data::Dumper that I'm missing? I'm just intrigued as
> to why this would happen for some people, and [possibly] not for others. I'm
> running Perl 5.8.1 through cygwin on WinXP. Thanks.

The behavior changed at some point between 5.6.0 and 5.8.1.

Anno


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

Date: Thu, 10 Jun 2004 09:05:32 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Invisible Array Loop Counter?
Message-Id: <vvVxc.11841$0y.10750@attbi_s03>

Paul Lalli wrote:

> On Tue, 1 Jun 2004, zzapper wrote:
>>print join "",@t;
> 
> (on another note, there is no reason to join a sequence of elements with
> the empty string.  (Non-interpolated) arrays are printed in that manner by
> default.  (Unless of course you've changed $,)

There is a reason: Efficiency.

If I recall correctly,
   print @t;
is like
   print $_ for @t;
in that it has more overhead than
   print "OneReallyLargeString";

	-Joe


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

Date: Thu, 10 Jun 2004 04:14:18 GMT
From: "Bill Segraves" <segraves_f13@mindspring.com>
Subject: Re: Passing custom sessionID to cookie 'value'
Message-Id: <ueRxc.20007$Yd3.4815@newsread3.news.atl.earthlink.net>

"Robert TV" <ducott_99@yahoo.com> wrote in message
news:kROxc.683359$Pk3.1185@pd7tw1no...
> Hello, i'm writing a script to generate a md5 sessionID ...
<snip>

See, e.g., Randal L. Schwartz' article in Web Techniques,
http://www.stonehenge.com/merlyn/WebTechniques/col68.html

--
Bill Segraves




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

Date: 10 Jun 2004 01:39:39 -0700
From: wwfpalmaria@libero.it (Achille)
Subject: Perl TIMOUT
Message-Id: <d0c53d.0406100039.4de3c95d@posting.google.com>

Hi,
I run a PERL script from Browser (internet Explorer) but the execution
is very slow so the IIS stop my perl.exe

I thinks the my problem is the "timout".

I need to insert in my script the string of the command like ASP:
 Server.ScriptTimeOut = 7200

Have you any idea?
Thanks a lot!
Achille [from Italy]


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

Date: Thu, 10 Jun 2004 08:43:45 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Perl TIMOUT
Message-Id: <ca9700$435$2@wisteria.csv.warwick.ac.uk>


Quoth wwfpalmaria@libero.it (Achille):
> 
> I run a PERL script from Browser (internet Explorer) but the execution
> is very slow so the IIS stop my perl.exe

Is it really necessary for your script to take so long?

> I thinks the my problem is the "timout".
> 
> I need to insert in my script the string of the command like ASP:
>  Server.ScriptTimeOut = 7200
> 
> Have you any idea?

You *may* be able to do this using Win32::OLE. Otherwise, you need to
change it in the config somewhere.

Ben

-- 
   If you put all the prophets,   |   You'd have so much more reason
   Mystics and saints             |   Than ever was born
   In one room together,          |   Out of all of the conflicts of time.
ben@morrow.me.uk                                    The Levellers, 'Believers'


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

Date: Thu, 10 Jun 2004 11:02:37 +0200
From: "Andre Wisniewski" <andre.wisniewski@gmx.de>
Subject: Re: Perl TIMOUT
Message-Id: <opr9dfengyudlqzq@ares>

On 10 Jun 2004 01:39:39 -0700, Achille <wwfpalmaria@libero.it> wrote:

> Hi,
> I run a PERL script from Browser (internet Explorer) but the execution
> is very slow so the IIS stop my perl.exe
>
> I thinks the my problem is the "timout".
>

I had the same problem and thought about the timeout, too.

But everytime i had such problems i found them in my scripts.
My scripts had errors or bad design (e.g. to slow searches in files).

Think of that, too.

Andre


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

Date: Thu, 10 Jun 2004 08:01:59 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: reading variable and fixed length records
Message-Id: <XzUxc.4452$2i5.3615@attbi_s52>

Walter Roberson wrote:

> You could set $/ to 0 and do a <>, which would get you the part up to
> the 0. Then set $/ to an integer which is the size of the fixed part
> of the record, and do another <> to get the fixed part.
> 
> (Setting $/ to an integer was not supported until roughly perl 5.6.)

Correction:

   You could set $/ to 0 and do a <>, which would get you the part up to
   the 0. Then set $/ to a reference of an integer which is the size of
   the fixed part of the record, and do another <> to get the fixed part.

   (Setting $/ to the reference of an integer was not supported until roughly 
perl 5.6.)

   $bytes_per_record = 15;
   $/ = \$bytes_per_record;

	-Joe


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

Date: Thu, 10 Jun 2004 09:38:29 +0200
From: "PHP2" <gp@nospm.hr>
Subject: reverse IP lookup for check all doimains on the server
Message-Id: <ca937j$2vt$1@ls219.htnet.hr>

Have someone any idea what I must to do?

if I add some IP of server that I can see all domains on the same IP on the
server.

like here: http://whois.webhosting.info/216.127.92.54

Mario




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

Date: 10 Jun 2004 09:10:51 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: sub returning nothing
Message-Id: <ca98ir$o7b$1@mamenchi.zrz.TU-Berlin.DE>

Ben Morrow  <usenet@morrow.me.uk> wrote in comp.lang.perl.misc:

[...]

> $self->assert( scalar myvoid => 'Function failed' );

That would autoquote "myvoid'.  One pair of () is needed.

Anno


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

Date: Wed, 09 Jun 2004 13:44:34 -0400
From: Uri Guttman <uri.guttman@fmr.com>
Subject: Re: Variable hash names?
Message-Id: <livfi0wrr1.fsf@fmr.com>

>>>>> "DO" == Doug O'Leary <dkoleary@olearycomputers.com> writes:

  DO> In article <u9k6ygoedk.fsf@wcl-l.bham.ac.uk>, Brian McCauley wrote:
  >> 
  >> You cannot use symrefs to access lexically scoped variables.

  DO> That, right there, was the key.  Thanks.  Changing to a hash
  DO> of a hash worked fine.  

regardless of that, do you understand why it is bad to use the symbol
table for basic data structures? the symtable is just a special hash
tree with side effect. the side effect are never needed when creating
data structures so why use it? it saves no code and opens up a world of
pain with tricky bugs to fix.

uri


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

Date: Wed, 09 Jun 2004 22:38:47 -0700
From: Henry Salvia <hjs@cadence.com>
Subject: Re: Variable hash names?
Message-Id: <40C7F3E7.1FB2747C@cadence.com>

Doug O'Leary wrote:
> 
> Hey, all;

Hey. Its late, and you'll get better answers than this in the morning,
but I thought I'd take a swing at this.

> This seems like something that should be possible.
> 
> I have a config file that I'd like to read in as follows:
> 
> [INVALID_TGT_GROUPS]
> adm
> bin
> sys
> sysadmin
> 
> [VALID_HD_USERS]
> blfarrel
> dekojis
> jclemens
> 
> [INVALID_HD_USERS]
> dkoleary
> jarodrigue
> trzator
> 
> What I'd like at the end is hashes as follows:
> 
> %INVALID_TGT_GROUPS ( 'adm' => 1, 'bin' => 1 ...)
> %VALID_HD_USERS     ( 'blfarrel' => 1, 'dekojis' => 1...)
> %INVALID_HD_USERS   ( 'dkoleary' => 1, 'jarodrigue' => 1 ...)

Using variables to name hashes is too tricky for me. Read up on
(hmm: I can't remember if they're called soft or indirect)
references if you want to know why this is not a good thing to do. I
would
go up a level and make a hash of hashes with the config headers as keys:

Here's how I'd write read_config() (warning: untested code)

sub read_config {
	my($config) = @_ ;
	local(*IN) ;
	open IN, $config || die "Can't read $config - $!" ;
	my %BFH ;
	my $hkey ;
	while(<IN>) {
		next if /^#/ || /^$/ ;
		chomp ;
		if ( /\[\s*(\w+)\s*\]/ ) {
			$hkey = $1 ;
			next ;
		}
		next unless $hkey ;
		$BFH{$hkey}{$_} = 1 ;
	}
	close IN ;
	return \%BFH ;
}

use it like so:

my $bfh = read_config($config) ;
foreach my $hkey ( keys %$bfh ) {
	print "$hkey users:\n" ;
	foreach my $user ( keys %{ $bfh->{$hkey} } ) {
		print "\t($user)\n" ;
	}
}

Good luck.
Henry Salvia.

> Here's the function that I'm wrote to read it in.  Hopefully, this
> is obvious to someone, but unfortunately, not to me.
> 
> sub read_config
> {  my $config = shift;
>    my (%INVALID_TGT_GROUPS, %VALID_HD_USERS, %INVALID_HD_USERS);
>    open (In, "< $config") || die "Can't read $config - ($!)";
>    my $hash;
> 
>    while (<In>)
>    {  next if (/^#/ || /^$/);
>       chomp;
> ### Turn off strict refs so I can build hash tables easily.
>       no strict 'refs';
>       if (/\[\s*(\w+)\s*\]/)
>       {  $hash = $1;
>          next;
>       }
>       print "Setting $hash -> $_\n";
>       ${%{$hash}}{$_} = 1;
>    }
> 
>    print "Dumping\n";
>    foreach my $user (sort keys %INVALID_TGT_GROUPS)
>    {  print "$user\n";  }
>    print "End dumping\n";
> }
> 
> If I turn off strict reference checking via the "no strict 'refs' as
> listed above, the script runs, but doesn't set the hash as follows:
> 
> $ ./hdpw
> Setting INVALID_TGT_GROUPS -> adm
> Setting INVALID_TGT_GROUPS -> bin
> Setting INVALID_TGT_GROUPS -> sys
> Setting INVALID_TGT_GROUPS -> uucp
> Setting INVALID_TGT_GROUPS -> mail
> Setting INVALID_TGT_GROUPS -> tty
> Setting INVALID_TGT_GROUPS -> lp
> Setting INVALID_TGT_GROUPS -> nuucp
> Setting INVALID_TGT_GROUPS -> daemon
> Setting INVALID_TGT_GROUPS -> sysadmin
> Setting VALID_HD_USERS -> blfarrel
> Setting VALID_HD_USERS -> dekojis
> Setting VALID_HD_USERS -> jclemens
> Setting INVALID_HD_USERS -> dkoleary
> Setting INVALID_HD_USERS -> jarodrigue
> Setting INVALID_HD_USERS -> trzator
> Dumping
> End dumping
> 
> If I comment out the "no strict refs" line, I get an error as follows:
> 
> Setting INVALID_TGT_GROUPS -> adm
> Can't use string ("INVALID_TGT_GROUPS") as a HASH ref while "strict refs"
> in use at ./hdpw line 37, <In> line 10.
> 
> Like I said, this seems like something that should be possible.  Can someone
> point me in the right direction?
> 
> Thanks.
> 
> Doug
> 
> --
> --------
> Senior UNIX Admin
> O'Leary Computer Enterprises
> dkoleary@olearycomputers.com (w) 630-904-6098 (c) 630-248-2749
> resume:  http://www.olearycomputers.com/resume.html


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

Date: Thu, 10 Jun 2004 00:48:52 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: Variable hash names?
Message-Id: <40c7f647$0$193$58c7af7e@news.kabelfoon.nl>

Henry Salvia wrote:

> Doug O'Leary wrote:
> 
>>Hey, all;
> 
> Hey. Its late, and you'll get better answers than this in the morning,
> but I thought I'd take a swing at this.
> 
>>This seems like something that should be possible.
>>
>>I have a config file that I'd like to read in as follows:
>>
>>[INVALID_TGT_GROUPS]
>>adm
>>bin
>>sys
>>sysadmin
>>
>>[VALID_HD_USERS]
>>blfarrel
>>dekojis
>>jclemens
>>
>>[INVALID_HD_USERS]
>>dkoleary
>>jarodrigue
>>trzator
>>
>>What I'd like at the end is hashes as follows:
>>
>>%INVALID_TGT_GROUPS ( 'adm' => 1, 'bin' => 1 ...)
>>%VALID_HD_USERS     ( 'blfarrel' => 1, 'dekojis' => 1...)
>>%INVALID_HD_USERS   ( 'dkoleary' => 1, 'jarodrigue' => 1 ...)
> 
> 
> Using variables to name hashes is too tricky for me. Read up on
> (hmm: I can't remember if they're called soft or indirect)
> references if you want to know why this is not a good thing to do. I
> would
> go up a level and make a hash of hashes with the config headers as keys:
> 
> Here's how I'd write read_config() (warning: untested code)

Isn't this an INI file, and isn't there a Perl module that does the 
reading bit?

-- 
John                               MexIT: http://johnbokma.com/mexit/
                            personal page:       http://johnbokma.com/
    Experienced Perl programmer available:     http://castleamber.com/
             Happy Customers: http://castleamber.com/testimonials.html


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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