Acme-Cow

 view release on metacpan or  search on metacpan

Cow/TextBalloon.pm  view on Meta::CPAN

package Acme::Cow::TextBalloon;

use strict;

my $rcs_id = q$Id: TextBalloon.pm,v 1.1 2001/09/10 23:31:09 tony Exp $;

=pod

=head1 NAME

Acme::Cow::TextBalloon - A balloon of text

=head1 SYNOPSIS

  use Acme::Cow::TextBalloon;

  $x = new Acme::Cow::TextBalloon;
  $x->add("bunch of text");
  $x->wrapcolumn(29);

  $y = new Acme::Cow::TextBalloon;
  $y->adjust(0);
  $y->add("more text");

=head1 DESCRIPTION

C<Acme::Cow::TextBalloon> Creates and manipulates balloons of text,
optionally printing them.  One may notice that the methods in this
module are named very similarly to those in C<Acme::Cow>; that's
because most of them have to do with the balloon rather than the
cow.

=cut

use Text::Tabs;
use Text::Wrap;


sub new 
{
    my $proto = shift;
    my $class = ref $proto || $proto;
    my $self = {
	fill => 1,
	mode => 'say',
	over => 0,
	text => [ ],
	wrap => 40,
    };
    return bless $self, $class;
}

sub wrapcolumn
{
    my $self = shift;
    if (@_) {
	$self->{'wrap'} = $_[0];
    } 
    return $self->{'wrap'};
}

sub mode
{
    my $self = shift;
    return $self->{'mode'};
}

sub think 
{
    my $self = shift;
    $self->{'mode'} = "think";
}

sub say 
{
    my $self = shift;
    $self->{'mode'} = "say";
}

sub print 
{
    my $self = shift;
    $self->{'mode'} = "think";
}

sub adjust
{
    my $self = shift;
    if (@_) {
	$self->{'fill'} = $_[0];
    } 
    return $self->{'fill'};
}

sub over
{
    my $self = shift;
    if (@_) {
	$self->{'over'} = $_[0];
    } 
    return $self->{'over'};
}

sub as_list
{
    my $self = shift;
    return $self->_construct();
}

sub as_string 



( run in 1.274 second using v1.01-cache-2.11-cpan-39bf76dae61 )