Acme-Letter
view release on metacpan or search on metacpan
lib/Acme/Letter.pm view on Meta::CPAN
#draw a dot
my $array_dot =[['*','*','*','*','*','*'],['*','*','*','*','*','*'],['*','*','*','*','*','*'],['*','*','_','*','*','*'],['*','(','_',')','*','*']];
$self{"array_dot"} = $array_dot;
my $lines = [];
$self{"lines"} = $lines;
return bless(\%self,$package);
}
sub printString()
{
my $self = shift;
my $string = shift;
$self->_createString($string);
my $lines_ref = $self->{"lines"};
for(my $i = 0; $i <= 4; $i++)
{
lib/Acme/Letter.pm view on Meta::CPAN
print " ";
}
else{
print $temp;
}
}
print "\n";
}
}
sub _createString()
{
my $self = shift;
my $words = shift;
$self->{"lines"} = $self->_createWord($words);
}
#output a word
sub printWord()
{
my $self = shift;
my $word = shift;
$self->_createWord($word);
my $lines_ref = $self->{"lines"};
for(my $i = 0; $i <= 4; $i++)
{
my $temps=$$lines_ref[$i];
lib/Acme/Letter.pm view on Meta::CPAN
}
else{
print $temp;
}
}
print "\n";
}
}
#create a word with several letters
sub _createWord()
{
my $self = shift;
my $word = shift;
my @chars = split //,$word;
my @lines = ();
my ($temp_char,$char);
my $temp_array;
my ($i,$j);
lib/Acme/Letter.pm view on Meta::CPAN
$line[$#line+1] = $$temp_char[$j];
}
}
}
push @lines, \@line;
}
$self->{"lines"} = \@lines;
}
#output lines to file
sub saveToFile()
{
my $self = shift;
my $string = shift;
my $filename = shift;
if(-e $filename)
{
die "$filename is a directory" if(-d $filename);
die "You have no permission to write content to $filename" unless(-w $filename);
die "$filename is not a text file" unless(-f $filename);
( run in 0.303 second using v1.01-cache-2.11-cpan-65fba6d93b7 )