[26642] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8749 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 9 14:05:28 2005

Date: Fri, 9 Dec 2005 11:05:04 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 9 Dec 2005     Volume: 10 Number: 8749

Today's topics:
        %USERACL Is Empty?! <wh2leung@student.cs.uwaterloo.ca>
    Re: %USERACL Is Empty?! xhoster@gmail.com
    Re: A simple inheritance question. (Anno Siegel)
    Re: FAQ 2.11 Perl Books <sdn.girths00869@zoemail.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 9 Dec 2005 13:12:07 -0500
From: William <wh2leung@student.cs.uwaterloo.ca>
Subject: %USERACL Is Empty?!
Message-Id: <Pine.GSO.4.58.0512091243350.11141@cpu02.student.cs.uwaterloo.ca>

basically %USERACL is a hash containing the key and values read from the
following file:
UserID=LoginID:Group:Name:Email:Password:IsAdmin:Status:Servers:Lists:Logs:Macros:Eod:FileMgr:MacroList:PnL:EditPnL:BO
AADUBLINJORDAN=AADUBLINJORDAN:BO:AADUBLINJORDAN:AADUBLINJORDAN:XEV5iEfluxjWM:::::::::[]:[]:[]:
CHANKN=CHANKN:SYS:Kenneth Chan:kenneth.chan@abcCompany.com:XECiTZAqeyBjE:1:1::1:1:1:1:1:[]:[]:[]:

now for test.pl:

      1 #!/usr/bin/perl
      2
      3 use strict;
      4 use warnings;
      5 use CGI;
      6
      7 require "./mxrt_auth.pl";
      8
      9 my $query = new CGI;
     10 my %USERACL = initAuthMgr($query); (see NOTE1 for initAuthMgr)
     11
     12 while ( (my $key, my $value) = each %USERACL) {
     13     print "$key = $value\n";
     14 }
     15

Question #1) The following error was generated by "use warnings;"

[mk_murex@mkmxg00 /mkapp/webapps/mxrt-cgi/upload_repo 12:45:03]$ ./test.pl
> output.txt
Can't locate warnings.pm in @INC (@INC contains:
/usr/perl5/5.00503/sun4-solaris /usr/perl5/5.00503
/usr/perl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 .) at
 ./test.pl line 4.
BEGIN failed--compilation aborted at ./test.pl line 4.

NOTE1: for line 10 of test.pl:

mxrt_auth.pl::initAuthMrg is defined as follows:

sub initAuthMgr {
    ($AUTHQ) = @_;
    %AUTH_INFO = $AUTHQ->cookie('MXRT_USERACL');
    foreach (keys %AUTH_INFO) {
        print ($AUTH_INFO{$_})."<br>";
    }
    return  %AUTH_INFO;
}

Question #2) nothing is printed by line 12-14 of test.pl.  (Even
without the line "use warnings;")

Why???

Expected output of the following script - test.pl:
IsAdmin=1
Status=1
Servers=1
 ...







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

Date: 09 Dec 2005 18:47:42 GMT
From: xhoster@gmail.com
Subject: Re: %USERACL Is Empty?!
Message-Id: <20051209134742.207$IW@newsreader.com>

William <wh2leung@student.cs.uwaterloo.ca> wrote:
> basically %USERACL is a hash containing the key and values read from the
> following file:

No, it is not.  Nowhere in your program do you read from the following
file and put it into that hash.

> UserID=LoginID:Group:Name:Email:Password:IsAdmin:Status:Servers:Lists:Log
> s:Macros:Eod:FileMgr:MacroList:PnL:EditPnL:BO
> AADUBLINJORDAN=AADUBLINJORDAN:BO:AADUBLINJORDAN:AADUBLINJORDAN:XEV5iEflux
> jWM:::::::::[]:[]:[]: CHANKN=CHANKN:SYS:Kenneth
> Chan:kenneth.chan@abcCompany.com:XECiTZAqeyBjE:1:1::1:1:1:1:1:[]:[]:[]:
>
> Question #1) The following error was generated by "use warnings;"
>
> [mk_murex@mkmxg00 /mkapp/webapps/mxrt-cgi/upload_repo 12:45:03]$
> ./test.pl
> > output.txt
> Can't locate warnings.pm in @INC (@INC contains:
> /usr/perl5/5.00503/sun4-solaris /usr/perl5/5.00503
> /usr/perl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005 .) at
> ./test.pl line 4.
> BEGIN failed--compilation aborted at ./test.pl line 4.

You have an ancient version of perl.  It does not come with the warnings.pm
module.  Either upgrade perl or don't "use warnings".  (Use the -w switch
instead.)

>
> NOTE1: for line 10 of test.pl:
>
> mxrt_auth.pl::initAuthMrg is defined as follows:
>
> sub initAuthMgr {
>     ($AUTHQ) = @_;
>     %AUTH_INFO = $AUTHQ->cookie('MXRT_USERACL');

Does $AUTHQ have a cookie named MXRT_USERACL?

>     foreach (keys %AUTH_INFO) {
>         print ($AUTH_INFO{$_})."<br>";
>     }
>     return  %AUTH_INFO;
> }
>
> Question #2) nothing is printed by line 12-14 of test.pl.  (Even
> without the line "use warnings;")
>
> Why???

Probably because there is nothing to print.

>
> Expected output of the following script - test.pl:
> IsAdmin=1
> Status=1
> Servers=1
> ...

I didn't expect that to be the outcome.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

Date: 9 Dec 2005 17:21:17 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: A simple inheritance question.
Message-Id: <dnceed$8qo$1@mamenchi.zrz.TU-Berlin.DE>

Abigail  <abigail@abigail.nl> wrote in comp.lang.perl.misc:
> Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMMCDLXXXII
> September MCMXCIII in <URL:news:dn9r8b$h3h$1@mamenchi.zrz.TU-Berlin.DE>:
> @@  
> @@  Of course, inside-out objects hadn't been invented when Perl OO was
> @@  introduced, that took a few years.  Speaking of which, is there a
> @@  single inventor?
> 
> Yes. I did stand on the shoulder of giants though, and I refined the
> model after feedback.

That certainly deserves heart-felt congratulations! (And some heart-felt
jealousy to boot.)

Inside-out objects have changed my view of what Perl OO is like.  Lexical
scope for attributes is one thing.  Independence of the underlying type
(scalar, hash, etc.) is the other.

> 
> @@                    I know that I have used classes where most of the
> @@  info was stored in some lexical $hash{ "$object"}, but I never took
> @@  the step of making the central object entirely meaningless.
> 
> 
> That looks like 'fly-weight'-like techniques, who have been a source
> of inspiration.

Certainly.  In a way, the inside-out technique is (a certain type of)
fly-weight taken to the extreme.

I can still reconstruct my train of thought while working with a kind
of fly-weight scheme (though I didn't know that term then).  Some
attributes were stored in hashes keyed by object id.

"Gee...", I thought, "I could treat all attributes like that.  But
wait...  I'd still need a blessed hashref for the object." (It didn't
occur to me that now *any* blessed ref would do, far less the importance
of that. The rut.)

"So no big advantage there", I went on thinking, "The hash might as well
do something useful and store some attributes.  Anyway, this is idle
speculation while there's a program to write.  Where was I?"

And there went *my* chance of discovering inside-out objects.

Anno
-- 
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on 
"show options" at the top of the article, then click on the 
"Reply" at the bottom of the article headers.


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

Date: Fri, 09 Dec 2005 09:13:03 -0600
From: "Eric J. Roode" <sdn.girths00869@zoemail.net>
Subject: Re: FAQ 2.11 Perl Books
Message-Id: <Xns972768245779Asdn.comcast@216.196.97.136>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in
news:dnc2lj$o6$1@mamenchi.zrz.TU-Berlin.DE:

> Eric J. Roode <sdn.girths00869@zoemail.net> wrote in
comp.lang.perl.misc:
>> PerlFAQ Server <comdog@pair.com> wrote in
>> news:dmt874$4kr$1@reader2.panix.com: 
>> 
>> > 
>> > 2.11: Perl Books
>> > 
>> 
>> I'd like to suggest two books that were published this summer:
>> 
>>     _Higher-Order Perl_, by Mark Jason Dominus
>>     _Perl Best Practices_, by Damian Conway
> 
> Oh, sure.  Because it pushes your Readonly module! :)

Hey, I've got to get my fame *somehow*!  :-)

> Eric, speaking of Readonly -- would you consider putting something
like
> this in class Readonly (tested, but re-typed from memory):
[...]
> That would allow users to say, for instance
> 
>     my @NAMES;
>     use Readonly \ @names => qw( Ida Otto Erich);
> 
> and have the assignment happen at compile time.

That's... a really great idea.  I had never thought of that.
I will definitely implement that, or something very like that.

Thank you very much!

- -- 
Eric
`$=`;$_=\%!;($_)=/(.)/;$==++$|;($.,$/,$,,$\,$",$;,$^,$#,$~,$*,$:,@%)=(
$!=~/(.)(.).(.)(.)(.)(.)..(.)(.)(.)..(.)......(.)/,$"),$=++;$.++;$.++;
$_++;$_++;($_,$\,$,)=($~.$"."$;$/$%[$?]$_$\$,$:$%[$?]",$"&$~,$#,);$,++
;$,++;$^|=$";`$_$\$,$/$:$;$~$*$%[$?]$.$~$*${#}$%[$?]$;$\$"$^$~$*.>&$=`
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.5 (MingW32) - WinPT 0.7.96rc1

iD8DBQFDmZ84Y96i4h5M0egRAsyAAJ0XLfVE1fwp8j+kuiSF1zetewFS+wCg06fb
2xU2jJ3I/D6IIHQNlvYNhb4=
=T8W/
-----END PGP SIGNATURE-----


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

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


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