Thread eine 'sub'-Methode aus andere .plx zu benutzen ? (7 answers)
Opened by Updecrator at 2006-01-10 13:13

pq
 2006-01-10 14:52
#61617 #61617
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
es geht anders:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
package module;

sub main {
   print "running module!\n";
}

_ _FILE_ _ eq $0 and main;

sub test {
   print "module::test()\n";
}

1;
_ _FILE_ _ durch __FILE__ ersetzen.
Code: (dl )
require "module.pl"; # gibt "running module" nicht aus
\n\n

<!--EDIT|pq|1136897727-->
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread eine 'sub'-Methode aus andere .plx zu benutzen ?