26 Apr 2003 15:58:45 UTC
- Distribution: Net-Gnats
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (0)
- Testers (4 / 0 / 0)
- KwaliteeBus factor: 0
- License: unknown
- Activity24 month
- Download (8.47KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionMHOOLEHAN Mike Hoolehan
- COMMON TASKS
- METHOD DESCRIPTIONS
Net::Gnats::PR - Represents a Gnats PR.
use Net::Gnats; my $g = Net::Gnats->new(); $g->connect(); my @dbNames = $g->getDBNames(); $g->login("default","somedeveloper","password"); my $PRtwo = $g->getPRByNumber(2); print $PRtwo->asString(); my $newPR = Net::Gnats::PR->new(); $newPR->setField("Submitter-Id","developer"); $g->submitPR($newPR); $g->disconnect();
Net::Gnats::PR models a GNU Gnats PR (Problem Report). The module allows proper formatting and parsing of PRs through an object oriented interface.
The current version of Net::Gnats (as well as related information) is available at http://gnatsperl.sourceforge.net/
The Net::Gnats::PR object acts as a container object to store information about a PR (new or otherwise). A new PR is submitted to gnatsperl by constructing a PR object.
my $newPR = Net::Gnats::PR->new(); $newPR->setField("Submitter-Id","developer"); $newPR->setField("Originator","Doctor Wifflechumps"); $newPR->setField("Organization","GNU"); $newPR->setField("Synopsis","Some bug from perlgnats"); $newPR->setField("Confidential","no"); $newPR->setField("Severity","serious"); $newPR->setField("Priority","low"); $newPR->setField("Category","gnatsperl"); $newPR->setField("Class","sw-bug"); $newPR->setField("Description","Something terrible happened"); $newPR->setField("How-To-Repeat","Like this. Like this."); $newPR->setField("Fix","Who knows");
Obviously, fields are dependent on a specific gnats installation, since Gnats administrators can rename fields and add constraints.
Instead of setting each field of the PR individually, the setFromString() method is available. The string that is passed to it must be formatted in the way Gnats handles the PRs (i.e. the '>Field: Value' format. You can see this more clearly by looking at the PR files of your Gnats installation). This is useful when handling a Gnats email submission ($newPR->setFromString($email)) or when reading a PR file directly from the database.
Constructor, no arguments.
Sets a gnats field value. Expects two arguments: the field name followed by the field value.
Returns the string value of a PR field.
Sets the gnats PR number. This is the only field name explicitly known to Net::Gnats::PR. Provide PR number as sole argument.
Returns the gnats PR number. This is the only field name explicitly known to Net::Gnats::PR.
Returns the PR formatted as a hash. The returned hash contains field names as keys, and the corresponding field values as hash values.
Returns the list of PR fields contained in the object.
Returns the PR object formatted as a Gnats recongizable string. The result is suitable for submitting to Gnats.
Parses a Gnats formatted PR and sets the object's fields accordingly.
Bug reports are very welcome. Please submit to the project page (noted below).
Mike Hoolehan, <lt>email@example.com<gt> Project hosted at sourceforge, at http://gnatsperl.sourceforge.net
Copyright (c) 1997-2001, Mike Hoolehan. All Rights Reserved. This module is free software. It may be used, redistributed, and/or modified under the same terms as Perl itself.