Icon for Dimension.orgIcon for TalentIcon for ToolsIcon for Doorways.org
Icon for ToolsIcon for Perl Tools

MMAgic Demo: MMAgic/Log/Uniq.pm Source File

  • Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

MMAgic/Log/Uniq.pm

Go to the documentation of this file.
00001 package MMAgic::Log::Uniq;
00002 #
00003 # /MMAgic/Log/Uniq.pm
00004 #
00005 #   (C)opyright 2000 Marc M. Adkins
00006 #
00007 
00008 # use   warnings;
00009 
00010 use     MMAgic::Log;
00011 
00012 @ISA    = qw(MMAgic::Log);
00013 
00014 $a = ord('A');
00015 
00016 ###########################################################################
00017 sub randName    # $len
00018 #
00019     {
00020     my  $len = shift || 6;
00021     
00022     while (1)
00023         {
00024         my  $name = '';
00025         
00026         for (my $i = 0; $i < $len; $i++)
00027             {
00028             $name .= chr(int(rand(26)) + $a);
00029             }
00030         
00031         next if $unique{$name};
00032         
00033         $unique{$name} = 1;
00034         
00035         return $name;
00036         }
00037     }
00038 
00039 ###########################################################################
00040 ###########################################################################
00041 sub new ($;%)   # $class, ...
00042 #
00043     {
00044     my  $class = shift;
00045     my  $self  = new MMAgic::Log(@_);
00046     
00047     bless $self, $class;
00048     
00049     $self->{unique} = randName;
00050     
00051     return $self;
00052     }
00053 
00054 ###########################################################################
00055 sub DESTROY     # $self
00056 #
00057     {
00058     my  $self = shift;
00059     
00060     delete $unique{$self->{unique}} if exists $unique{$self->{unique}};
00061     $self->SUPER::DESTROY;
00062     }
00063 
00064 ###########################################################################
00065 ###########################################################################
00066 sub starter         # $self
00067 #
00068     {
00069     my  $self = shift;
00070     
00071     $self->SUPER::starter;
00072     $self->process("[$self->{unique}] ");
00073     }
00074 
00075 1

Generated on Mon Dec 27 2010 15:15:42 for MMAgic Demo by  doxygen 1.7.1

www.dimension.org logo

(C)opyright 1998 - 2012 Dimension.org

WebMaster