blib/lib/BZ/Client/Bug.pm untested

filter: Statementstmt 0.0% 0 / 101 Branchbran 0.0% 0 / 34 Conditioncond 0.0% 0 / 12 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 28 Podpod 0.0% 0 / 25 totaltotal 0.0% 0 / 200 CC 18 SCAR 28.6
CC
18
Cov
0%
alias
56.0
get
42.0
update_see_also
12.0
CRAP 17.4
1 #!/bin/false
2 # PODNAME: BZ::Client::Bug
3 # ABSTRACT: Client side representation of a bug in Bugzilla
4  
5 use strict;
6 use warnings 'all';
7  
8 package BZ::Client::Bug;
9 $BZ::Client::Bug::VERSION = '4.9';
10  
11 use parent qw( BZ::Client::API );
12  
13 # See https://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
14 # These are in order as per the above
15  
16 ## functions
17  
18 sub fields {
19 my($class, $client, $params) = @_;
20 return $class->_returns_array($client, 'Bug.fields', $params, 'fields');
21 }
22  
23 sub legal_values {
24 my($class, $client, $field) = @_;
25 my $params = { 'field' => $field };
26 return $class->_returns_array($client, 'Bug.legal_values', $params, 'values');
27 }
28  
29 sub get {
30 my($class, $client, $params) = @_;
31 unless (ref $params) {
32 $params = [ $params ]
33 }
34 if (ref $params eq 'ARRAY') {
35 $params = { ids => $params }
36 }
37 elsif (ref $params eq 'HASH') {
38 $params->{'permissive'} = BZ::Client::XMLRPC::boolean::TRUE()
39 if $params->{'permissive'};
40 }
41 my $bugs = $class->_returns_array($client, 'Bug.get', $params, 'bugs');
42 my @result;
43 for my $bug (@$bugs) {
44 push(@result, $class->new(%{$bug}));
45 }
46 $client->log('debug', $class . '::get: Got ' . scalar(@result));
47 return wantarray ? @result : \@result
48 }
49  
50 sub history {
51 my($class, $client, $params) = @_;
52 return $class->_returns_array($client, 'Bug.history', $params, 'bugs');
53 }
54  
55 sub possible_duplicates {
56 my($class, $client, $params) = @_;
57 my $bugs = $class->_returns_array($client, 'Bug.possible_duplicates', $params, 'bugs');
58 my @result;
59 for my $bug (@$bugs) {
60 push(@result, $class->new(%{$bug}));
61 }
62 $client->log('debug', $class . '::possible_duplicates: Got ' . scalar(@result));
63 return wantarray ? @result : \@result
64 }
65  
66 sub search {
67 my($class, $client, $params) = @_;
68 my $bugs = $class->_returns_array($client, 'Bug.search', $params, 'bugs');
69 my @result;
70 for my $bug (@$bugs) {
71 push(@result, $class->new(%{$bug}));
72 }
73 $client->log('debug', $class . '::search: Found ' . join(',', map { $_->id // '?' } @result));
74 return wantarray ? @result : \@result
75 }
76  
77 sub create {
78 my($class, $client, $params) = @_;
79 return $class->_create($client, 'Bug.create', $params);
80 }
81  
82 sub update {
83 my($class, $client, $params) = @_;
84 return $class->_returns_array($client, 'Bug.update', $params, 'bugs');
85  
86 }
87  
88 sub update_see_also {
89 my($class, $client, $params) = @_;
90 $client->log('debug', $class . '::update_see_also: Updating See-Also');
91 my $result = $class->api_call($client, 'Bug.update_see_also', $params);
92 my $changes = $result->{'changes'};
93 if (!$changes || 'HASH' ne ref($changes)) {
94 $class->error($client, 'Invalid reply by server, expected hash of changed bug details.');
95 }
96 $client->log('debug', $class . '::update_see_also: Updated stuff');
97 return wantarray ? %{$changes} : $changes
98 }
99  
100 sub update_tags {
101 my($class, $client, $params) = @_;
102 $client->log('debug', $class . '::update_tags: Updating Tags');
103 my $result = $class->api_call($client, 'Bug.update_tags', $params);
104 my $changes = $result->{'changes'};
105 if (!$changes || 'HASH' ne ref($changes)) {
106 $class->error($client, 'Invalid reply by server, expected hash of changed bug details.');
107 }
108 $client->log('debug', $class . '::update_tags: Updated stuff');
109 return wantarray ? %{$changes} : $changes
110 }
111  
112 ## methods
113  
114 sub id { shift->_accessor('id', @_) }
115  
116 sub alias {
117 my $self = shift;
118 if (@_) {
119 my $alias = shift;
120 if (ref $alias eq 'ARRAY' && @{$alias}) {
121 $self->{'alias'} = $alias->[0];
122 }
123 if (not ref $alias) {
124 $self->{'alias'} = $alias;
125 }
126 # silently ignore anything else
127 }
128 else {
129  
130 return '' unless defined $self->{'alias'};
131  
132 # long form so its clear what is going on.
133 if (ref $self->{'alias'}) {
134 if (ref $self->{'alias'} eq 'ARRAY'
135 and @{$self->{'alias'}}) {
136 return $self->{'alias'}->[0];
137 }
138 return ''
139 }
140  
141 # fall back
142 return $self->{'alias'}
143 }
144 }
145  
146 sub assigned_to { shift->_accessor('assigned_to', @_) }
147  
148 sub component { shift->_accessor('component', @_) }
149  
150 sub creation_time { shift->_accessor('creation_time', @_) }
151  
152 sub dupe_of { shift->_accessor('dupe_of', @_) }
153  
154 sub internals { shift->_accessor('internals', @_) }
155  
156 sub is_open { shift->_accessor('is_open', @_) }
157  
158 sub last_change_time { shift->_accessor('last_change_time', @_) }
159  
160 sub priority { shift->_accessor('priority', @_) }
161  
162 sub product { shift->_accessor('product', @_) }
163  
164 sub resolution { shift->_accessor('resolution', @_) }
165  
166 sub severity { shift->_accessor('severity', @_) }
167  
168 sub status { shift->_accessor('status', @_) }
169  
170 sub summary { shift->_accessor('summary', @_) }
171  
172 1;
173  
174 __END__
175  
176 =pod
177  
178 =encoding UTF-8
179  
180 =head1 NAME
181  
182 BZ::Client::Bug - Client side representation of a bug in Bugzilla
183  
184 =head1 VERSION
185  
186 version 4.9
187  
188 =head1 SYNOPSIS
189  
190 This class provides methods for accessing and managing bugs in Bugzilla.
191  
192 my $client = BZ::Client->new( url => $url,
193 user => $user,
194 password => $password );
195  
196 my $bugs = BZ::Client::Bug->get( $client, \%params );
197  
198 =head1 COMMON PARAMETERS
199  
200 Many Bugzilla Webservice methods take similar arguments. Instead of re-writing the documentation for each method, we document the parameters here, once, and then refer back to this documentation from the individual methods where these parameters are used.
201  
202 =head2 Limiting What Fields Are Returned
203  
204 Many methods return an array of structs with various fields in the structs.
205 (For example, L</get> in L<BZ::Client::Bug> returns a list of bugs that have fields like
206 L</id>, L</summary>, L</creation_time>, etc.)
207  
208 These parameters allow you to limit what fields are present in the structs, to possibly improve performance or save some bandwidth.
209  
210 Fields follow:
211  
212 =head3 include_fields
213  
214 I<include_fields> (array) - An array of strings, representing the (case-sensitive) names of fields in the return value. Only the fields specified in this hash will be returned, the rest will not be included.
215  
216 If you specify an empty array, then this function will return empty hashes.
217  
218 Invalid field names are ignored.
219  
220 Example:
221  
222 BZ::Client::Bug->get( $client,
223 { ids => [1], include_fields => ['id', 'name'] })
224  
225 would return something like:
226  
227 [{ id => 1, name => 'user@domain.com' }]
228  
229 =head3 exclude_fields
230  
231 I<exclude_fields> (array) - An array of strings, representing the (case-sensitive) names of fields in the return value. The fields specified will not be included in the returned hashes.
232  
233 If you specify all the fields, then this function will return empty hashes.
234  
235 Some RPC calls support specifying sub fields. If an RPC call states that it support sub field restrictions, you can restrict what information is returned within the first field. For example, if you call Product.get with an include_fields of components.name, then only the component name would be returned (and nothing else). You can include the main field, and exclude a sub field.
236  
237 Invalid field names are ignored.
238  
239 Specifying fields here overrides L</include_fields>, so if you specify a field in both, it will be excluded, not included.
240  
241 Example:
242  
243 BZ::Client::Bug->get( $client,
244 { ids => [1], exclude_fields => ['name'] })
245  
246 would return something like:
247  
248 [{ id => 1, real_name => 'John Smith' }]
249  
250 =head3 shortcuts
251  
252 There are several shortcut identifiers to ask for only certain groups of fields to be returned or excluded.
253  
254 =over 4
255  
256 =item _all
257  
258 All possible fields are returned if C<_all> is specified in L</include_fields>.
259  
260 =item _default
261  
262 These fields are returned if L</include_fields> is empty or C<_default> is specified. All fields described in the documentation are returned by default unless specified otherwise.
263  
264 =item _extra
265  
266 These fields are not returned by default and need to be manually specified in L</include_fields> either by field name, or using C<_extra>.
267  
268 =item _custom
269  
270 Only custom fields are returned if C<_custom> is specified in L</include_fields>. This is normally specific to bug objects and not relevant for other returned objects.
271  
272 =back
273  
274 Example:
275  
276 BZ::Client::Bug->get( $client,
277 { ids => [1], include_fields => ['_all'] })
278  
279 =head1 EXCEPTION HANDLING
280  
281 See L<BZ::Client::Exception>
282  
283 =head1 UTILITY FUNCTIONS
284  
285 This section lists the utility functions provided by this module.
286  
287 These deal with bug-related information, but not bugs directly.
288  
289 =head2 fields
290  
291 $fields = BZ::Client::Bug->fields( $client, $params )
292 @fields = BZ::Client::Bug->fields( $client, $params )
293  
294 Get information about valid bug fields, including the lists of legal values for each field.
295  
296 =head3 History
297  
298 Added in Bugzilla 3.6
299  
300 =head3 Parameters
301  
302 You can pass either field ids or field names.
303  
304 Note: If neither ids nor names is specified, then all non-obsolete fields will be returned.
305  
306 =over 4
307  
308 =item ids
309  
310 I<ids> (array) - An array of integer field ids
311  
312 =item names
313  
314 I<names> (array) - An array of strings representing field names.
315  
316 =back
317  
318 In addition to the parameters above, this method also accepts the standard L</include_fields> and L</exclude_fields> arguments.
319  
320 =head3 Returns
321  
322 Returns an array or an arrayref of hashes, containing the following keys:
323  
324 =over 4
325  
326 =item id
327  
328 I<id> (int) - An integer id uniquely identifying this field in this installation only.
329  
330 =item type
331  
332 I<type> (int) The number of the fieldtype. The following values are defined:
333  
334 =over 4
335  
336 =item 0 Unknown
337  
338 =item 1 Free Text
339  
340 =item 2 Drop Down
341  
342 =item 3 Multiple-Selection Box
343  
344 =item 4 Large Text Box
345  
346 =item 5 Date/Time
347  
348 =item 6 Bug ID
349  
350 =item 7 Bug URLs ("See Also")
351  
352 =back
353  
354 =item is_custom
355  
356 I<is_custom> (boolean) True when this is a custom field, false otherwise.
357  
358 =item name
359  
360 I<name> (string) The internal name of this field. This is a unique identifier for this field. If this is not a custom field, then this name will be the same across all Bugzilla installations.
361  
362 =item display_name
363  
364 I<display_name> (string) The name of the field, as it is shown in the user interface.
365  
366 =item is_mandatory
367  
368 I<is_mandatory> (boolean) True if the field must have a value when filing new bugs. Also, mandatory fields cannot have their value cleared when updating bugs.
369  
370 This return value was added in Bugzilla 4.0.
371  
372 =item is_on_bug_entry
373  
374 I<is_on_bug_entry> (boolean) For custom fields, this is true if the field is shown when you enter a new bug. For standard fields, this is currently always false, even if the field shows up when entering a bug. (To know whether or not a standard field is valid on bug entry, see L</create>.)
375  
376 =item visibility_field
377  
378 I<visibility_field> (string) The name of a field that controls the visibility of this field in the user interface. This field only appears in the user interface when the named field is equal to one of the values in L</visibility_values>. Can be null.
379  
380 =item visibility_values
381  
382 I<visibility_values> (array) of strings This field is only shown when visibility_field matches one of these values. When visibility_field is null, then this is an empty array.
383  
384 =item value_field
385  
386 I<value_field> (string) The name of the field that controls whether or not particular values of the field are shown in the user interface. Can be null.
387  
388 =item values
389  
390 This is an array of hashes, representing the legal values for select-type (drop-down and multiple-selection) fields. This is also populated for the L</component>, L</version>, L</target_milestone>, and L</keywords> fields, but not for the C<product> field (you must use L<BZ::Client::Product/get_accessible_products> for that).
391  
392 For fields that aren't select-type fields, this will simply be an empty array.
393  
394 Each hash has the following keys:
395  
396 =over 4
397  
398 =item name
399  
400 I<name> (string) The actual value--this is what you would specify for this field in L</create>, etc.
401  
402 =item sort_key
403  
404 I<sort_key> (int) Values, when displayed in a list, are sorted first by this integer and then secondly by their name.
405  
406 =item sortkey
407  
408 B<DEPRECATED> - Use L</sort_key> instead.
409  
410 Renamed to C<sort_key> in Bugzilla 4.2.
411  
412 =item visibility_values
413  
414 If L</value_field> is defined for this field, then this value is only shown if the L</value_field> is set to one of the values listed in this array.
415  
416 Note that for per-product fields, L</value_field> is set to C<product> and L</visibility_values> will reflect which product(s) this value appears in.
417  
418 =item is_active
419  
420 I<is_active> (boolean) This value is defined only for certain product specific fields such as L</version>, L</target_milestone> or L</component>.
421  
422 When true, the value is active, otherwise the value is not active.
423  
424 Added in Bugzilla 4.4.
425  
426 =item description
427  
428 I<description> (string) The description of the value. This item is only included for the L</keywords> field.
429  
430 =item is_open
431  
432 I<is_open> (boolean) For L</bug_status> values, determines whether this status specifies that the bug is "open" (true) or "closed" (false). This item is only included for the L</bug_status> field.
433  
434 =item can_change_to
435  
436 For L</bug_status> values, this is an array of hashes that determines which statuses you can transition to from this status. (This item is only included for the L</bug_status> field.)
437  
438 Each hash contains the following items:
439  
440 =over 4
441  
442 =item name
443  
444 The name of the new status
445  
446 =item comment_required
447  
448 I<comment_required> (boolean) True if a comment is required when you change a bug into this status using this transition.
449  
450 =back
451  
452 =back
453  
454 =back
455  
456 Errors:
457  
458 =over 4
459  
460 =item 51 - Invalid Field Name or ID
461  
462 You specified an invalid field name or id.
463  
464 =back
465  
466 =head2 legal_values
467  
468 $values = BZ::Client::Bug->legal_values( $client, $field )
469 @values = BZ::Client::Bug->legal_values( $client, $field )
470  
471 Tells you what values are allowed for a particular field.
472  
473 Note: This is deprecated in Bugzilla, use L</fields> instead.
474  
475 =head3 Parameters
476  
477 =over 4
478  
479 =item field
480  
481 The name of the field you want information about. This should be the same as the name you would use in L</create>, below.
482  
483 =item product_id
484  
485 If you're picking a product-specific field, you have to specify the id of the product you want the values for.
486  
487 =back
488  
489 =head3 Returns
490  
491 =over 4
492  
493 =item values
494  
495 An array or arrayref of strings: the legal values for this field. The values will be sorted as they normally would be in Bugzilla.
496  
497 =back
498  
499 =head3 Errors
500  
501 =over 4
502  
503 =item 106 - Invalid Product
504  
505 You were required to specify a product, and either you didn't, or you specified an invalid product (or a product that you can't access).
506  
507 =item 108 - Invalid Field Name
508  
509 You specified a field that doesn't exist or isn't a drop-down field.
510  
511 =back
512  
513 =head1 FUNCTIONS FOR FINDING AND RETRIEVING BUGS
514  
515 This section lists the class methods pertaining to finding and retrieving bugs from your server.
516  
517 Listed here in order of what you most likely want to do... maybe?
518  
519 =head2 get
520  
521 @bugs = BZ::Client::Bug->get( $client, $id );
522 $bugs = BZ::Client::Bug->get( $client, $id );
523 @bugs = BZ::Client::Bug->get( $client, \@ids );
524 $bugs = BZ::Client::Bug->get( $client, \@ids );
525 @bugs = BZ::Client::Bug->get( $client, \%params );
526 $bugs = BZ::Client::Bug->get( $client, \%params );
527  
528 Gets information about particular bugs in the database.
529  
530 =head3 Parameters
531  
532 A single I<$id> or array ref of I<@ids> may be provided, otherwise a hash ref with the following:
533  
534 =over 4
535  
536 =item ids
537  
538 An array of numbers and strings.
539  
540 If an element in the array is entirely numeric, it represents a C<bug_id> from the Bugzilla database to fetch. If it contains any non-numeric characters, it is considered to be a bug alias instead, and the bug with that alias will be loaded.
541  
542 =item permissive
543  
544 I<permissive> (boolean) Normally, if you request any inaccessible or invalid bug ids, will throw an error.
545  
546 If this parameter is True, instead of throwing an error we return an array of hashes with a C<id>, C<faultString> and C<faultCode> for each bug that fails, and return normal information for the other bugs that were accessible.
547  
548 Note: marked as B<EXPERIMENTAL> in Bugzilla 4.4
549  
550 Added in Bugzilla 3.4.
551  
552 =back
553  
554 =head3 Returns
555  
556 An array or arrayref of bug instance objects with the given ID's.
557  
558 See L</INSTANCE METHODS> for how to use them.
559  
560 FIXME missing the I<faults> return values (added in 3.4)
561  
562 =head3 Errors
563  
564 =over 4
565  
566 =item 100 - Invalid Bug Alias
567  
568 If you specified an alias and there is no bug with that alias.
569  
570 =item 101 - Invalid Bug ID
571  
572 The bug_id you specified doesn't exist in the database.
573  
574 =item 102 - Access Denied
575  
576 You do not have access to the bug_id you specified.
577  
578 =back
579  
580 =head2 search
581  
582 FIXME Documentation not fully fleshed out
583  
584 @bugs = BZ::Client::Bug->search( $client, \%params );
585 $bugs = BZ::Client::Bug->search( $client, \%params );
586  
587 Searches for bugs matching the given parameters.
588  
589 =head3 Parameters
590  
591 This is just a quick example, there are lot's of fields
592  
593 %params = (
594  
595 'alias' => 'ACONVENIENTALIAS',
596  
597 'assigned_to' => 'hopefullynotme@domain.local',
598  
599 'creator' => 'littlejohnnytables@school.local',
600  
601 'severity' => 'major',
602  
603 'status' => 'OPEN',
604  
605 );
606  
607 Criteria are joined in a logical AND. That is, you will be returned bugs that match all of the criteria, not bugs that match any of the criteria.
608  
609 See also L<https://bugzilla.readthedocs.io/en/5.0/api/core/v1/bug.html#search-bugs>
610  
611 =head3 Returns
612  
613 Returns an array or arrayref of bug instance objects with the given ID's.
614  
615 See L<INSTANCE METHODS> for how to use them.
616  
617 =head2 history
618  
619 @history = BZ::Client::Bug->history( $client, \%params );
620 $history = BZ::Client::Bug->history( $client, \%params );
621  
622 Gets the history of changes for particular bugs in the database.
623  
624 Added in Bugzilla 3.4.
625  
626 =head3 Parameters
627  
628 =over 4
629  
630 =item ids
631  
632 An array of numbers and strings.
633  
634 If an element in the array is entirely numeric, it represents a C<bug_id> from the Bugzilla database to fetch. If it contains any non-numeric characters, it is considered to be a bug alias instead, and the data bug with that alias will be loaded.
635  
636 =back
637  
638 =head3 Returns
639  
640 An array or arrayref of hashes, containing the following keys:
641  
642 =over 4
643  
644 =item id
645  
646 I<id> (int) The numeric id of the bug
647  
648 =item alias
649  
650 I<alias> (array) The alias of this bug. If there is no alias, this will be undef.
651  
652 =item history
653  
654 I<history> (An array of hashes) - Each hash having the following keys:
655  
656 =over 4
657  
658 =item when
659  
660 I<when> (L<DateTime>) The date the bug activity/change happened.
661  
662 =item who
663  
664 I<who> (string) The login name of the user who performed the bug change.
665  
666 =item changes
667  
668 An array of hashes which contain all the changes that happened to the bug at this time (as specified by when). Each hash contains the following items:
669  
670 =over 4
671  
672 =item field_name
673  
674 I<field_name> (string) The name of the bug field that has changed.
675  
676 =item removed
677  
678 I<removed> (string) The previous value of the bug field which has been deleted by the change.
679  
680 =item added
681  
682 I<added> (string) The new value of the bug field which has been added by the change.
683  
684 =item attachment_id
685  
686 I<attachment_id> (int) The id of the attachment that was changed. This only appears if the change was to an attachment, otherwise L</attachment_id> will not be present in this hash.
687  
688 =back
689  
690 =back
691  
692 =back
693  
694 =head3 Errors
695  
696 =over 4
697  
698 =item 100 - Invalid Bug Alias
699  
700 If you specified an alias and there is no bug with that alias.
701  
702 =item 101 - Invalid Bug ID
703  
704 The bug_id you specified doesn't exist in the database.
705  
706 =item 102 - Access Denied
707  
708 You do not have access to the bug_id you specified.
709  
710 =back
711  
712 =head2 possible_duplicates
713  
714 @bugs = BZ::Client::Bug->possible_duplicates( $client, \%params );
715 $bugs = BZ::Client::Bug->possible_duplicates( $client, \%params );
716  
717 Allows a user to find possible duplicate bugs based on a set of keywords such as a user may use as a bug summary. Optionally the search can be narrowed down to specific products.
718  
719 =head3 History
720  
721 Added in Bugzilla 4.0.
722  
723 =head3 Parameters
724  
725 =over 4
726  
727 =item summary
728  
729 I<summary> (string) A string of keywords defining the type of bug you are trying to report. B<Required>.
730  
731 =item product
732  
733 I<product> (array) One or more product names to narrow the duplicate search to. If omitted, all bugs are searched.
734  
735 =back
736  
737 =head3 Returns
738  
739 The same as L</get>.
740  
741 Note that you will only be returned information about bugs that you can see. Bugs that you can't see will be entirely excluded from the results. So, if you want to see private bugs, you will have to first log in and then call this method.
742  
743 =head3 Errors
744  
745 =over 4
746  
747 =item 50 - Param Required
748  
749 You must specify a value for L</summary> containing a string of keywords to search for duplicates.
750  
751 =back
752  
753 =head1 FUNCTIONS FOR CREATING AND MODIFYING BUGS
754  
755 This section lists the class methods pertaining to the creation and modification of bugs.
756  
757 Listed here in order of what you most likely want to do... maybe?
758  
759 =head2 create
760  
761 my $id = BZ::Client::Bug->create( $client, \%params );
762  
763 This allows you to create a new bug in Bugzilla. If you specify any invalid fields, an error will be thrown stating which field is invalid. If you specify any fields you are not allowed to set, they will just be set to their defaults or ignored.
764  
765 You cannot currently set all the items here that you can set on enter_bug.cgi (i.e. the web page to enter bugs).
766  
767 The Bugzilla WebService API itself may allow you to set things other than those listed here, but realize that anything undocumented is B<UNSTABLE> and will very likely change in the future.
768  
769 =head3 History
770  
771 Before Bugzilla 3.0.4, parameters marked as B<Defaulted> were actually B<Required>, due to a bug in Bugzilla itself.
772  
773 The groups argument was added in Bugzilla B<4.0>. Before Bugzilla 4.0, bugs were only added into Mandatory groups by this method. Since Bugzilla B<4.0.2>, passing an illegal group name will throw an error. In Bugzilla 4.0 and 4.0.1, illegal group names were silently ignored.
774  
775 The C<comment_is_private> argument was added in Bugzilla B<4.0>. Before Bugzilla 4.0, you had to use the undocumented C<commentprivacy> argument.
776  
777 Error C<116> was added in Bugzilla B<4.0>. Before that, dependency loop errors had a generic code of C<32000>.
778  
779 The ability to file new bugs with a C<resolution> was added in Bugzilla B<4.4>.
780  
781 =head3 Parameters
782  
783 Some params must be set, or an error will be thrown. These params are marked B<Required>.
784  
785 Some parameters can have defaults set in Bugzilla, by the administrator. If these parameters have defaults set, you can omit them. These parameters are marked B<Defaulted>.
786  
787 Clients that want to be able to interact uniformly with multiple Bugzillas should always set both the params marked B<Required> and those marked B<Defaulted>, because some Bugzillas may not have defaults set for B<Defaulted> parameters, and then this method will throw an error if you don't specify them.
788  
789 The descriptions of the parameters below are what they mean when Bugzilla is being used to track software bugs. They may have other meanings in some installations.
790  
791 =over 4
792  
793 =item product (string) B<Required> - The name of the product the bug is being filed against.
794  
795 I<product> (string) B<Required> - The name of the product the bug is being filed against.
796  
797 =item component
798  
799 I<component> (string) B<Required> - The name of a component in the product above.
800  
801 =item summary
802  
803 I<summary> (string) B<Required> - A brief description of the bug being filed.
804  
805 =item version
806  
807 I<version> (string) B<Required> - A version of the product above; the version the bug was found in.
808  
809 =item description
810  
811 I<description> (string) B<Defaulted> - The initial description for this bug. Some Bugzilla installations require this to not be blank.
812  
813 =item op_sys
814  
815 I<op_sys> (string) B<Defaulted> - The operating system the bug was discovered on.
816  
817 =item platform
818  
819 I<platform> (string) B<Defaulted> - What type of hardware the bug was experienced on.
820  
821 =item priority
822  
823 I<priority> (string) B<Defaulted> - What order the bug will be fixed in by the developer, compared to the developer's other bugs.
824  
825 =item severity
826  
827 I<severity> (string) B<Defaulted> - How severe the bug is.
828  
829 =item alias
830  
831 I<alias> (string) - A brief alias for the bug that can be used instead of a bug number when accessing this bug. Must be unique in all of this Bugzilla.
832  
833 =item assigned_to
834  
835 I<assigned_to> (username) - A user to assign this bug to, if you don't want it to be assigned to the component owner.
836  
837 =item cc
838  
839 I<cc> (array) - An array of usernames to CC on this bug.
840  
841 =item comment_is_private
842  
843 I<comment_is_private> (boolean) - If set to true, the description is private, otherwise it is assumed to be public.
844  
845 =item groups
846  
847 I<groups> (array) - An array (ref) of group names to put this bug into. You can see valid group names on the I<Permissions tab> of the I<Preferences screen>, or, if you are an administrator, in the I<Groups control panel>. If you don't specify this argument, then the bug will be added into all the groups that are set as being "Default" for this product. (If you want to avoid that, you should specify C<groups> as an empty array.)
848  
849 =item qa_contact
850  
851 I<qa_contact> (username) - If this installation has QA Contacts enabled, you can set the QA Contact here if you don't want to use the component's default QA Contact.
852  
853 =item status
854  
855 I<status> (string) - The status that this bug should start out as. Note that only certain statuses can be set on bug creation.
856  
857 =item resolution
858  
859 I<resolution> (string) - If you are filing a closed bug, then you will have to specify a resolution. You cannot currently specify a resolution of C<DUPLICATE> for new bugs, though. That must be done with L</update>.
860  
861 =item target_milestone
862  
863 I<target_milestone> (string) - A valid target milestone for this product.
864  
865 =item depends_on
866  
867 I<depends_on> (array) - An array of bug id's that this new bug should depend upon.
868  
869 As of Bugzilla 5.0 this option isn't included in the WebService API docks for =create()=, although it is mentioned in it's error codes.
870  
871 =item blocks
872  
873 I<blocks> (array) - An array of bug id's that this new bug should block.
874  
875 As of Bugzilla 5.0 this option isn't included in the WebService API docks for =create()=, although it is mentioned in it's error codes.
876  
877 =back
878  
879 B<Note:> In addition to the above parameters, if your installation has any custom fields, you can set them just by passing in the name of the field and its value as a string.
880  
881 =head3 Returns
882  
883 A hash with one element, C<id>. This is the id of the newly-filed bug.
884  
885 =head3 Errors
886  
887 =over 4
888  
889 =item 51 - Invalid Object
890  
891 You specified a field value that is invalid. The error message will have more details.
892  
893 =item 103 - Invalid Alias
894  
895 The alias you specified is invalid for some reason. See the error message for more details.
896  
897 =item 104 - Invalid Field
898  
899 One of the drop-down fields has an invalid value, or a value entered in a text field is too long. The error message will have more detail.
900  
901 =item 105 - Invalid Component
902  
903 You didn't specify a component.
904  
905 =item 106 - Invalid Product
906  
907 Either you didn't specify a product, this product doesn't exist, or you don't have permission to enter bugs in this product.
908  
909 =item 107 - Invalid Summary
910  
911 You didn't specify a summary for the bug.
912  
913 =item 116 - Dependency Loop
914  
915 You specified values in the blocks or depends_on fields that would cause a circular dependency between bugs.
916  
917 =item 120 - Group Restriction Denied
918  
919 You tried to restrict the bug to a group which does not exist, or which you cannot use with this product.
920  
921 =item 504 - Invalid User
922  
923 Either the QA Contact, Assignee, or CC lists have some invalid user in them. The error message will have more details.
924  
925 =back
926  
927 =head2 update
928  
929 my $id = BZ::Client::Bug->update( $client, \%params );
930  
931 Allows you to update the fields of a bug.
932  
933 (Your Bugzilla server may automatically sends emails out about the changes)
934  
935 =head3 History
936  
937 Added in Bugzilla B<4.0>.
938  
939 =head3 Parameters
940  
941 =over 4
942  
943 =item ids
944  
945 I<ids> (Array of C<int>s or C<string>s) - The ids or aliases of the bugs that you want to modify.
946  
947 B<Note:> All following fields specify the values you want to set on the bugs you are updating.
948  
949 =item alias
950  
951 I<alias> (string) - The alias of the bug. You can only set this if you are modifying a single bug. If there is more than one bug specified in C<ids>, passing in a value for C<alias> will cause an error to be thrown.
952  
953 =item assigned_to
954  
955 I<assigned_to> (string) - The full login name of the user this bug is assigned to.
956  
957 =item blocks
958  
959 I<blocks> (hash) - These specify the bugs that this bug blocks. To set these, you should pass a hash as the value. The hash may contain the following fields:
960  
961 =over 4
962  
963 =item add
964  
965 I<add> (Array of C<int>s) - Bug ids to add to this field.
966  
967 =item remove
968  
969 I<remove> (Array of C<int>s) - Bug ids to remove from this field. If the bug ids are not already in the field, they will be ignored.
970  
971 =item set
972  
973 I<set> (Array of C<int>s) - An exact set of bug ids to set this field to, overriding the current value. If you specify C<set>, then C<add> and C<remove> will be ignored.
974  
975 =back
976  
977 =item depends_on
978  
979 I<depends_on> (hash) - These specify the bugs that this depends on. To set these, you should pass a hash as the value. The hash may contain the following fields:
980  
981 =over 4
982  
983 =item add
984  
985 I<add> (Array of C<int>s) - Bug ids to add to this field.
986  
987 =item remove
988  
989 I<remove> (Array of C<int>s) - Bug ids to remove from this field. If the bug ids are not already in the field, they will be ignored.
990  
991 =item set
992  
993 I<set> (Array of C<int>s) - An exact set of bug ids to set this field to, overriding the current value. If you specify C<set>, then C<add> and C<remove> will be ignored.
994  
995 =back
996  
997 =item cc
998  
999 I<cc> (hash) - The users on the cc list. To modify this field, pass a hash, which may have the following fields:
1000  
1001 =over 4
1002  
1003 =item add
1004  
1005 I<add> (Array of C<string>s) - User names to add to the CC list. They must be full user names, and an error will be thrown if you pass in an invalid user name.
1006  
1007 =item remove
1008  
1009 I<remove> (Array of C<string>s) - User names to remove from the CC list. They must be full user names, and an error will be thrown if you pass in an invalid user name.
1010  
1011 =back
1012  
1013 =item is_cc_accessible
1014  
1015 I<is_cc_accessible> (boolean) - Whether or not users in the CC list are allowed to access the bug, even if they aren't in a group that can normally access the bug.
1016  
1017 =item comment
1018  
1019 I<comment> (hash) - A comment on the change. The hash may contain the following fields:
1020  
1021 =over 4
1022  
1023 =item body
1024  
1025 I<body> (string) - The actual text of the comment. B<Note:> For compatibility with the parameters to L</add_comment>, you can also call this field C<comment>, if you wish.
1026  
1027 =item is_private
1028  
1029 I<is_private> (boolean) - Whether the comment is private or not. If you try to make a comment private and you don't have the permission to, an error will be thrown.
1030  
1031 =back
1032  
1033 =item comment_is_private
1034  
1035 I<comment_is_private> (hash) - This is how you update the privacy of comments that are already on a bug. This is a hash, where the keys are the C<int> id of comments (not their count on a bug, like #1, #2, #3, but their globally-unique id, as returned by L</comments>) and the value is a C<boolean> which specifies whether that comment should become private (C<true>) or public (C<false>).
1036  
1037 The comment ids must be valid for the bug being updated. Thus, it is not practical to use this while updating multiple bugs at once, as a single comment id will never be valid on multiple bugs.
1038  
1039 =item component
1040 I<component> (string) - The Component the bug is in.
1041  
1042 =item deadline
1043  
1044 I<deadline> (string) - The Deadline field--a date specifying when the bug must be completed by, in the format C<YYYY-MM-DD>.
1045  
1046 =item dupe_of
1047  
1048 I<dupe_of> (int) - The bug that this bug is a duplicate of. If you want to mark a bug as a duplicate, the safest thing to do is to set this value and not set the C<status> or C<resolution> fields. They will automatically be set by Bugzilla to the appropriate values for duplicate bugs.
1049  
1050 =item estimated_time
1051  
1052 I<estimated_time> (double) - The total estimate of time required to fix the bug, in hours. This is the I<total> estimate, not the amount of time remaining to fix it.
1053  
1054 =item groups
1055  
1056 I<groups> (hash) - The groups a bug is in. To modify this field, pass a hash, which may have the following fields:
1057  
1058 =over 4
1059  
1060 =item add
1061  
1062 I<add> (Array of C<string>s) - The names of groups to add. Passing in an invalid group name or a group that you cannot add to this bug will cause an error to be thrown.
1063  
1064 =item remove
1065  
1066 I<remove> (Array of C<string>s) - The names of groups to remove. Passing in an invalid group name or a group that you cannot remove from this bug will cause an error to be thrown.
1067  
1068 =back
1069  
1070 =item keywords
1071  
1072 I<keywords> (hash) - Keywords on the bug. To modify this field, pass a hash, which may have the following fields:
1073  
1074 =over 4
1075  
1076 =item add
1077  
1078 I<add> (An array of C<string>s) - The names of keywords to add to the field on the bug. Passing something that isn't a valid keyword name will cause an error to be thrown.
1079  
1080 =item remove
1081  
1082 I<remove> (An array of C<string>s) - The names of keywords to remove from the field on the bug. Passing something that isn't a valid keyword name will cause an error to be thrown.
1083  
1084 =item set
1085  
1086 I<set> (An array of C<string>s) - An exact set of keywords to set the field to, on the bug. Passing something that isn't a valid keyword name will cause an error to be thrown. Specifying C<set> overrides C<add> and C<remove>.
1087  
1088 =back
1089  
1090 =item op_sys
1091  
1092 I<op_sys> (string) - The Operating System ("OS") field on the bug.
1093  
1094 =item platform
1095  
1096 I<platform> (string) - The Platform or "Hardware" field on the bug.
1097  
1098 =item priority
1099  
1100 I<priority> (string) - The Priority field on the bug.
1101  
1102 =item product
1103  
1104 I<product> (string) - The name of the product that the bug is in. If you change this, you will probably also want to change C<target_milestone>, C<version>, and C<component>, since those have different legal values in every product.
1105  
1106 If you cannot change the C<target_milestone> field, it will be reset to the default for the product, when you move a bug to a new product.
1107  
1108 You may also wish to add or remove groups, as which groups are valid on a bug depends on the product. Groups that are not valid in the new product will be automatically removed, and groups which are mandatory in the new product will be automaticaly added, but no other automatic group changes will be done.
1109  
1110 B<Note:> that users can only move a bug into a product if they would normally have permission to file new bugs in that product.
1111  
1112 =item qa_contact
1113  
1114 I<qa_contact> (string) - The full login name of the bug's QA Contact.
1115  
1116 =item is_creator_accessible
1117  
1118 I<is_creator_accessible> (boolean) - Whether or not the bug's reporter is allowed to access the bug, even if he or she isn't in a group that can normally access the bug.
1119  
1120 =item remaining_time
1121  
1122 I<remaining_time> (double) - How much work time is remaining to fix the bug, in hours. If you set C<work_time> but don't explicitly set C<remaining_time>, then the C<work_time> will be deducted from the bug's C<remaining_time>.
1123  
1124 =item reset_assigned_to
1125  
1126 I<reset_assigned_to> (boolean) - If true, the C<assigned_to> field will be reset to the default for the component that the bug is in. (If you have set the component at the same time as using this, then the component used will be the new component, not the old one.)
1127  
1128 =item reset_qa_contact
1129  
1130 I<reset_qa_contact> (boolean) - If true, the C<qa_contact> field will be reset to the default for the component that the bug is in. (If you have set the component at the same time as using this, then the component used will be the new component, not the old one.)
1131  
1132 =item resolution
1133  
1134 I<resolution> (string) The current resolution. May only be set if you are closing a bug or if you are modifying an already-closed bug. Attempting to set the resolution to I<any> value (even an empty or null string) on an open bug will cause an error to be thrown.
1135  
1136 If you change the C<status> field to an open status, the resolution field will automatically be cleared, so you don't have to clear it manually.
1137  
1138 =item see_also
1139  
1140 I<see_also> (hash) - The See Also field on a bug, specifying URLs to bugs in other bug trackers. To modify this field, pass a hash, which may have the following fields:
1141  
1142 =over 4
1143  
1144 =item add
1145  
1146 I<add> (An array of C<string>s) - URLs to add to the field. Each URL must be a valid URL to a bug-tracker, or an error will be thrown.
1147  
1148 =item remove
1149  
1150 I<remove> (An array of C<string>s) - URLs to remove from the field. Invalid URLs will be ignored.
1151  
1152 =back
1153  
1154 =item severity
1155  
1156 I<severity> (string) - The Severity field of a bug.
1157  
1158 =item status
1159  
1160 I<status> (string) - The status you want to change the bug to. Note that if a bug is changing from open to closed, you should also specify a resolution.
1161  
1162 =item summary
1163  
1164 I<summary> (string) - The Summary field of the bug.
1165  
1166 =item target_milestone
1167  
1168 I<target_milestone> (string) - The bug's Target Milestone.
1169  
1170 =item url
1171  
1172 I<url> (string) - The "URL" field of a bug.
1173  
1174 =item version
1175  
1176 I<version> (string) - The bug's Version field.
1177  
1178 =item whiteboard
1179  
1180 I<whiteboard> (string) - The Status Whiteboard field of a bug.
1181  
1182 =item work_time
1183  
1184 I<work_time> (double) - The number of hours worked on this bug as part of this change. If you set C<work_time> but don't explicitly set C<remaining_time>, then the C<work_time> will be deducted from the bug's remaining_time.
1185  
1186 =back
1187  
1188 B<Note:> You can also set the value of any custom field by passing its name as a parameter, and the value to set the field to. For multiple-selection fields, the value should be an array of strings.
1189  
1190 =head3 Returns
1191  
1192 A C<hash> with a single field, "bugs". This points to an array of hashes with the following fields:
1193  
1194 =over 4
1195  
1196 =item id
1197  
1198 I<id> (int) - The id of the bug that was updated.
1199  
1200 =item alias
1201  
1202 I<alias> (string) - The alias of the bug that was updated, if this bug has an alias.
1203  
1204 =item last_change_time
1205  
1206 I<last_change_time> (L<DateTime>) - The exact time that this update was done at, for this bug. If no update was done (that is, no fields had their values changed and no comment was added) then this will instead be the last time the bug was updated.
1207  
1208 =item changes
1209  
1210 I<changes> (hash) - The changes that were actually done on this bug. The keys are the names of the fields that were changed, and the values are a hash with two keys:
1211  
1212 =over 4
1213  
1214 =item added
1215  
1216 I<added> (string) - The values that were added to this field, possibly a comma-and-space-separated list if multiple values were added.
1217  
1218 =item removed
1219  
1220 I<removed> (string) - The values that were removed from this field, possibly a comma-and-space-separated list if multiple values were removed.
1221  
1222 =back
1223  
1224 =back
1225  
1226 Here's an example of what a return value might look like:
1227  
1228 {
1229 bugs => [
1230 {
1231 id => 123,
1232 alias => 'foo',
1233 last_change_time => '2010-01-01T12:34:56',
1234 changes => {
1235 status => {
1236 removed => 'NEW',
1237 added => 'ASSIGNED'
1238 },
1239 keywords => {
1240 removed => 'bar',
1241 added => 'qux, quo, qui',
1242 },
1243 },
1244 },
1245 ],
1246 }
1247  
1248 B<Note:> Currently, some fields are not tracked in changes: C<comment>, C<comment_is_private>, and C<work_time>. This means that they will not show up in the return value even if they were successfully updated. This may change in a future version of Bugzilla.
1249  
1250 =head3 Errors
1251  
1252 This function can throw all of the errors that L</get>, L</create>, and L</add_comment> can throw, plus:
1253  
1254 =over 4
1255  
1256 =item 50 - Empty Field
1257  
1258 You tried to set some field to be empty, but that field cannot be empty. The error message will have more details.
1259  
1260 =item 52 - Input Not A Number
1261  
1262 You tried to set a numeric field to a value that wasn't numeric.
1263  
1264 =item 54 - Number Too Large
1265  
1266 You tried to set a numeric field to a value larger than that field can accept.
1267  
1268 =item 55 - Number Too Small
1269  
1270 You tried to set a negative value in a numeric field that does not accept negative values.
1271  
1272 =item 56 - Bad Date/Time
1273  
1274 You specified an invalid date or time in a date/time field (such as the deadline field or a custom date/time field).
1275  
1276 =item 112 - See Also Invalid
1277  
1278 You attempted to add an invalid value to the see_also field.
1279  
1280 =item 115 - Permission Denied
1281  
1282 You don't have permission to change a particular field to a particular value. The error message will have more detail.
1283  
1284 =item 116 - Dependency Loop
1285  
1286 You specified a value in the blocks or depends_on fields that causes a dependency loop.
1287  
1288 =item 117 - Invalid Comment ID
1289  
1290 You specified a comment id in comment_is_private that isn't on this bug.
1291  
1292 =item 118 - Duplicate Loop
1293  
1294 You specified a value for dupe_of that causes an infinite loop of duplicates.
1295  
1296 =item 119 - dupe_of Required
1297  
1298 You changed the resolution to DUPLICATE but did not specify a value for the dupe_of field.
1299  
1300 =item 120 - Group Add/Remove Denied
1301  
1302 You tried to add or remove a group that you don't have permission to modify for this bug, or you tried to add a group that isn't valid in this product.
1303  
1304 =item 121 - Resolution Required
1305  
1306 You tried to set the status field to a closed status, but you didn't specify a resolution.
1307  
1308 =item 122 - Resolution On Open Status
1309  
1310 This bug has an open status, but you specified a value for the resolution field.
1311  
1312 =item 123 - Invalid Status Transition
1313  
1314 You tried to change from one status to another, but the status workflow rules don't allow that change.
1315  
1316 =back
1317  
1318 =head2 update_see_also
1319  
1320 @changes = BZ::Client::Bug->update_see_also( $client, \%params );
1321 $changes = BZ::Client::Bug->update_see_also( $client, \%params );
1322  
1323 Adds or removes URLs for the I<See Also> field on bugs. These URLs must point to some valid bug in some Bugzilla installation or in Launchpad.
1324  
1325 =head3 History
1326  
1327 This is marked as B<EXPERIMENTAL> in Bugzilla 4.4
1328  
1329 Added in Bugzilla 3.4.
1330  
1331 =head3 Parameters
1332  
1333 =over 4
1334  
1335 =item ids
1336  
1337 An array of integers or strings. The IDs or aliases of bugs that you want to modify.
1338  
1339 =item add
1340  
1341 Array of strings. URLs to Bugzilla bugs. These URLs will be added to the I<See Also> field.
1342  
1343 If the URLs don't start with C<http://> or C<https://>, it will be assumed that C<http://> should be added to the beginning of the string.
1344  
1345 It is safe to specify URLs that are already in the I<See Also> field on a bug as they will just be silently ignored.
1346  
1347 =item remove
1348  
1349 An array of strings. These URLs will be removed from the I<See Also> field. You must specify the full URL that you want removed. However, matching is done case-insensitively, so you don't have to specify the URL in exact case, if you don't want to.
1350  
1351 If you specify a URL that is not in the I<See Also> field of a particular bug, it will just be silently ignored. Invaild URLs are currently silently ignored, though this may change in some future version of Bugzilla.
1352  
1353 =back
1354  
1355 B<Note:> If you specify the same URL in both L</add> and L</remove>, it will be added. (That is, L</add> overrides L</remove>.)
1356  
1357 =head3 Returns
1358  
1359 A hash or hashref where the keys are numeric bug ids and the contents are a hash with one key, C<see_also>.
1360  
1361 C<see_also> points to a hash, which contains two keys, C<added> and C<removed>.
1362  
1363 These are arrays of strings, representing the actual changes that were made to the bug.
1364  
1365 Here's a diagram of what the return value looks like for updating bug ids 1 and 2:
1366  
1367 {
1368 1 => {
1369 see_also => {
1370 added => [(an array of bug URLs)],
1371 removed => [(an array of bug URLs)],
1372 }
1373 },
1374 2 => {
1375 see_also => {
1376 added => [(an array of bug URLs)],
1377 removed => [(an array of bug URLs)],
1378 }
1379 }
1380 }
1381  
1382 This return value allows you to tell what this method actually did.
1383  
1384 It is in this format to be compatible with the return value of a future L</update> method.
1385  
1386 =head3 Errors
1387  
1388 =over 4
1389  
1390 =item 100 - Invalid Bug Alias
1391  
1392 If you specified an alias and there is no bug with that alias.
1393  
1394 =item 101 - Invalid Bug ID
1395  
1396 The bug_id you specified doesn't exist in the database.
1397  
1398 =item 102 - Access Denied
1399  
1400 You do not have access to the bug_id you specified.
1401  
1402 =item 109 - Bug Edit Denied
1403  
1404 You did not have the necessary rights to edit the bug.
1405  
1406 =item 112 - Invalid Bug URL
1407  
1408 One of the URLs you provided did not look like a valid bug URL.
1409  
1410 =item 115 - See Also Edit Denied
1411  
1412 You did not have the necessary rights to edit the See Also field for this bug.
1413  
1414 Before Bugzilla 3.6, error 115 had a generic error code of 32000.
1415  
1416 =back
1417  
1418 =head2 update_tags
1419  
1420 @changes = BZ::Client::Bug->update_tags( $client, \%params );
1421 $changes = BZ::Client::Bug->update_tags( $client, \%params );
1422  
1423 Adds or removes tags on bugs.
1424  
1425 Unlike Keywords which are global and visible by all users, Tags are personal and can only be viewed and edited by their author. Editing them won't send any notification to other users. Use them to tag and keep track of bugs.
1426  
1427 Bugzilla will lower case the text of the tags. This doesn't seem to be documented.
1428  
1429 B<Reminder:> to retrieve these tags, specify C<_extra> or the field name C<tags> in L</include_fields> when searching etc.
1430  
1431 =head3 History
1432  
1433 This is marked as B<UNSTABLE> in Bugzilla 4.4
1434  
1435 Added in Bugzilla 4.4.
1436  
1437 =head3 Parameters
1438  
1439 =over 4
1440  
1441 =item ids
1442  
1443 An array of ints and/or strings--the ids or aliases of bugs that you want to add or remove tags to. All the tags will be added or removed to all these bugs.
1444  
1445 =item tags
1446  
1447 A hash representing tags to be added and/or removed. The hash has the following fields:
1448  
1449 =over 4
1450  
1451 =item add
1452  
1453 An array of strings representing tag names to be added to the bugs.
1454  
1455 It is safe to specify tags that are already associated with the bugs as they will just be silently ignored.
1456  
1457 =item remove
1458  
1459 An array of strings representing tag names to be removed from the bugs.
1460  
1461 It is safe to specify tags that are not associated with any bugs as they will just be silently ignored.
1462  
1463 =back
1464  
1465 =back
1466  
1467 =head3 Returns
1468  
1469 A hash or hashref where the keys are numeric bug ids and the contents are a hash with one key, C<tags>.
1470  
1471 C<tags> points to a hash, which contains two keys, C<added> and C<removed>.
1472  
1473 These are arrays of strings, representing the actual changes that were made to the bug.
1474  
1475 Here's a diagram of what the return value looks like for updating bug ids 1 and 2:
1476  
1477 {
1478 1 => {
1479 tags => {
1480 added => [(an array of tags)],
1481 removed => [(an array of tags)],
1482 }
1483 },
1484 2 => {
1485 tags => {
1486 added => [(an array of tags)],
1487 removed => [(an array of tags)],
1488 }
1489 }
1490 }
1491  
1492 This return value allows you to tell what this method actually did.
1493  
1494 =head3 Errors
1495  
1496 =over 4
1497  
1498 =item 100 - Invalid Bug Alias
1499  
1500 If you specified an alias and there is no bug with that alias.
1501  
1502 =item 101 - Invalid Bug ID
1503  
1504 The bug_id you specified doesn't exist in the database.
1505  
1506 =item 102 - Access Denied
1507  
1508 You do not have access to the bug_id you specified.
1509  
1510 =back
1511  
1512 =head2 new
1513  
1514 my $bug = BZ::Client::Bug->new( id => $id );
1515  
1516 Creates a new bug object instance with the given ID.
1517  
1518 B<Note:> Doesn't actually touch your bugzilla server.
1519  
1520 See L</INSTANCE METHODS> for how to use it.
1521  
1522 =head1 INSTANCE METHODS
1523  
1524 This section lists the modules instance methods.
1525  
1526 Once you have a bug object, you can use these methods to inspect and manipulate the bug.
1527  
1528 =head2 id
1529  
1530 $id = $bug->id();
1531 $bug->id( $id );
1532  
1533 Gets or sets the bugs ID.
1534  
1535 =head2 alias
1536  
1537 $alias = $bug->alias();
1538 $bug->alias( $alias );
1539  
1540 Gets or sets the bugs alias. If there is no alias or aliases are disabled in Bugzilla,
1541 this will be an empty string.
1542  
1543 =head2 assigned_to
1544  
1545 $assigned_to = $bug->assigned_to();
1546 $bug->assigned_to( $assigned_to );
1547  
1548 Gets or sets the login name of the user to whom the bug is assigned.
1549  
1550 =head2 component
1551  
1552 $component = $bug->component();
1553 $bug->component( $component );
1554  
1555 Gets or sets the name of the current component of this bug.
1556  
1557 =head2 creation_time
1558  
1559 $dateTime = $bug->creation_time();
1560 $bug->creation_time( $dateTime );
1561  
1562 Gets or sets the date and time, when the bug was created.
1563  
1564 =head2 dupe_of
1565  
1566 $dupeOf = $bug->dupe_of();
1567 $bug->dupe_of( $dupeOf );
1568  
1569 Gets or sets the bug ID of the bug that this bug is a duplicate of. If this
1570 bug isn't a duplicate of any bug, this will be an empty int.
1571  
1572 =head2 is_open
1573  
1574 $isOpen = $bug->is_open();
1575 $bug->is_open( $isOpen );
1576  
1577 Gets or sets, whether this bug is closed. The return value, or parameter value
1578 is true (1) if this bug is open, false (0) if it is closed.
1579  
1580 =head2 last_change_time
1581  
1582 $lastChangeTime = $bug->last_change_time();
1583 $bug->last_change_time( $lastChangeTime );
1584  
1585 Gets or sets the date and time, when the bug was last changed.
1586  
1587 =head2 priority
1588  
1589 $priority = $bug->priority();
1590 $bug->priority( $priority );
1591  
1592 Gets or sets the priority of the bug.
1593  
1594 =head2 product
1595  
1596 $product = $bug->product();
1597 $bug->product( $product );
1598  
1599 Gets or sets the name of the product this bug is in.
1600  
1601 =head2 resolution
1602  
1603 $resolution = $bug->resolution();
1604 $bug->resolution( $resolution );
1605  
1606 Gets or sets the current resolution of the bug, or an empty string if the bug is open.
1607  
1608 =head2 severity
1609  
1610 $severity = $bug->severity();
1611 $bug->severity( $severity );
1612  
1613 Gets or sets the current severity of the bug.
1614  
1615 =head2 status
1616  
1617 $status = $bug->status();
1618 $bug->status( $status );
1619  
1620 Gets or sets the current status of the bug.
1621  
1622 =head2 summary
1623  
1624 $summary = $bug->summary();
1625 $bug->summary( $summary );
1626  
1627 Gets or sets the summary of this bug.
1628  
1629 =head1 ATTACHMENTS & COMMENTS
1630  
1631 These are implemented by other modules.
1632  
1633 See L<BZ::Client::Bug::Attachment> and L<BZ::Client::Bug::Comment>
1634  
1635 =head1 TODO
1636  
1637 Bugzilla 5.0. introduced the C<search_comment_tags> and C<update_comment_tags> methods,
1638 these are yet to be specifically implemented.
1639  
1640 =head1 SEE ALSO
1641  
1642 L<BZ::Client>, L<BZ::Client::Bug::Attachment>, L<BZ::Client::Bug::Comment>
1643  
1644 L<BZ::Client::API>,
1645 L<Bugzilla WebService 4.4 API|https://www.bugzilla.org/docs/4.4/en/html/api/Bugzilla/WebService/Bug.html>,
1646 L<Bugzilla WebService 5.0 API|https://www.bugzilla.org/docs/5.0/en/html/integrating/api/Bugzilla/WebService/Bug.html>
1647  
1648 =head1 AUTHORS
1649  
1650 =over 4
1651  
1652 =item *
1653  
1654 Dean Hamstead <dean@bytefoundry.com.au>
1655  
1656 =item *
1657  
1658 Jochen Wiedmann <jochen.wiedmann@gmail.com>
1659  
1660 =back
1661  
1662 =head1 COPYRIGHT AND LICENSE
1663  
1664 This software is copyright (c) 2026 by Dean Hamstad.
1665  
1666 This is free software; you can redistribute it and/or modify it under
1667 the same terms as the Perl 5 programming language system itself.
1668  
1669 =cut