Line 0
Link Here
|
|
|
1 |
package Koha::Installer::Output; |
2 |
|
3 |
# Copyright 2024 Koha Development Team |
4 |
# |
5 |
# This file is part of Koha. |
6 |
# |
7 |
# Koha is free software; you can redistribute it and/or modify it |
8 |
# under the terms of the GNU General Public License as published by |
9 |
# the Free Software Foundation; either version 3 of the License, or |
10 |
# (at your option) any later version. |
11 |
# |
12 |
# Koha is distributed in the hope that it will be useful, but |
13 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 |
# GNU General Public License for more details. |
16 |
# |
17 |
# You should have received a copy of the GNU General Public License |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
20 |
use Modern::Perl; |
21 |
|
22 |
use Exporter qw(import); |
23 |
use Term::ANSIColor qw(:constants); |
24 |
|
25 |
our @EXPORT_OK = qw(say_warning say_failure say_success say_info); |
26 |
|
27 |
=head1 NAME |
28 |
|
29 |
Koha::Installer::Output - Module to provide colored output for Koha installer |
30 |
|
31 |
=head1 SYNOPSIS |
32 |
|
33 |
use Koha::Installer::Output qw(say_warning say_failure say_success say_info); |
34 |
|
35 |
# Output messages with appropriate colors |
36 |
say_warning($fh, "This is a warning message"); |
37 |
say_failure($fh, "This is a failure message"); |
38 |
say_success($fh, "This is a success message"); |
39 |
say_info($fh, "This is an info message"); |
40 |
|
41 |
=head1 DESCRIPTION |
42 |
|
43 |
This module provides methods to output messages with appropriate colors for different types of messages: |
44 |
warnings, failures, successes, and informational messages. |
45 |
|
46 |
=head1 EXPORTS |
47 |
|
48 |
The following functions can be exported upon request: |
49 |
|
50 |
=over 4 |
51 |
|
52 |
=item * say_warning($fh, $msg) |
53 |
|
54 |
Output a warning message in yellow. |
55 |
|
56 |
=item * say_failure($fh, $msg) |
57 |
|
58 |
Output a failure message in red. |
59 |
|
60 |
=item * say_success($fh, $msg) |
61 |
|
62 |
Output a success message in green. |
63 |
|
64 |
=item * say_info($fh, $msg) |
65 |
|
66 |
Output an informational message in blue. |
67 |
|
68 |
=back |
69 |
|
70 |
=cut |
71 |
|
72 |
sub say_warning { |
73 |
my ( $fh, $msg ) = @_; |
74 |
say $fh YELLOW, "$msg", RESET; |
75 |
} |
76 |
|
77 |
sub say_failure { |
78 |
my ( $fh, $msg ) = @_; |
79 |
say $fh RED, "$msg", RESET; |
80 |
} |
81 |
|
82 |
sub say_success { |
83 |
my ( $fh, $msg ) = @_; |
84 |
say $fh GREEN, "$msg", RESET; |
85 |
} |
86 |
|
87 |
sub say_info { |
88 |
my ( $fh, $msg ) = @_; |
89 |
say $fh BLUE, "$msg", RESET; |
90 |
} |
91 |
|
92 |
=head1 AUTHORS |
93 |
|
94 |
Martin Renvoize <martin.renvoize@ptfs-europe.com> |
95 |
|
96 |
=cut |
97 |
|
98 |
1; |