"Fossies" - the Fresh Open Source Software Archive

Member "install-tl-20200916/tlpkg/tlperl/lib/CPAN/Distrostatus.pm" (17 Feb 2011, 972 Bytes) of package /windows/misc/install-tl.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 # -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*-
    2 # vim: ts=4 sts=4 sw=4:
    3 package CPAN::Distrostatus;
    4 use overload '""' => "as_string",
    5     fallback => 1;
    6 use vars qw($something_has_failed_at);
    7 use vars qw(
    8             $VERSION
    9 );
   10 $VERSION = "5.5";
   11 
   12 
   13 sub new {
   14     my($class,$arg) = @_;
   15     my $failed = substr($arg,0,2) eq "NO";
   16     if ($failed) {
   17         $something_has_failed_at = $CPAN::CurrentCommandId;
   18     }
   19     bless {
   20            TEXT => $arg,
   21            FAILED => $failed,
   22            COMMANDID => $CPAN::CurrentCommandId,
   23            TIME => time,
   24           }, $class;
   25 }
   26 sub something_has_just_failed () {
   27     defined $something_has_failed_at &&
   28         $something_has_failed_at == $CPAN::CurrentCommandId;
   29 }
   30 sub commandid { shift->{COMMANDID} }
   31 sub failed { shift->{FAILED} }
   32 sub text {
   33     my($self,$set) = @_;
   34     if (defined $set) {
   35         $self->{TEXT} = $set;
   36     }
   37     $self->{TEXT};
   38 }
   39 sub as_string {
   40     my($self) = @_;
   41     $self->text;
   42 }
   43 
   44 
   45 1;