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

hey fellow pilgrims of the perl monks monastary

Is there a way to use check rm to see if the entries match an existing entry in a database?

Follows is my current checck rm routine:

my ($results, $err_page) = $self->check_rm('register', { required => [qw/username password password_check email email_check real_name year month date sex agree /], dependency_groups => {password_group => [qw/password password_chec +k/], email_group => [qw/email email_check/], }, constraints => { username => qr/^[a-z]\w{5,15}$/i, password => [ { constraint => qr/^\w{6,20}$/ }, { name => 'password_mismatch', constraint => sub { my ($password, $password_check) = @_; return ($password eq $password_check); }, params => [qw(password password_check)] } ], email => [ { constraint => 'email' }, { name => 'email_mismatch', constraint => sub { my ($email, $email_check) = @_; return ($email eq $email_check); }, params => [qw(email email_check)] } ], year => qr/^[1][0-9][0-9][0-9]$/, month => qr/^[A-Z]\w{2,10}$/i, date => qr/^[0-9][0-9]$/, }, filters => ['trim'], msgs => { missing => 'required +', invalid => 'invalid' +, constraints => { 'password_mismatch' => "Passwords don't match", 'email_mismatch' => "Email Addresses don't match", } } }); return $err_page if $err_page;

So basically i want to read in the values compare them to the database, and if any of the entire exist return the error page, whilst maintaining the inputted values, the values that id like to check is, the username, email, real_name

The form can be found here and the entire routine(perl module) Here

Yours

Barry Carlyon barry@barrycarlyon.co.uk

Replies are listed 'Best First'.
Re: A validate rm, question
by shmem (Chancellor) on Jun 25, 2006 at 20:42 UTC
    Is there a way to use check rm to see if the entries match an existing entry in a database?
    Your question is highly misleading. Steaming slightly in the summer heat, my thoughts condensed immediately into a big question sign, as rm is the UNIX binary to remove files, which doesn't check for database records by default. Further reading suggested that you might have meant check_rm instead (s/ /_/), a method which doesn't appear neither as source in the code you posted, nor in the package your provided link leads to.

    As for the answer - I guess, yes, it can be done, maybe a check before SuperClan::Database::User_Auth->create() would be handy, in the register_process method of SuperClan::Application::User_Auth.

    But how can I know? Aren't the packages by "Super Clan © 2006 B Carlyon Web Development 2006", i.e. by yourself? Then you are the one who possibly knows best how and where to hook in a comparation of fields.

    Follows is my current checck rm routine:
    my ($results, $err_page) = $self->check_rm('register', ...

    This is rather an invocation of check_rm as a method of $self.

    Fellow monk, please rethink your question (see I know what I mean. Why don't you?), and strip it down to the core of your problem with the help of How do I post a question effectively?, for I can't do a code review even if I had the time to spare - in http://superclan.lsrfm.com/src/ there are only SuperClan.pm and User_Auth.pm.

    best regards,
    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}