Strict mode

Peter Seitz seitz at bzs.tu-graz.ac.at
Thu Dec 30 05:41:31 CST 1999


* * * vienna-pm-list * * *


Hallo Liste,

ich habe ja geschrieben, dass ich mit dem strict mode etwas probleme 
hatte. Meine Literatur (Learning PERL/Schwartz, Christiansen, sowie 
zwei weitere Buecher) laesst sich hier nicht sehr ausfuehrlich ueber 
strict aus.

Hier mein Problem:
Ich habe zwei Konfigurationsdateien und ein Hauptprogramm. Wenn ich nun
in den Konfig-Dateien eine Variable definiere, wie muss ich die dann 
definieren, dass die Werte auch im Hauptprogramm wieder gefunden 
werden. Hier waere ich fuer jeden Tip dankbar. Ich hoffe auch, dass
ich in dieser Mailingliste weitere wertvolle Anregung finden werde, 
wie man effizient und in gutem Stiel in perl programmiert.

Datei language.pl:
~~~~~~~~~~~~~~~~~~
%LanguageCode = (
   'ca',        'Catalan',
   'cz',        'Czech',
   'de',        'German',
   'dk',        'Danish',
   'ru',        'Russian',
);

1; # This must be the last line
------ end language.pl ------

Datei platform.rc
~~~~~~~~~~~~~~~~~
#=====================================================================
# This is the configuration file for perl tools provided for the
#       Pegasus Mail Translation Process
#
# This file is needed to configure site specifig or platform specific
# settings. When this file cannot be found, the perl tools won't run.

                        # define the platform the tools are used on
$platform = 0;          # 0 = DOS/Windows
                        # 1 = Unix/Linux

#=====================================================================
1; # This must be the last line
------- end platform.pl ----------

Hauptprogramm:
~~~~~~~~~~~~~~
#!/usr/bin/perl -w
#

use strict;     # do not allow implicit variable definition

my $debug = 0;                          # debug setting (used in platform.rc)
my $strings_db_file         = "strings.db";     # Database for strings
my $strings_db_button_file  = "button.db";      # Database for buttons
my $strings_db_caption_file = "caption.db";     # Database for captions
my $strings_db_fonts_file   = "fonts.db";       # Database for fonts
my $strings_xx_file = "strings.xx";     # Strings to translate

# now set some platform specific things...

require "platform.rc";         # Get system settings

print "Platform setting: $platform\n" if ($debug >5);
--------- end testdatei -------

Ein Programmlauf schreibt mir nun:
Global symbol "platform" requires explicit package name at t.pl line ...

Nun die Frage, wie ich den Package Namen wirklich zuweise. Muss ich 
hier spezielle Definitionen machen? Ich schreibe ja kein Modul.

Danke fuer Euere Tips und einen guten Start ins naechste Jahr(-
tausend).


With best compliments

           Peter Seitz
-- 

  Graz University of Technology, Austria - Fac. f. Civil Engineering
  mailto:seitz at bzs.tu-graz.ac.at - http://wwwbzs.tu-graz.ac.at/~seitz/

            Member of the Pegasus Mail Support Group
          Coordinator of the Pmail Translation Process

For information about translating Pegasus Mail, contact:
Han van den Bogaerde (jaabogae at caiw.nl) or
Peter Seitz (seitz at bzs.tu-graz.ac.at)

###
You are subscribed to vienna-pm-list
http://www.fff.at/fff/vienna.pm/



More information about the Vienna-pm mailing list