FusqlFS::Backend::PgSQL::Role::Base - abstract PostgreSQL configuration complexity for FusqlFS::Backend::PgSQL::Role::* classes
package FusqlFS::Backend::PgSQL::Role::Acl; use parent 'FusqlFS::Backend::PgSQL::Role::Base'; sub init { my $self = shift; my $relkind = shift; my @kind = $self->kind($relkind); # initialize instance }
This class hides configuration complexity for FusqlFS::Backend::PgSQL::Role::* family of modules including FusqlFS::Backend::PgSQL::Role::Acl and FusqlFS::Backend::PgSQL::Role::Owner.
FusqlFS::Backend::PgSQL::Role::*
Its single method kind() accepts single character argument designating the kind of referenced database artifact and returns a number of configuration parameters to construct correct SQL statements for the artifact's kind. The possible values of this argument are:
kind()
r
Table (a.k.a. relation).
i
Table's index.
S
Sequence.
v
View.
_F
Function (a.k.a. stored procedure).
_L
Language.
If list context kind() method returns a list of ($kind, $pfx, $table, $filter) where
($kind, $pfx, $table, $filter)
$kind
is the name of artifact type, e.g. TABLE, INDEX, SEQUENCE, VIEW, FUNCTION or LANGUAGE,
TABLE
INDEX
SEQUENCE
VIEW
FUNCTION
LANGUAGE
$pfx
is the prefix for fields in pg_catalog schema's table with data of the artifact type, e.g. rel for pg_class or pro for pg_proc,
pg_catalog
rel
pg_class
pro
pg_proc
$table
is the table in pg_catalog schema with information about artifacts of this kind, e.g. pg_class, pg_proc or pg_language,
pg_language
$name
is the SQL statement to get artifact's name (usually it's just ${pfx}name, but can be rather different, e.g. in case of functions), use this instead of self-composed name fields in both WHERE and SELECT expressions.
${pfx}name
WHERE
SELECT
$filter
is the additional WHERE clause for pg_class table to filter data by required relkind field value, contains empty string for tables other than pg_class.
relkind
In scalar context this method returns hashref with keys named kind, pfx, table, name, filter and values as described above, so this hashref is usable with FusqlFS::Artifact/hprintf method.
kind
pfx
table
name
filter
FusqlFS::Artifact/hprintf
To install FusqlFS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FusqlFS
CPAN shell
perl -MCPAN -e shell install FusqlFS
For more information on module installation, please visit the detailed CPAN module installation guide.