BZ::Client::Bug::Comment - Client side representation of an Comment on a Bug in Bugzilla
version 4.4004
This class provides methods for accessing and managing comments in Bugzilla. Instances of this class are returned by BZ::Client::Bug::Comment::get.
my $client = BZ::Client->new( url => $url, user => $user, password => $password ); my $comments = BZ::Client::Bug::Comment->get( $client, $ids );
This section lists the class methods, which are available in this module.
my $comments = BZ::Client::Bug::Comment->get( $client, 1234 ); my $comments = BZ::Client::Bug::Comment->get( $client, { ids => \@list, commend_ids => \@list } );
This allows you to get data about comments, given a list of bugs and/or comment ids.
Actual Bugzilla API method is "comments".
Added in Bugzilla 3.4
A single scalar is considered a search for "ids", otherwise a hash reference must be provided.
Note: At least one of "ids" or "comment_ids" is required.
In addition to the parameters below, this method also accepts the standard "include_fields" in BZ::Client::Bug and "exclude_fields" in BZ::Client::Bug arguments.
ids (array) - An array that can contain both bug ID's and bug aliases. All of the comments (that are visible to you) will be returned for the specified bugs.
comment_ids (array) - An array of integer comment ID's. These comments will be returned individually, separate from any other comments in their respective bugs.
new_since (DateTime) - If specified, the method will only return comments newer than this time. This only affects comments returned from the "ids" argument. You will always be returned all comments you request in the comment_ids argument, even if they are older than this date.
A hash reference containing two items is returned. e.g.
{ bugs => { 123 => \@comments, 456 => \@comments, }, comments => { 789 => $comment, }, }
The Bugzilla WebService documentation doesnt state what order the comments will be in, however they seem to be returned [ oldest, newest ]. If this order is important to you, then you should sort them just to be sure.
More details on the above example:
This is used for bugs specified in "ids" parameter.
This is a hash, wherein the keys are the numeric IDs of the bugs, and the corresponding value is an array ref of comment objects.
Note that any individual bug will only be returned once, so if you specify an ID multiple times in ID's, it will still only be returned once.
Each individual comment requested in "comment_ids" is returned here.
This is a hash wherein the keys are the numeric comment ID, and the corresponding value is the comment object.
A "comment" as described above is an object instance of this package i.e. BZ::Client::Bug::Comment.
If you specified an alias and there is no bug with that alias.
The bug_id you specified doesn't exist in the database.
bug_id
You do not have access to the bug_id you specified.
You specified the ID of a private comment in the comment_ids argument, and you are not in the "insider group" that can see private comments.
You specified an ID in the "comment_ids" argument that is invalid--either you specified something that wasn't a number, or there is no comment with that ID.
This allows you to add a comment to a bug in Bugzilla.
Actual Bugzilla API method is "add_comment".
Added in Bugzilla 3.2.
Modified to return the new comment's ID in Bugzilla 3.4
Modified to throw an error if you try to add a private comment but can't, in Bugzilla 3.4.
An instance of this package or a hash containing:
id (int or string) Required - The ID or alias of the bug to append a comment to.
comment (string) Required - The comment to append to the bug. If this is empty or all whitespace, an error will be thrown saying that you did not set the comment parameter.
is_private (boolean) - If set to true, the comment is private, otherwise it is assumed to be public.
Before Bugzilla 3.6, the "is_private argument" was called private, and you can still call it private for backwards-compatibility purposes if you wish.
private
work_time (double) - Adds this many hours to the "Hours Worked" on the bug. If you are not in the time tracking group, this value will be ignored.
The id of the newly-created comment.
You specified a "work_time" larger than the maximum allowed value of 99999.99.
99999.99
The ID you specified doesn't exist in the database.
You did not have the necessary rights to edit the bug.
You tried to add a private comment, but don't have the necessary rights.
You tried to add a comment longer than the maximum allowed length (65,535 characters).
Before Bugzilla 3.6, error 54 and error 114 had a generic error code of 32000.
Returns the HTML rendering of the provided comment text.
Actual Bugzilla API method is "render_comment".
Note: this all takes place on your Bugzilla server.
Added in Bugzilla 5.0.
text (string) Required - Text comment text to render
id The ID of the bug to render the comment against.
The HTML rendering
my $comment = BZ::Client::Bug::Comment->new( id => $bug_id, comment => $comment, is_private => 1 || 0, work_time => 3.5 );
Creates a new instance with the given details. Doesn't actually touch your Bugzilla Server - see "add" for that.
This section lists the modules instance methods.
bug_id (int) - The ID of the bug that this comment is on when reading
bug_id (int or string) - The ID or alias of the bug to append a comment to when writing
comment (string) The actual text of the comment when reading
When writing, the comment to append to the bug. If this is empty or all whitespace, an error will be thrown saying that you did not set the "comment" parameter.
Max length is 65,535 characters.
Synonym for "comment"
Read and Write.
Max value is 99999.99
id (int) The globally unique ID for the comment.
Read only.
attachment_id (int) If the comment was made on an attachment, this will be the ID of that attachment. Otherwise it will be null.
Added to the return value in Bugzilla 3.6
count (int) - The number of the comment local to the bug. The Description is 0, comments start with 1.
Added to the return value in Bugzilla 4.4.
creator (string) - The login name of the comment's author.
Also returned as "author", for backwards-compatibility with older Bugzillas. (However, this backwards-compatibility will go away in Bugzilla 5.0)
In bugzilla 4.0, the "author" return value was renamed to "creator".
See creator
time (DateTime) - The time (in Bugzilla's timezone) that the comment was added.
creation_time (DateTime) - This is exactly same as the "time" key. Use this field instead of "time" for consistency with other methods including "get" and "attachments". For compatibility, /time is still usable. However, please note that /time may be deprecated and removed in a future release of Bugzilla.
Added in Bugzilla 4.4.
BZ::Client, BZ::Client::API, Bugzilla API
Dean Hamstead <dean@bytefoundry.com.au>
Jochen Wiedmann <jochen.wiedmann@gmail.com>
This software is copyright (c) 2021 by Dean Hamstad.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install BZ::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm BZ::Client
CPAN shell
perl -MCPAN -e shell install BZ::Client
For more information on module installation, please visit the detailed CPAN module installation guide.