| 1 | package Icon::Theme::Index::Parse; | ||
| 2 | |||
| 3 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 0 | ▶ | use Config::IniHash; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | Icon::Theme::Index::Parse - Parse the index file for Freedesktop compatible icon themes. | ||
| 10 | |||
| 11 | =head1 VERSION | ||
| 12 | |||
| 13 | Version 0.0.1 | ||
| 14 | |||
| 15 | =cut | ||
| 16 | |||
| 17 | our $VERSION = '0.0.1'; | ||
| 18 | |||
| 19 | |||
| 20 | =head1 SYNOPSIS | ||
| 21 | |||
| 22 | Information for index file specification can be found at the URL below. | ||
| 23 | |||
| 24 | http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html | ||
| 25 | |||
| 26 | use Icon::Theme::Index::Parse; | ||
| 27 | |||
| 28 | my $themeindex = Icon::Theme::Index::Parse->new_from_file('/usr/local/share/icons/hicolor/index.theme'); | ||
| 29 | if($themeindex->{error}){ | ||
| 30 | print "Error!\n"; | ||
| 31 | } | ||
| 32 | |||
| 33 | =head1 METHOD | ||
| 34 | |||
| 35 | =head2 new_from_data | ||
| 36 | |||
| 37 | This forms a new object from the raw data. | ||
| 38 | |||
| 39 | One arguement is accepted and it is the raw data from a | ||
| 40 | index file. | ||
| 41 | |||
| 42 | my $themeindex=Icon::Theme::Index::Parse->new_from_data($data); | ||
| 43 | if($themeindex->{error}){ | ||
| 44 | print "Error!\n"; | ||
| 45 | } | ||
| 46 | |||
| 47 | =cut | ||
| 48 | |||
| 49 | sub new_from_data{ | ||
| 50 | my $data=$_[1]; | ||
| 51 | my $method='new_from_data'; | ||
| 52 | |||
| 53 | #init the object | ||
| 54 | my $self={ error=>undef, errorString=>'', perror=>undef, module=>'Icon-Theme-Index-Parse' }; | ||
| 55 | bless $self; | ||
| 56 | |||
| 57 | #make sure a file is specified | ||
| 58 | if (!defined( $data )) { | ||
| 59 | $self->{error}=4; | ||
| 60 | $self->{errorString}='No data specified'; | ||
| 61 | $self->{perror}=1; | ||
| 62 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 63 | return $self; | ||
| 64 | } | ||
| 65 | |||
| 66 | $self->{ini}=ReadINI(\$data, case=>'preserve' ); | ||
| 67 | |||
| 68 | return $self; | ||
| 69 | } | ||
| 70 | |||
| 71 | =head2 new_from_file | ||
| 72 | |||
| 73 | This creates a new object from the specified | ||
| 74 | index file. | ||
| 75 | |||
| 76 | One arguement is accepted and it is the path to the | ||
| 77 | file. | ||
| 78 | |||
| 79 | my $themeindex=Icon::Theme::Index::Parse->new_from_file('/usr/local/share/icons/hicolor/index.theme'); | ||
| 80 | if($themeindex->{error}){ | ||
| 81 | print "Error!\n"; | ||
| 82 | } | ||
| 83 | |||
| 84 | =cut | ||
| 85 | |||
| 86 | sub new_from_file{ | ||
| 87 | my $file=$_[1]; | ||
| 88 | my $method='new_from_file'; | ||
| 89 | |||
| 90 | #init the object | ||
| 91 | my $self={ error=>undef, errorString=>'', perror=>undef, module=>'Icon-Theme-Index-Parse' }; | ||
| 92 | bless $self; | ||
| 93 | |||
| 94 | #make sure a file is specified | ||
| 95 | if (!defined( $file )) { | ||
| 96 | $self->{error}=1; | ||
| 97 | $self->{errorString}='No file specified'; | ||
| 98 | $self->{perror}=1; | ||
| 99 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 100 | return $self; | ||
| 101 | } | ||
| 102 | |||
| 103 | #make sure it exists | ||
| 104 | if (!-f $file) { | ||
| 105 | $self->{error}=2; | ||
| 106 | $self->{errorString}='The specified file does not exist'; | ||
| 107 | $self->{perror}=1; | ||
| 108 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 109 | return $self; | ||
| 110 | } | ||
| 111 | |||
| 112 | #opens the file | ||
| 113 | my $data; | ||
| 114 | if ( open(INDEXFILE, $file) ) { | ||
| 115 | $data=join('', <INDEXFILE>); | ||
| 116 | close(INDEXFILE); | ||
| 117 | }else { | ||
| 118 | $self->{error}=3; | ||
| 119 | $self->{errorString}='No file specified'; | ||
| 120 | $self->{perror}=1; | ||
| 121 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 122 | return $self; | ||
| 123 | } | ||
| 124 | |||
| 125 | $self->{ini}=ReadINI(\$data, case=>'preserve' ); | ||
| 126 | |||
| 127 | return $self; | ||
| 128 | } | ||
| 129 | |||
| 130 | =head2 comment | ||
| 131 | |||
| 132 | This fetches a description for the theme. | ||
| 133 | |||
| 134 | If the comment setting is not defined 'false' is | ||
| 135 | returned. | ||
| 136 | |||
| 137 | my $hidden=$themeindex->hidden; | ||
| 138 | |||
| 139 | =cut | ||
| 140 | |||
| 141 | sub comment{ | ||
| 142 | my $self=$_[0]; | ||
| 143 | my $method='comment'; | ||
| 144 | |||
| 145 | if (!$self->errorblank) { | ||
| 146 | warn($self->{module}.' '.$method.': A parmanent error is set'); | ||
| 147 | } | ||
| 148 | |||
| 149 | #makes sure it is defined | ||
| 150 | if (!defined( $self->{ini}{'Icon Theme'}{Comment} )) { | ||
| 151 | return undef; | ||
| 152 | } | ||
| 153 | |||
| 154 | return $self->{ini}{'Icon Theme'}{Comment}; | ||
| 155 | } | ||
| 156 | |||
| 157 | =head2 directories | ||
| 158 | |||
| 159 | This gets a list of directories for the theme. | ||
| 160 | |||
| 161 | my @directories=$themeindex->directories; | ||
| 162 | |||
| 163 | =cut | ||
| 164 | |||
| 165 | sub directories{ | ||
| 166 | my $self=$_[0]; | ||
| 167 | my $method='directories'; | ||
| 168 | |||
| 169 | if (!$self->errorblank) { | ||
| 170 | warn($self->{module}.' '.$method.': A parmanent error is set'); | ||
| 171 | } | ||
| 172 | |||
| 173 | #split the directories apart at the | ||
| 174 | my @directories=split(/\,/, $self->{ini}{'Icon Theme'}{Directories}); | ||
| 175 | |||
| 176 | return @directories; | ||
| 177 | } | ||
| 178 | |||
| 179 | =head2 dirContext | ||
| 180 | |||
| 181 | This gets the context for icons in the directory. | ||
| 182 | |||
| 183 | my $context=$themeindex->dirContext('48x48/mimetypes'); | ||
| 184 | |||
| 185 | =cut | ||
| 186 | |||
| 187 | sub dirContext{ | ||
| 188 | my $self=$_[0]; | ||
| 189 | my $dir=$_[1]; | ||
| 190 | my $method='dirContext'; | ||
| 191 | |||
| 192 | if (!$self->errorblank) { | ||
| 193 | warn($self->{module}.' '.$method.': A parmanent error is set'); | ||
| 194 | } | ||
| 195 | |||
| 196 | #make sure the user specified a directory | ||
| 197 | if (!defined( $dir )) { | ||
| 198 | $self->{error}=5; | ||
| 199 | $self->{errorString}='No directory specified.'; | ||
| 200 | $self->{perror}=1; | ||
| 201 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 202 | return $self; | ||
| 203 | } | ||
| 204 | |||
| 205 | #make sure the directory exists | ||
| 206 | if (!defined( $self->{ini}{$dir} )) { | ||
| 207 | $self->{error}=6; | ||
| 208 | $self->{errorString}='The directory "'.$dir.'" does not exist'; | ||
| 209 | $self->{perror}=1; | ||
| 210 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 211 | return undef; | ||
| 212 | } | ||
| 213 | |||
| 214 | #return undef if there is no contect | ||
| 215 | if (!defined( $self->{ini}{$dir}{Context} )) { | ||
| 216 | return undef; | ||
| 217 | } | ||
| 218 | |||
| 219 | return $self->{ini}{$dir}{Context}; | ||
| 220 | } | ||
| 221 | |||
| 222 | =head2 dirExists | ||
| 223 | |||
| 224 | This checks if the specified directory exists in the index. | ||
| 225 | |||
| 226 | my $returned=$themeindex->dirExists('48x48/mimetypes'); | ||
| 227 | if($returned){ | ||
| 228 | print "It exists.\n"; | ||
| 229 | } | ||
| 230 | |||
| 231 | =cut | ||
| 232 | |||
| 233 | sub dirExists{ | ||
| 234 | my $self=$_[0]; | ||
| 235 | my $dir=$_[1]; | ||
| 236 | my $method='directories'; | ||
| 237 | |||
| 238 | if (!$self->errorblank) { | ||
| 239 | warn($self->{module}.' '.$method.': A parmanent error is set'); | ||
| 240 | } | ||
| 241 | |||
| 242 | if (defined( $self->{ini}{'Icon Theme'}{$dir} )) { | ||
| 243 | return 1; | ||
| 244 | } | ||
| 245 | |||
| 246 | return 0; | ||
| 247 | } | ||
| 248 | |||
| 249 | =head2 dirMaxSize | ||
| 250 | |||
| 251 | This gets the maximum size for icons in the directory. | ||
| 252 | |||
| 253 | my $maxsize=$themeindex->dirMaxSize('48x48/mimetypes'); | ||
| 254 | |||
| 255 | =cut | ||
| 256 | |||
| 257 | sub dirMaxSize{ | ||
| 258 | my $self=$_[0]; | ||
| 259 | my $dir=$_[1]; | ||
| 260 | my $method='dirMaxSize'; | ||
| 261 | |||
| 262 | if (!$self->errorblank) { | ||
| 263 | warn($self->{module}.' '.$method.': A parmanent error is set'); | ||
| 264 | } | ||
| 265 | |||
| 266 | #make sure the user specified a directory | ||
| 267 | if (!defined( $dir )) { | ||
| 268 | $self->{error}=5; | ||
| 269 | $self->{errorString}='No directory specified.'; | ||
| 270 | $self->{perror}=1; | ||
| 271 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 272 | return $self; | ||
| 273 | } | ||
| 274 | |||
| 275 | #make sure the specified dir info exists | ||
| 276 | if (!defined( $self->{ini}{$dir} )) { | ||
| 277 | $self->{error}=6; | ||
| 278 | $self->{errorString}='The directory "'.$dir.'" does not exist'; | ||
| 279 | $self->{perror}=1; | ||
| 280 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 281 | return undef; | ||
| 282 | } | ||
| 283 | |||
| 284 | #return undef if none is specified | ||
| 285 | if (!defined( $self->{ini}{$dir}{MaxSize} )) { | ||
| 286 | return undef; | ||
| 287 | } | ||
| 288 | |||
| 289 | return $self->{ini}{$dir}{MaxSize}; | ||
| 290 | } | ||
| 291 | |||
| 292 | =head2 dirMinSize | ||
| 293 | |||
| 294 | This gets the minimum size for icons in the directory. | ||
| 295 | |||
| 296 | my $minsize=$themeindex->dirMinSize('48x48/mimetypes'); | ||
| 297 | |||
| 298 | =cut | ||
| 299 | |||
| 300 | sub dirMinSize{ | ||
| 301 | my $self=$_[0]; | ||
| 302 | my $dir=$_[1]; | ||
| 303 | my $method='dirMinSize'; | ||
| 304 | |||
| 305 | if (!$self->errorblank) { | ||
| 306 | warn($self->{module}.' '.$method.': A parmanent error is set'); | ||
| 307 | } | ||
| 308 | |||
| 309 | #error if the user did not specifiy a directory | ||
| 310 | if (!defined( $dir )) { | ||
| 311 | $self->{error}=5; | ||
| 312 | $self->{errorString}='No directory specified.'; | ||
| 313 | $self->{perror}=1; | ||
| 314 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 315 | return $self; | ||
| 316 | } | ||
| 317 | |||
| 318 | #error if the dir queried does not exist | ||
| 319 | if (!defined( $self->{ini}{$dir} )) { | ||
| 320 | $self->{error}=6; | ||
| 321 | $self->{errorString}='The directory "'.$dir.'" does not exist'; | ||
| 322 | $self->{perror}=1; | ||
| 323 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 324 | return undef; | ||
| 325 | } | ||
| 326 | |||
| 327 | #return undef if none is specified | ||
| 328 | if (!defined( $self->{ini}{$dir}{MinSize} )) { | ||
| 329 | return undef; | ||
| 330 | } | ||
| 331 | |||
| 332 | return $self->{ini}{$dir}{MinSize}; | ||
| 333 | } | ||
| 334 | |||
| 335 | =head2 dirSize | ||
| 336 | |||
| 337 | This gets the nominal size for icons in the directory. | ||
| 338 | |||
| 339 | my $size=$themeindex->dirSize('48x48/mimetypes'); | ||
| 340 | |||
| 341 | =cut | ||
| 342 | |||
| 343 | sub dirSize{ | ||
| 344 | my $self=$_[0]; | ||
| 345 | my $dir=$_[1]; | ||
| 346 | my $method='dirSize'; | ||
| 347 | |||
| 348 | if (!$self->errorblank) { | ||
| 349 | warn($self->{module}.' '.$method.': A parmanent error is set'); | ||
| 350 | } | ||
| 351 | |||
| 352 | #error if the user did not specify a dir to query | ||
| 353 | if (!defined( $dir )) { | ||
| 354 | $self->{error}=5; | ||
| 355 | $self->{errorString}='No directory specified.'; | ||
| 356 | $self->{perror}=1; | ||
| 357 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 358 | return $self; | ||
| 359 | } | ||
| 360 | |||
| 361 | #error if there is no directory specified | ||
| 362 | if (!defined( $self->{ini}{$dir} )) { | ||
| 363 | $self->{error}=6; | ||
| 364 | $self->{errorString}='The directory "'.$dir.'" does not exist'; | ||
| 365 | $self->{perror}=1; | ||
| 366 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 367 | return undef; | ||
| 368 | } | ||
| 369 | |||
| 370 | #return undef if none is specified | ||
| 371 | if (!defined( $self->{ini}{$dir}{Size} )) { | ||
| 372 | return undef; | ||
| 373 | } | ||
| 374 | |||
| 375 | return $self->{ini}{$dir}{Size}; | ||
| 376 | } | ||
| 377 | |||
| 378 | =head2 dirThreshold | ||
| 379 | |||
| 380 | The icons in this directory can be used if the size | ||
| 381 | differ at most this much from the desired size. | ||
| 382 | |||
| 383 | Returns 2 if not present. | ||
| 384 | |||
| 385 | my $threshold=$themeindex->dirThreshold('48x48/mimetypes'); | ||
| 386 | |||
| 387 | =cut | ||
| 388 | |||
| 389 | sub dirThreshold{ | ||
| 390 | my $self=$_[0]; | ||
| 391 | my $dir=$_[1]; | ||
| 392 | my $method='dirType'; | ||
| 393 | |||
| 394 | if (!$self->errorblank) { | ||
| 395 | warn($self->{module}.' '.$method.': A parmanent error is set'); | ||
| 396 | } | ||
| 397 | |||
| 398 | #make sure the user specified a directory | ||
| 399 | if (!defined( $dir )) { | ||
| 400 | $self->{error}=5; | ||
| 401 | $self->{errorString}='No directory specified'; | ||
| 402 | $self->{perror}=1; | ||
| 403 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 404 | return undef; | ||
| 405 | } | ||
| 406 | |||
| 407 | #make sure the dir info exists | ||
| 408 | if (!defined( $self->{ini}{$dir} )) { | ||
| 409 | $self->{error}=6; | ||
| 410 | $self->{errorString}='The directory "'.$dir.'" does not exist'; | ||
| 411 | $self->{perror}=1; | ||
| 412 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 413 | return undef; | ||
| 414 | } | ||
| 415 | |||
| 416 | #return 2 as per the spec if this is not defined | ||
| 417 | if (!defined( $self->{ini}{$dir}{Threshold} )) { | ||
| 418 | return '2'; | ||
| 419 | } | ||
| 420 | |||
| 421 | return $self->{ini}{$dir}{Threshold}; | ||
| 422 | } | ||
| 423 | |||
| 424 | =head2 dirType | ||
| 425 | |||
| 426 | This gets the type of icon size for icons in the directory. | ||
| 427 | |||
| 428 | my $type=$themeindex->dirType('48x48/mimetypes'); | ||
| 429 | |||
| 430 | =cut | ||
| 431 | |||
| 432 | sub dirType{ | ||
| 433 | my $self=$_[0]; | ||
| 434 | my $dir=$_[1]; | ||
| 435 | my $method='dirType'; | ||
| 436 | |||
| 437 | if (!$self->errorblank) { | ||
| 438 | warn($self->{module}.' '.$method.': A parmanent error is set'); | ||
| 439 | } | ||
| 440 | |||
| 441 | #make sure it is specified | ||
| 442 | if (!defined( $dir )) { | ||
| 443 | $self->{error}=5; | ||
| 444 | $self->{errorString}='No directory specified.'; | ||
| 445 | $self->{perror}=1; | ||
| 446 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 447 | return $self; | ||
| 448 | } | ||
| 449 | |||
| 450 | #makes sure the directory exists | ||
| 451 | if (!defined( $self->{ini}{$dir} )) { | ||
| 452 | $self->{error}=6; | ||
| 453 | $self->{errorString}='The directory "'.$dir.'" does not exist'; | ||
| 454 | $self->{perror}=1; | ||
| 455 | warm($self->{module}.' '.$method.':'.$self->{error}.': '.$self->{errorString}); | ||
| 456 | return undef; | ||
| 457 | } | ||
| 458 | |||
| 459 | #return undef if no type is specified | ||
| 460 | if (!defined( $self->{ini}{$dir}{Type} )) { | ||
| 461 | return undef; | ||
| 462 | } | ||
| 463 | |||
| 464 | return $self->{ini}{$dir}{Type}; | ||
| 465 | } | ||
| 466 | |||
| 467 | =head2 example | ||
| 468 | |||
| 469 | This fetches a icon to use for a example for the theme. | ||
| 470 | |||
| 471 | If the comment setting is not defined 'false' is | ||
| 472 | returned. | ||
| 473 | |||
| 474 | my $example=$themeindex->example; | ||
| 475 | |||
| 476 | =cut | ||
| 477 | |||
| 478 | sub example{ | ||
| 479 | my $self=$_[0]; | ||
| 480 | my $method='example'; | ||
| 481 | |||
| 482 | if (!$self->errorblank) { | ||
| 483 | warn($self->{module}.' '.$method.': A parmanent error is set'); | ||
| 484 | } | ||
| 485 | |||
| 486 | #makes sure it is defined | ||
| 487 | if (!defined( $self->{ini}{'Icon Theme'}{Example} )) { | ||
| 488 | return undef; | ||
| 489 | } | ||
| 490 | |||
| 491 | return $self->{ini}{'Icon Theme'}{Comment}; | ||
| 492 | } | ||
| 493 | |||
| 494 | =head2 hidden | ||
| 495 | |||
| 496 | This gets if a it should be displayed or note. | ||
| 497 | |||
| 498 | The value returned should most likely match /[Ff][Aa][Ll][Ss][Ee]/ | ||
| 499 | or /[Tt][Rr][Uu][Ee]/. | ||
| 500 | |||
| 501 | If the hidden setting is not defined 'false' is | ||
| 502 | returned. | ||
| 503 | |||
| 504 | my $hidden=$themeindex->hidden; | ||
| 505 | |||
| 506 | =cut | ||
| 507 | |||
| 508 | sub hidden{ | ||
| 509 | my $self=$_[0]; | ||
| 510 | my $method='hidden'; | ||
| 511 | |||
| 512 | if (!$self->errorblank) { | ||
| 513 | warn($self->{module}.' '.$method.': A parmanent error is set'); | ||
| 514 | } | ||
| 515 | |||
| 516 | #makes sure it is defined | ||
| 517 | if (!defined( $self->{ini}{'Icon Theme'}{Hidden} )) { | ||
| 518 | return undef; | ||
| 519 | } | ||
| 520 | |||
| 521 | return $self->{ini}{'Icon Theme'}{Hidden}; | ||
| 522 | } | ||
| 523 | |||
| 524 | =head2 inherits | ||
| 525 | |||
| 526 | This gets a list of themes the theme inherits from. | ||
| 527 | |||
| 528 | my @dinherits=$themeindex->inherits; | ||
| 529 | |||
| 530 | =cut | ||
| 531 | |||
| 532 | sub inherits{ | ||
| 533 | my $self=$_[0]; | ||
| 534 | my $method='inherits'; | ||
| 535 | |||
| 536 | if (!$self->errorblank) { | ||
| 537 | warn($self->{module}.' '.$method.': A parmanent error is set'); | ||
| 538 | } | ||
| 539 | |||
| 540 | #what will be returned | ||
| 541 | my @inherits; | ||
| 542 | |||
| 543 | #split the directories apart at the | ||
| 544 | if (defined( $self->{ini}{'Icon Theme'}{Inherits} )) { | ||
| 545 | @inherits=split(/\,/, $self->{ini}{'Icon Theme'}{Inherits}); | ||
| 546 | } | ||
| 547 | |||
| 548 | #use Data::Dumper; | ||
| 549 | #print Dumper($self); | ||
| 550 | |||
| 551 | return @inherits; | ||
| 552 | } | ||
| 553 | |||
| 554 | =head2 name | ||
| 555 | |||
| 556 | This fetches a name for the theme. | ||
| 557 | |||
| 558 | If the comment setting is not defined 'false' is | ||
| 559 | returned. | ||
| 560 | |||
| 561 | my $name=$themeindex->name; | ||
| 562 | |||
| 563 | =cut | ||
| 564 | |||
| 565 | sub name{ | ||
| 566 | my $self=$_[0]; | ||
| 567 | my $method='name'; | ||
| 568 | |||
| 569 | if (!$self->errorblank) { | ||
| 570 | warn($self->{module}.' '.$method.': A parmanent error is set'); | ||
| 571 | } | ||
| 572 | |||
| 573 | #makes sure it is defined | ||
| 574 | if (!defined( $self->{ini}{'Icon Theme'}{Name} )) { | ||
| 575 | return undef; | ||
| 576 | } | ||
| 577 | |||
| 578 | return $self->{ini}{'Icon Theme'}{Name}; | ||
| 579 | } | ||
| 580 | |||
| 581 | =head2 errorblank | ||
| 582 | |||
| 583 | This is a internal function that blanks any previous errors. | ||
| 584 | |||
| 585 | =cut | ||
| 586 | |||
| 587 | sub errorblank{ | ||
| 588 | my $self=$_[0]; | ||
| 589 | |||
| 590 | if ($self->{perror}) { | ||
| 591 | return undef; | ||
| 592 | } | ||
| 593 | |||
| 594 | $self->{error}=undef; | ||
| 595 | $self->{errorString}=undef; | ||
| 596 | |||
| 597 | return 1; | ||
| 598 | } | ||
| 599 | |||
| 600 | =head1 ERROR CODES | ||
| 601 | |||
| 602 | =head2 1 | ||
| 603 | |||
| 604 | No file name specified. | ||
| 605 | |||
| 606 | =head2 2 | ||
| 607 | |||
| 608 | The file does not exist. | ||
| 609 | |||
| 610 | =head2 3 | ||
| 611 | |||
| 612 | Failed to open the index file. | ||
| 613 | |||
| 614 | =head2 4 | ||
| 615 | |||
| 616 | No data specified. | ||
| 617 | |||
| 618 | =head2 5 | ||
| 619 | |||
| 620 | No directory specified. | ||
| 621 | |||
| 622 | =head2 6 | ||
| 623 | |||
| 624 | The dir queries does not exist. | ||
| 625 | |||
| 626 | =head1 AUTHOR | ||
| 627 | |||
| 628 | Zane C. Bowers, C<< <vvelox at vvelox.net> >> | ||
| 629 | |||
| 630 | =head1 BUGS | ||
| 631 | |||
| 632 | Please report any bugs or feature requests to C<bug-icon-theme-index-parse at rt.cpan.org>, or through | ||
| 633 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Icon-Theme-Index-Parse>. I will be notified, and then you'll | ||
| 634 | automatically be notified of progress on your bug as I make changes. | ||
| 635 | |||
| 636 | |||
| 637 | |||
| 638 | |||
| 639 | =head1 SUPPORT | ||
| 640 | |||
| 641 | You can find documentation for this module with the perldoc command. | ||
| 642 | |||
| 643 | perldoc Icon::Theme::Index::Parse | ||
| 644 | |||
| 645 | |||
| 646 | You can also look for information at: | ||
| 647 | |||
| 648 | =over 4 | ||
| 649 | |||
| 650 | =item * RT: CPAN's request tracker | ||
| 651 | |||
| 652 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Icon-Theme-Index-Parse> | ||
| 653 | |||
| 654 | =item * AnnoCPAN: Annotated CPAN documentation | ||
| 655 | |||
| 656 | L<http://annocpan.org/dist/Icon-Theme-Index-Parse> | ||
| 657 | |||
| 658 | =item * CPAN Ratings | ||
| 659 | |||
| 660 | L<http://cpanratings.perl.org/d/Icon-Theme-Index-Parse> | ||
| 661 | |||
| 662 | =item * Search CPAN | ||
| 663 | |||
| 664 | L<http://search.cpan.org/dist/Icon-Theme-Index-Parse/> | ||
| 665 | |||
| 666 | =back | ||
| 667 | |||
| 668 | |||
| 669 | =head1 ACKNOWLEDGEMENTS | ||
| 670 | |||
| 671 | |||
| 672 | =head1 COPYRIGHT & LICENSE | ||
| 673 | |||
| 674 | Copyright 2009 Zane C. Bowers, all rights reserved. | ||
| 675 | |||
| 676 | This program is free software; you can redistribute it and/or modify it | ||
| 677 | under the same terms as Perl itself. | ||
| 678 | |||
| 679 | |||
| 680 | =cut | ||
| 681 | |||
| 682 | 1; # End of Icon::Theme::Index::Parse | ||