#!/usr/bin/perl package Tk::MyText;  use Tk::Text;  use base qw(Tk::Text);  Tk::Widget->Construct('MyText');  sub insert {      my($w, @args) = @_;      my $max_length = 255;      my $t = $w->get('1.0', 'end');      $t =~ s/\n$//s;      $w->SUPER::insert($args[0],          substr(join( '' => @args[1 .. $#args]), 0, $max_length - length $t));  } 1; package main;  use strict;  use warnings;  use Tk;  my $mw = tkinit();  my $t = $mw->MyText()->pack;  $t->insert('end', 'Doctor Foomanshu');  MainLoop;