Acme-Cow
view release on metacpan or search on metacpan
Cow/TextBalloon.pm view on Meta::CPAN
123124125126127128129130131132133134135136137138139140141142143144145146147148sub
text
{
my
$self
=
shift
;
if
(
@_
) {
my
@l
=
@_
;
$self
->{
'text'
} = \
@l
;
}
return
$self
->{
'text'
};
}
sub
_maxlength
{
my
(
$len
,
$max
);
$max
= -1;
for
my
$i
(
@_
) {
$len
=
length
$i
;
$max
=
$len
if
(
$len
>
$max
);
}
return
$max
;
}
sub
_fill_text
{
my
$self
=
shift
;
for
my
$i
(@{
$self
->{
'text'
}}) {
$i
=~ s/\s+$//;
Cow/TextBalloon.pm view on Meta::CPAN
157158159160161162163164165166167168169170171172173174175176177
$Text::Tabs::tabstop
= 1;
# Defeat a dumb heuristic.
my
@final
= expand(
@filled
);
return
@final
;
}
sub
_construct
{
my
$self
=
shift
;
my
$mode
=
$self
->{
'mode'
};
my
@message
=
$self
->_fill_text();
my
$max
= _maxlength(
@message
);
my
$max2
=
$max
+ 2;
## border space fudge.
my
@border
;
## up-left, up-right, down-left, down-right, left, right
my
@balloon_lines
= ();
my
$shove
=
" "
x
$self
->{
'over'
};
my
$format
=
"$shove%s %-${max}s %s\n"
;
if
(
$mode
eq think) {
@border
=
qw[ ( ) ( ) ( ) ]
;
}
elsif
(
@message
< 2) {
@border
=
qw[ < > ]
;
}
else
{
( run in 0.242 second using v1.01-cache-2.11-cpan-a5abf4f5562 )