NAME
Perlbug::Base - Module for bringing together Config, Log, Format, Do, TM, Mysql etc.
DESCRIPTION
Methods for perlbug database access, all_flags, check_user, get_list, get_data, clean_up, etc.
SYNOPSIS
my $o_base = Perlbug::Base->new;
my %user = $o_base->user_data('richard');
print "User is: ".$user{'username'};
METHODS
- new
-
Create new Perlbug object, (see also Description above):
my $pb = Perlbug->new();
- url
-
Store and return the given url.
- do
-
Wrap a Perlbug::Do command
my $i_ok = $pb->do('b', 'bugid');
- debug
-
Wrap o_log->debug calls
- dodgy_addresses
-
Returns quoted, OR-d dodgy addresses prepared for a pattern match ...|...|...
my $regex = $o_obj->dodgy_addresses('from'); # $rex = 'perlbug\@perl\.com|perl5\-porters\@perl\.org|...'
- link
-
Wrap o_log->link calls
- AUTOLOAD
-
Wrapper for debug functions, translates this:
$o_obj->debug3($data); # to $o_obj->{'o_log'}->debug(3, $data); # this
- dump
-
Wrap Data::Dumper catering for www also.
- can_update
-
Check if current user is allowed to update given item/s.
print 'yes' if $o_perlbug->can_update([$user||$bid||$mid||$bid|$pid]);
- fatal
-
Wrap o_log->fatal calls
- start
- finish
- format
-
Wrap o_format->format calls
- format_overview
-
Wrap o_format->overview calls
- format_schema
-
Wrap o_format->schema calls
- copy
-
Wrap Log::copy
- flags
-
Returns array of options for given type.
my @list = $pb->flags('category');
- all_flags
-
Return all flags available in db keyed by type.
my %flags = $pb->all_flags; %flags = ( # now looks like this: 'category' => ['core', 'docs', 'install'], # ... 'status' => ['open', 'onhold', 'onhold'], # ... # ... );
- date_hash
- active_admins
-
Returns active admins from db.
my @active = $pb->active_admins;
- active_admin_addresses
-
Returns active admin addresses from db.
my @addrs = $pb->active_admin_addresses;
- user_data
-
Return (cached) data on given user
my %data = $pb->user_data('richard');
- help
-
Returns help message for perlbug database.
my $help = $pb->help;
- spec
-
Returns spec message for perlbug database.
my $spec = $pb->spec();
- flow
-
Details how the mail / web mechanism flows
- administration_failure
-
Deal with a failed administration attempt
my $i_ok = $self->administration_failure($bid, $user, $commands);
- check_user
-
Checks given user is registered in the database as an admin.
Sets userid in admin and thereby status for later reference.
$pb->check_user($user_name);
- isadmin
-
Stores and returns current admin userid (post check_user), checks whether system is restricted or not.
next unless $pb->isadmin;
- status
-
Returns 'A' or 'U' depending on whether user is an admin or a 'mere' user.
my $thing = ($self->status eq 'A') ? 'key' : 'lock';
- ok
-
Checks bugid is in valid format (looks like a bugid) (uses get_id):
&do_this($id) if $pb->ok($id);
- get_id
-
Determine if the string contains a valid bug ID
- _switches
-
Stores and returns ref to list of switches given by calling script. Only these will be parsed within the command hash in process_commands.
my $switches = $pb->_switches(qw(e t T s S h l)); #sample
- result
-
Storage area (file) for results from queries, returns the FH.
my $res = $pb->result('store this stuff'); #store
- fh
-
Wrapper for Log fh
- set_site
-
Set the site directory for text files, headers, todos etc.
- read
- append
-
Wrapper for Log append
- get_results
-
Return the results of the queries from this session.
my $a_data = $pb->get_results;
- get_list
-
Returns a simple list of items (column values?), from a sql query.
my @list = $pb->get_data('SELECT ticketid FROM tm_tickets');
- get_data
-
Returns a list of hash references, from a sql query.
my @hash_refs = $pb->get_data('SELECT * FROM tm_tickets');
- exec
-
Returns statement handle from sql query.
my $sth = $pb->exec("INSERT @data INTO table");
- exists
-
Does this bugid exist in the db?
- tm_parents_children
-
Assign to given bugid, given list of parent and child bugids
- tm_cc
-
Assign to given bugid, given list of cc's, return current cc's
- tm_patch_ticket
-
Assign to given bugid, given list of patchids, return valid, @pids
- tm_tests
-
Assign to given bugid, given list of testids, return valid, @tids
- notify_cc
-
Notify tm_cc addresses of changes, current status of bug.
- track
-
Track some function or modification to the db.
$i_tracked = $self->track($type, $id, $entry);
- ck822
-
Email address checker (RFC822) courtesy Tom Christiansen/Jeffrey Friedl.
print (($o_email->ck822($addr)) ? "yup($addr)\n" : "nope($addr)\n");
- htpasswd
-
Modify, add, delete, comment out entries in .htpasswd
$i_ok = $o_web->htpasswd($userid, $pass); # entry ok? @entries = $o_web->htpasswd; # returns list of entries ('userid:passwd', 'user2:pass2'...)
- clean_up
-
Clean up previous (logs and results) activity whenever run.
Exits when done.
- insert_bug
-
Insert a bug into the database
my ($i_ok, $bid, $mid) = $o_obj->insert_bug(@args);
- parse_flags
-
Return the 'AND ...' or 'SET ...' condition for a tm_ticket query given the flags from the status, category and severity columns WITHOUT the leading 'AND' or a leading ', ' separator.
my $stuff = $pb->parse_flags([('o', 'build')], 'AND'); # $stuff is now "status = 'open' AND category = 'build'" my $sql = "SELECT * FROM some_table WHERE $stuff"; # or my $stuff = $pb->parse_flags([('o', 'build')], 'SET'); # $stuff is now "status = 'open', category = 'build'" my $sql = "UPDATE tm_tickets SET $stuff WHERE ticketid = 'xyz'";
- parse_str
-
my %cmds = $o_obj->parse_str('patch_<bugid>_etc' | (qw(patchid bugid etc));