Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have looked everywhere I can think, but have not been able to find out what "match_group" is. I was real happy with the program referenced by merlyn in RE: expect.pm (user_manage) as long as I used flat files. Now that I need to move on to store the user and group information in a database, I am having problems. Users designated as "administrators" are not getting the administrator screen (do_administration). Here is the code from user_manage that seems to be the problem area:
if ($ADMIN_GROUP && $db->match_group(-user => $user, -group => $ADMIN_GROUP)) { do_administration($db); exit 0; }
(My misunderstanding probably has a lot to do with my lack of understanding/aversion to oo programming) I have $ADMIN_GROUP set to "administrators" and when I look in the database, the group is set to "administrators". I have put in debug statements, but don't know how to handle debugging using match_group. I searched the user_manage program, but there is only 1 occurrence of match_group. Any help or links would be great! Thanks, Daniel

Replies are listed 'Best First'.
(Ovid) Re: cgi unknown function - match_group
by Ovid (Cardinal) on Nov 02, 2001 at 22:24 UTC
    • What do you want this code to do?
    • What is it actually doing?

    Just saying that you have a 'problem' with some code without explicitly stating what the problem is does not give us much to go on.

    match_group() is a method in HTTPD::RealmManager that returns a true/false letting you know if a given user is in a given group. Pretty simple, huh? Does this if condition ever evaluate as true? If so, have you verified your call to db_administration? If the if statement never evaluates to true but you expect that it should, have you verified what's in $ADMIN_GROUP and $user? If so, are you positive that the given user is in the given group?

    I also noticed that above code is taken verbatim from this program. Are you using this program? Have you modified it? Did you modify it correctly? If you did modify it, you might wish to modify it to use strict. It might just catch your error for you. (and shame on Lincoln Stein for publishing such a large program that doesn't use strict)

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

      Ovid, yes, I am using that program (except version 1.58)

      I modified the top customization section (everything worked ok with flat files), then put in a few debug statements after it did not work.

      if ($ADMIN_GROUP){ print "\n<p> ADMIN GROUP defined:$ADMIN_GROUP:\n<p>"; }
      This returns

      ADMIN GROUP defined:administrators:

      I put in "use strict;", but it crashed, I am wading through the errors like

      Global symbol "$CONFIG_FILE" requires explicit package name at ./user_ +manage line 38.

      I am positive I have put a user "bob" in group "administrators" in the database table, but the "do_administration" is never executed when I log in as bob.

      What I do not know is how to put in a debug to tell what group the program thinks user bob is in.

      I really don't think the problem is the code, but probably my setup, I just can not pinpoint why the "do_administration" subroutine is not being called for people in group "administrators".

      Thanks, Daniel

        Does anyone know of a location I can go to find out what methods are available in a particular module (HTTPD::RealmManager ) in particular???

        I am looking for a method that will tell me what group value the user_manage program thinks the database has for a particular username.

        Thanks,

        Daniel