Teil von SELFHTML Forum Teil von SELFHTML Forumsarchiv Teil von 2003 Teil von Januar

SELFHTML Forumsarchiv
HTML::Mason und Konstanten

Informationsseite
  1. Seite (PERL) HTML::Mason und Konstanten von timothy, 31. 01. 2003, 14:09
nach unten

HTML::Mason und Konstanten

Die folgende Nachricht zum Thema stammt von: timothy, 31. 01. 2003, 14:09

Hi folks

für Kenner des Moduls:

Ich habe eine Komponente "constant.dat" mit folgendem Inhalt:

% my $CALURL = "/pim/calendar/kalender.html";

Dann habe  ich eine Komponente "kalender.html" die die Komponente "constant.dat" so ein bindet:

<& /pim/comp/constant.dat &>
...

und innerhalb von "kalender.html" möchte ich dann auf z.B. $CALURL zugreifen (z.b. ausgeben)

also:

URL = <% $CALURL %>

Klappt nicht mit der Fehlermeldung:

Error during compilation of N:\Apache\pim\calendar\kalender.html:
Global symbol "$CALURL" requires explicit package name at N:\Apache\pim\calendar\kalender.html line 4.

context:
1:  <& /pim/comp/header.comp , app => "Kalender"&>
2:  <& /pim/comp/constant.dat &>
3:
4:  <% $CALURL %>
5:  SID: <% $session->id() %>
6:  <br>
7:  NAME: <% $session->param('name') %>
8:  <br>

Ein

require "/pim/comp/constant.dat";

in der <%init> Sektion statt <& ... &> hilft mir auch nicht -> gleiche Fehlermeldung

Nur wenn ich $CALURL in der <%init> Sektion explizit deklariere

<%init>
my $CALURL = "blablabla";
</%init>

dann gibt es keine Probleme.

Mein eigentliches Ansinnen: Ich möchte Konstanten nur in einer einzigen Komponente halten und diese dann bei Bedarf in andere Komponenten einbinden. Ich möchte KEINE globalen Variablen weder in httpd.conf noch in handler.pl deklarieren.

Kennt jemand eine praktikable Lösung?

Bye und Danke im voraus
Timothy

nach obennach unten

HTML::Mason und Konstanten - Nachtrag

Die folgende Nachricht zum Thema stammt von: timothy, 31. 01. 2003, 14:25

Klar

daß ein "require" nichts hilft, da erst zur Laufzeit eingebunden.

Also: andere Möglichkeiten ???

Gruß
Timothy

nach obennach unten

HTML::Mason und Konstanten - Problem gelöst

Die folgende Nachricht zum Thema stammt von: timothy, 31. 01. 2003, 18:00

Hi folks,

habe das Problem gelöst. Es braucht sich also niemand mehr den Kopf zu zerbrechen - falls das überhaupt jemand getan hat ;-)

Schönes und erfolgreiches Wochenende noch
Timothy

nach oben
Teil von SELFHTML Forum Teil von SELFHTML Forumsarchiv Teil von 2003 Teil von Januar

© 1998-2006 Seite Impressum, Software: Classic Forum