100 |
|
|
101 |
=head2 load_tape |
=head2 load_tape |
102 |
|
|
103 |
$self->load_tape( '/path/to/file' ); |
$self->load_tape( '/path/to/file', $position ); |
104 |
|
|
105 |
=cut |
=cut |
106 |
|
|
107 |
sub load_tape { |
sub load_tape { |
108 |
my $self = shift; |
my $self = shift; |
109 |
my $path = shift || return; |
my $path = shift || return; |
110 |
|
my $pos = shift || 0; |
111 |
|
|
112 |
my $tape = read_file( $path ) || confess "can't load $path: $!"; |
my $tape = read_file( $path ) || confess "can't load $path: $!"; |
113 |
$self->tape_path( $path ); |
$self->tape_path( $path ); |
114 |
|
|
115 |
$self->tape_pos( 0 ); |
$self->tape_pos( $pos ); |
116 |
$self->tape( $tape ); |
$self->tape( $tape ); |
117 |
warn "loaded tape $path ", -s $path, " bytes\n"; |
warn "loaded tape $path ", -s $path, " bytes at $pos\n"; |
118 |
return 1; |
return 1; |
119 |
} |
} |
120 |
|
|