| 1 | # $Id: Text.pm 193 2009-01-16 13:42:25Z fish $ | ||
| 2 | package WWW::MeGa::Item::Text; | ||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | WWW::MeGa::Item::Text - Representing a text file in L<WWW::MeGa> | ||
| 9 | |||
| 10 | =head1 DESCRIPTION | ||
| 11 | |||
| 12 | See L<WWW::MeGa::Item> | ||
| 13 | |||
| 14 | =head1 CHANGED METHODS | ||
| 15 | |||
| 16 | =cut | ||
| 17 | |||
| 18 | use base 'WWW::MeGa::Item'; | ||
| 19 | |||
| 20 | our $VERSION = '0.11'; | ||
| 21 | |||
| 22 | |||
| 23 | =head1 data | ||
| 24 | |||
| 25 | gets the common data from C<SUPER::data>, puts the text file | ||
| 26 | content in C<$data->{CONTENT}> and return the data. | ||
| 27 | |||
| 28 | =cut | ||
| 29 | |||
| 30 | sub data | ||
| 31 | { | ||
| 32 | my $self = shift; | ||
| 33 | my $data = $self->SUPER::data; | ||
| 34 | |||
| 35 | open my $fh, '<', $self->{path} or die $!; | ||
| 36 | $data->{CONTENT} = <$fh>; | ||
| 37 | close $fh; | ||
| 38 | return $data; | ||
| 39 | } | ||
| 40 | |||
| 41 | 1; |