Class-User-DBI

 view release on metacpan or  search on metacpan

lib/Class/User/DBI/Roles.pm  view on Meta::CPAN


Deletes from the database all roles specified.  Return value is the number of
roles actually deleted, which may be less than the number of roles requested if
any of the requested roles didn't exist in the database to begin with.


=head2 exists_role

    print "Role exists." if $r->exists_role( 'office' );

Returns true if a given role exists, and false if not.

=head2 fetch_roles

    foreach my $role ( $r->fetch_roles ) {
        print "$role->[0] = $role->[1]\n";
    }
    
Returns an array of array refs.  Each array ref contains the role's name and its
description as the first and second elements, respectively.

An empty list means there are no roles defined.

=head2 get_role_description

    my $description = $r->get_role_description( 'office' );
    
Returns the description for a given role.  Throws an exception if the role 
doesn't exist, so be sure to test with C<< $r->exists_role( 'office' ) >> first.

=head2 set_role_description

    $r->set_role_description( 'office', 'New description for office role.' );

Sets a new description for a given role.  If the role doesn't exist in the
database, if not enough parameters are passed, or if any of the params are
C<undef>, an exception will be thrown.  To update a role by giving it a blank
description, pass an empty string as the description.


=head1 DEPENDENCIES

The dependencies for this module are the same as for L<Class::User::DBI>, from
this same distribution.  Refer to the documentation in that module for a full
description.


=head1 CONFIGURATION AND ENVIRONMENT

Please refer to the C<configure_db()> class method for this module for a
simple means of creating the table that supports this class.

All SQL for this distribution is contained in the L<Class::User::DBI::DB> 
module.


=head1 DIAGNOSTICS

If you find that your particular database engine is not playing nicely with the
test suite from this module, it may be necessary to provide the database login 
credentials for a test database using the same engine that your application 
will actually be using.  You may do this by setting C<$ENV{CUDBI_TEST_DSN}>,
C<$ENV{CUDBI_TEST_DATABASE}>, C<$ENV{CUDBI_TEST_USER}>, 
and C<$ENV{CUDBI_TEST_PASS}>.

Currently the test suite tests against a SQLite database since it's such a
lightweight dependency for the testing.  The author also uses this module
with several MySQL databases.  As you're configuring your database, providing
its credentials to the tests and running the test scripts will offer really 
good diagnostics if some aspect of your database tables proves to be at odds 
with what this module needs.


=head1 INCOMPATIBILITIES

This module has only been tested on MySQL and SQLite database engines.  If you
are successful in using it with other engines, please send me an email detailing
any additional configuration changes you had to make so that I can document
the compatibility, and improve the documentation for the configuration process.

=head1 BUGS AND LIMITATIONS

=head1 AUTHOR


David Oswald, C<< <davido at cpan.org> >>

=head1 BUGS

Please report any bugs or feature requests to
C<bug-class-user-dbi at rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Class-User-DBI>.  I will be
notified, and then you'll automatically be notified of progress on your bug as
I make changes.




=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Class::User::DBI::Roles


You can also look for information at:

=over 4

=item * Class-User-DBI on Github

L<https://github.com/daoswald/Class-User-DBI.git>

=item * RT: CPAN's request tracker (report bugs here)

L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-User-DBI>

=item * AnnoCPAN: Annotated CPAN documentation

L<http://annocpan.org/dist/Class-User-DBI>

=item * CPAN Ratings

L<http://cpanratings.perl.org/d/Class-User-DBI>

=item * Search CPAN

L<http://search.cpan.org/dist/Class-User-DBI/>



( run in 1.009 second using v1.01-cache-2.11-cpan-39bf76dae61 )