|
CONSTRUCTORnewThe new() constructor does not expect any options. However, this may change in the future when PR initialization is moved from Net::Gnats to this class.my $pr = Net::Gnats::PR->new ACCESSORSasHashReturns the PR formatted as a hash. The returned hash contains field names as keys, and the corresponding field values as hash values.CHANGE ALERT: This method now returns all FieldInstance objects. DEPRECATION NOTICE: This accessor will be removed in the near future. asStringReturns the PR object formatted as a Gnats recongizable string. The result is suitable for submitting to Gnats.my $serialized_pr = $pr->asString; DEPRECATION NOTICE: This accessor will be removed in the near future. Instead, use: my $serialized_pr = $pr->serialize; getFieldReturns the string value of a PR field.$pr->getField('field'); DEPRECATION NOTICE: this will be deprecated in the near future. Use instead: $r->get_field('field')->value getKeysReturns the list of PR fields contained in the object.getNumberReturns the gnats PR number. In previous versions of gnatsperl the Number field was explicitly known to Net::Gnats::PR. This method remains for backwards compatibility.DEPRECATION NOTICE: this will be deprecated in the near future. Use instead: $r->get_field('Number')->value add_fieldAdds a field instance to the fieldlist of a Nets::Gnats::PR object for fields that are not header fields.get_fieldReturns a field instance of an Nets::Gnats::PR object if field instance is defined.get_field_fromReturn an anonymous array of Nets::Gnats::PR object fields instances from a word part match.replaceFieldSets a new value for an existing field.If the field requires a Change Reason, and the field does not exist in the PR, then the FieldInstance for the Change Reason is created. Returns 0 if the field does not exist. Returns 0 if the field requires a changeReason, but one was not provided. Returns 0 if the change did not occur successfully. Returns 1 if the field is set and flushed to Gnats. setFieldSets a Gnats field value. Expects two arguments: the field name followed by the field value. If the field requires a change reason, provide it as a third argument.submitSubmit this PR to Gnats. It uses the currently active session to perform the submit.$pr = $pr->submit; After a successful submit, the PR with the PR Number is returned. say 'My new number is: ' . $pr->get_field('Number')->value; By default, submit will not send a PR which already has a PR Number. If your intent is to create a new PR based on this one, use the force option (may change in the future). This is useful when a series of similar PRs need to be submitted. $pr = $pr->submit(1); If the PR submission based on force was not successful, the PR will return with the same PR Number. split_cslSplit comma-separated list. Commas in quotes are not separators! fix_email_addrsTrim email addresses as they appear in an email From or Reply-To header into a comma separated list of just the addresses. Delete everything inside ()'s and outside <>'s, inclusive. parse_lineBreaks down a Gnats query result.deserializeDeserializes a PR from Gnats and returns a hydrated PR.my $pr = Net::Gnats::PR->deserialize(raw => $c->response->raw, schema => $s->schema); NAMENet::Gnats::PR - Represents a Gnats PR.SYNOPSISuse 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(); DESCRIPTIONNet::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/ COMMON TASKSCREATING A NEW PRThe 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. CREATING A NEW PR OBJECT FROM A PREFORMATTED PR STRINGInstead 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.BUGSBug reports are very welcome. Please submit to the project page (noted below).AUTHORMike Hoolehan, <lt>mike@sycamore.us<gt> Project hosted at sourceforge, at http://gnatsperl.sourceforge.netCOPYRIGHTCopyright (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.
Visit the GSP FreeBSD Man Page Interface. |