Thread Konstanten in Modulen (13 answers)
Opened by format_c at 2005-02-13 15:43

Gast Gast
 2005-02-20 21:44
#51670 #51670
[quote=format_c,13.02.2005, 14:43]
Code: (dl )
1
2
3
4
5
6
7
8
package mymodule;
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(NAME);

use constant NAME => 'Alex';
package main;
print NAME;
[/quote]
Versuch ..
Code: (dl )
1
2
3
4
5
6
7
8
package mymodule;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(NAME);

use constant NAME => 'Alex';
package main;
print NAME;

oder, falls es in andere Dateien eingebunden werden soll:
Code: (dl )
1
2
3
4
5
6
package MyModule; # module sollten mit grossbuchstaben sein
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(NAME);

use constant NAME => 'Alex';

Code: (dl )
1
2
use MyModule qw(NAME);
print NAME;

View full thread Konstanten in Modulen