1Danke
ERLEDIGT
JA
JA
ANTWORTEN
3
3
ZUGRIFFE
712
712
EMPFEHLEN
-
Hallo!
Auch wenn es unhöflich ist als Neuling gleich mit so einem Batzen zu kommen ... aber ich brauche dringend Hilfe! Ich versuche mit mod_perl (2) neue Directives für die httpd.conf zu basteln. Das funktioniert auch ganz gut, nur klappt das mit den Blöcken (wie <VirtualHost>) nicht. Ich kann die Daten im Block nicht auslesen!
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14
PerlSwitches -wT -Mdiagnostics PerlLoadModule My::ConfigModule <VirtualHost 127.0.0.1:80> ServerName test.local ServerAlias *.test.local DocumentRoot /var/www/test SetHandler perl-script PerlMapToStorageHandler My::MapToStorageHandler PerlResponseHandler My::ResponseHandler <MeinBlock test> Wert1 testen Wert2 123 </test> </VirtualHost>
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
package My::ConfigModule; use strict; our @ISA qw(Apache2::Module); use Apache2::CmdParms(); use Apache2::Const -compile qw(RSRC_CONF RAW_ARGS); use Apache2::Directive(); use Data::Dumper(); sub SERVER_CREATE { bless({}, shift); } sub SETUP_HASH { my ($self, $parms, $arg) = @_; my $directive = $parms->directive->directive; $directive =~ s/^<//; $self->{"$directive"} = $arg; print Data::Dumper->Dump([ $self->{"$directive"} ]); $self; } Apache2::Module::add(__PACKAGE__, [{ name => "<MeinBlock", func => __PACKAGE__."::SETUP_HASH", req_override => Apache2::Const::RSRC_CONF, args_how => Apache2::Const::RAW_ARGS, }]); 1;
Wenn ich jetzt den Server starte, bekomme ich nur "test>" vom Data:
umper Module augegeben. Wie komme ich an Wert1 und Wert2?
Vielen Dank im Voraus! Ich hoffe mir kann da jemand helfen!
-
Tach auch!
Wenn Du die Daten als Hash haben möchtest, probier es mal so:GreetzCode :1 2 3 4 5 6 7 8 9 10 11 12 13
sub SETUP_HASH { my ($self, $parms, $arg) = @_; my $directive = $parms->directive->directive; $directive =~ s/^<//; [B] $arg =~ s/>$//; $self->{"$directive"} = { $arg => $parms->directive()->as_hash()->{"$directive"}->{"$arg"} };[/B] print Data::Dumper->Dump([ $self->{"$directive"} ]); $self; }
EnumGeändert von Enumerator (19.03.09 um 14:40 Uhr)
-
Nachtrag:
Vorher solltest Du allerdings noch das mit dem schließenden Tag von <MeinBlock> richtig stellen: </test> wird hier nicht funktionieren...
Gruß
Enum
-
Super, danke!
Genau das habe ich gesucht!
Ähnliche Themen
-
httpd.conf auf utf-8
Von quidnovi im Forum PHPAntworten: 17Letzter Beitrag: 21.05.08, 17:32 -
httpd.conf auslagern
Von ArneH im Forum Hosting & WebserverAntworten: 3Letzter Beitrag: 21.09.05, 13:14 -
cgi Pfade in der httpd.conf !
Von Multi-master im Forum Hosting & WebserverAntworten: 3Letzter Beitrag: 07.10.02, 17:48 -
httpd.conf vom Apache
Von GlowBYte im Forum Linux & UnixAntworten: 2Letzter Beitrag: 21.05.02, 11:46 -
httpd.conf
Von Husky im Forum PHPAntworten: 2Letzter Beitrag: 22.06.01, 22:55





Zitieren
Login





