PerlVision

 view release on metacpan or  search on metacpan

bin/rap  view on Meta::CPAN

    my $self=new PerlVision::Editbox (1,3,$maxwidth-2,$maxheight-2,@params[0..2],0);
    move ($maxheight-1,0);
    attron (COLOR_PAIR(7));
    addstr("  <Esc>-H for Help             <Esc>-X for Menu");
    $$self[12]=0;		# Mark position
    $$self[13]="INS  TOP";	# status
    $$self[14]="";		# status shown
    $$self[15]=$params[3];	# filename
    $$self[16]="";		# Kill buffer
    $$self[17]=0;		# Kill buffer clear toggle
    ($$self[15] =~/^~/) && (substr ($$self[15],0,1)=(getpwuid ($<))[7]);
    bless $self;
}

sub statusbar {
    my $self=shift;
    my ($maxheight,$maxwidth); getmaxyx($maxheight, $maxwidth);
    substr ($$self[13],0,3) = ($$self[11] ? "OVT" : "INS");
    if ($$self[13] ne $$self[14]) {
	move ($maxheight-1,$maxwidth-12);
	addstr($$self[13]);

bin/rap  view on Meta::CPAN

				 $fun4,2,5,5,3,4,4,5,0,
				 $fun5,4,6,6,3,5,5,6,0,
				 $fun7,5,6,6,3,6,6,1,0,
				 $fun0,0,0,0,0,0,0,0,0);
    $options->activate;
}

sub readfile {
    my $filename=shift;
    my $text="";
    ($filename =~/^~/) && (substr ($filename,0,1)=(getpwuid ($<))[7]);
    open (INPUT, $filename) || return (0);
    foreach (<INPUT>) {
	$text.=$_;
    }
    close INPUT;
    return (1,$text);
}

sub dirty {
    my $self=shift;

bin/rap  view on Meta::CPAN

    move ($maxheight-1,0);
    attron (COLOR_PAIR(7));
    addstr("  <Esc>-H for Help             <Esc>-X for Menu                  ");
    refresh();
    if ($filename) {
	my ($ret, $initial) = readfile ($filename);
	if ($ret) {
	    $$self[6]=$initial."\n";
	    $$self[7]=0;
	    $$self[15]=$filename;
	    ($$self[15] =~/^~/) && (substr ($$self[15],0,1)=(getpwuid ($<))[7]);
	    $self->justify(1);
	    $self->rfsh();
	}
	else {
	    PerlVision::PVD::message ("Error: Couldn't open file.",30,1);
	}
    }
    $self->cursor;
    refresh();
}

bin/rap  view on Meta::CPAN

    $self->cursor;
    refresh();
}

sub saveas {
    my $self=shift;
    my ($maxheight,$maxwidth); getmaxyx($maxheight, $maxwidth);
    my $savefile = new PerlVision::Entryfield (2,$maxheight-1,52,0,"Save As:",$$self[15]);
    $savefile->display; $savefile->activate;
    my $filename = ($savefile->stat);
    ($filename =~/^~/) && (substr ($filename,0,1)=(getpwuid ($<))[7]);
    undef $savefile;
    move ($maxheight-1,0);
    attron (COLOR_PAIR(7));
    addstr("  <Esc>-H for Help             <Esc>-X for Menu                  ");
    refresh();
    if ($filename) {
	if (-e $filename) {
	    return unless (PerlVision::PVD::yesno ("File exists. Overwrite?",30,1));
	}
	$$self[15]=$filename;

bin/rap  view on Meta::CPAN

    }
}

package main;

use PerlVision;

sub readfile {
    my $filename=shift;
    my $text="";
    ($filename =~/^~/) && (substr ($filename,0,1)=(getpwuid ($<))[7]);
    open (INPUT, $filename) || return (0);
    foreach (<INPUT>) {
	$text.=$_;
    }
    close INPUT;
    return (1,$text);
}

$initial="";



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