1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
sub new{ my $class = shift; my %cf = ( path => "/vars/wwws/vhosts/auth/files/blog_raw", name => '', atts => [qw(title descr parent ctime)], data => {}, @_); my $self = bless{}, $class; return eval{ my $fh = IO::File->new(); my $perms = keys %{$cf{data}} ? O_RDWR|O_BINARY|O_CREAT : O_RDWR|O_BINARY; $fh->open("$cf{path}/$cf{name}", $perms) or die $!; $self->{ATTS} = $cf{atts}; $self->{FH} = $fh; $self->{NAME} = $cf{name}; $self->{BIN} = keys %{$cf{data}} ? $cf{data} : $self->_parse(); $self; } }
1
2
3
4
5
6
7
8
9
10
11
12
title=Titel der Seite
descr=Eine Beschreibung
parent=/brd
body/HTML
<!-- title=Titel der Seite -->
<!-- descr=Beschreibung zum Inhalt -->
<!-- parent=/index -->
body/HTML
my $h = $self->{STYLE} eq 'new' ? { $head =~ /(\w+)=(.*)/g } : { $head =~ /(\w+)=(.*) /g };