Ignore:
Timestamp:
Apr 19, 2008, 12:46:44 AM (12 years ago)
Author:
bruno
Message:
  • pod doc done for Base.pm, and man page generated now for it
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/lib/ProjectBuilder/Base.pm

    r395 r396  
    9797
    9898Internal mkdir -p function. Forces mode to 755. Supports multiple parameters.
    99 Based in File::Path mkpath.
     99
     100Based on File::Path mkpath.
    100101
    101102=cut
     
    107108}
    108109
    109 =item B<pb_mkdir_p>
     110=item B<pb_rm_rf>
    110111
    111112Internal rm -rf function. Supports multiple parameters.
    112 Based in File::Path rmtree.
     113
     114Based on File::Path rmtree.
    113115
    114116=cut
     
    129131The second parameter is the message to print on screen. If none is given, then the command is printed.
    130132This function returns the result the return value of the system command.
     133
    131134If no error reported, it prints OK on the screen, just after the message. Else it prints the errors generated.
    132135
     
    169172Supposing the file is called "$ENV{'HOME'}/.pbrc", containing the following:
    170173
    171 $ cat $HOME/.pbrc
    172 pbver pb = 3
    173 pbver default = 1
    174 pblist pb = 12,25
     174  $ cat $HOME/.pbrc
     175  pbver pb = 3
     176  pbver default = 1
     177  pblist pb = 12,25
    175178
    176179calling it like this:
    177180
    178 my ($k1, $k2) = pb_conf_read_if("$ENV{'HOME'}/.pbrc","pbver","pblist");
    179 
    180 will allow to get the mapping
    181 $k1->{'pb'}  contains 3
    182 $ka->{'default'} contains 1
    183 $k2->{'pb'} contains 12,25
     181  my ($k1, $k2) = pb_conf_read_if("$ENV{'HOME'}/.pbrc","pbver","pblist");
     182
     183will allow to get the mapping:
     184
     185  $k1->{'pb'}  contains 3
     186  $ka->{'default'} contains 1
     187  $k2->{'pb'} contains 12,25
    184188
    185189Valid chars for keys and tags are letters, numbers, '-' and '_'.
     
    231235
    232236A URI has the format protocol://[ac@]host[:port][path[?query][#fragment]].
     237
    233238Cf man URI.
    234239
     
    275280The second parameter is a pointer on a file descriptor used to print the log info.
    276281
     282As an example, if you set the debug level to 2 in that function, every call to pb_log which contains a value less or equal than 2 will be printed. Calls with a value greater than 2 won't be printed.
     283
     284The call to B<pb_log_init> is typically done after getting a parameter on the CLI indicating the level of verbosity expected.
     285
    277286=cut
    278287
     
    284293}
    285294
     295=item B<pb_log>
     296
     297This function logs the messages passed as the second parameter if the value passed as first parameter is lesser or equal than the value passed to the B<pb_log_init> function.
     298
     299Here is a usage example:
     300
     301  pb_log_init(2,\*STDERR);
     302  pb_log(1,"Hello World 1\n");
     303  pb_log(2,"Hello World 2\n");
     304  pb_log(3,"Hello World 3\n");
     305
     306  will print:
     307 
     308  Hello World 1
     309  Hello World 2
     310
     311=cut
     312
    286313sub pb_log {
    287314
     
    292319}
    293320
    294 # cat equivalent function
     321=item B<pb_display_file>
     322
     323This function print the content of the file passed in parameter.
     324
     325This is a cat equivalent function.
     326
     327=cut
     328
    295329sub pb_display_file {
    296330
     
    300334printf "%s\n",pb_get_content($file);
    301335}
     336
     337=item B<pb_get_content>
     338
     339This function returns the content of the file passed in parameter.
     340
     341=cut
    302342
    303343# get content of a file in a variable
Note: See TracChangeset for help on using the changeset viewer.