Changeset 513 in ProjectBuilder for 0.9.3/pb-modules/lib
- Timestamp:
- Aug 7, 2008, 1:12:44 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
0.9.3/pb-modules/lib/ProjectBuilder/Base.pm
r503 r513 21 21 use English; 22 22 use locale; 23 use Locale::gettext;24 23 use POSIX qw(setlocale); 25 24 … … 39 38 40 39 our @ISA = qw(Exporter); 41 our @EXPORT = qw(pb_mkdir_p pb_system pb_rm_rf pb_get_date pb_log pb_log_init pb_ display pb_display_init pb_get_uri pb_get_content pb_display_file pb_syntax_init pb_syntax pb_temp_init $pbdebug $pbLOG $pbdisplaytype $pblocale);40 our @EXPORT = qw(pb_mkdir_p pb_system pb_rm_rf pb_get_date pb_log pb_log_init pb_get_uri pb_get_content pb_display_file pb_syntax_init pb_syntax pb_temp_init $pbdebug $pbLOG $pbdisplaytype $pblocale); 42 41 43 42 =pod … … 85 84 pb_log_init(2,\*STDOUT); 86 85 pb_log(1,"Message to print\n"); 87 88 #89 # Manages prints of the program90 #91 pb_display_init("text","fr_FR:UTF-8");92 pb_display("Message to print\n");93 86 94 87 # … … 271 264 272 265 273 =item B<pb_display_init>274 275 This function initializes the environment used by the pb_display function.276 277 The first parameter is the type of display which will be used. Could be "text", "web", "newt",...278 The second parameter is the loacle to be used.279 280 The call to B<pb_display_init> is typically done after getting a parameter on the CLI indicating the locale used or the type of interface to report messages to.281 282 =cut283 284 sub pb_display_init {285 286 $pbdisplaytype = shift || "text";287 $pblocale = shift || "C";288 289 setlocale(LC_ALL, $pblocale);290 pb_log(1,"Using $pbdisplaytype interface with $pblocale locale\n");291 292 if ($pbdisplaytype =~ /text/) {293 } elsif ($pbdisplaytype = /newt/) {294 } else {295 die "display system $pbdisplaytype unsupported";296 }297 }298 299 =item B<pb_display>300 301 This function prints the messages passed as parameter using the configuration set up with the B<pb_display_init> function.302 303 Here is a usage example:304 305 pb_display_init("text","fr_FR.UTF-8");306 pb_display("Hello World\n");307 308 will print:309 310 Bonjour Monde311 312 =cut313 314 sub pb_display {315 316 my $msg = shift;317 318 if ($pbdisplaytype =~ /text/) {319 print STDOUT gettext($msg);320 }321 }322 323 266 =item B<pb_display_file> 324 267
Note:
See TracChangeset
for help on using the changeset viewer.