Leser: 1
![]() |
|< 1 2 >| | ![]() |
18 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
#!/usr/bin/perl
use strict;
use warnings;
BEGIN { print "Vorher:\n"; print "»$_«\n" for @INC; }
use lib '.';
BEGIN { print "Nachher:\n"; print "»$_«\n" for @INC; }
use Foo::Bar;
Foo::Bar::output();
1
2
3
4
5
6
7
8
9
10
11
12
package Foo::Bar;
use strict;
use warnings;
use Foo::Bar::Baz;
sub output {
print "Hello, this is " . _ _PACKAGE_ _ . "!\n";
Foo::Bar::Baz::output2();
}
42;
1
2
3
4
5
6
7
8
9
10
package Foo::Bar::Baz;
use strict;
use warnings;
sub output2 {
print "Hello, this is " . _ _PACKAGE_ _ . "!\n";
}
42;
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
$ ./useModules.pl
Vorher:
»/etc/perl«
»/usr/local/lib/perl/5.8.7«
»/usr/local/share/perl/5.8.7«
»/usr/lib/perl5«
»/usr/share/perl5«
»/usr/lib/perl/5.8«
»/usr/share/perl/5.8«
»/usr/local/lib/site_perl«
»/usr/local/lib/perl/5.8.4«
».«
Nachher:
».«
»/etc/perl«
»/usr/local/lib/perl/5.8.7«
»/usr/local/share/perl/5.8.7«
»/usr/lib/perl5«
»/usr/share/perl5«
»/usr/lib/perl/5.8«
»/usr/share/perl/5.8«
»/usr/local/lib/site_perl«
»/usr/local/lib/perl/5.8.4«
Hello, this is Foo::Bar!
Hello, this is Foo::Bar::Baz!
1
2
3
4
5
6
7
8
9
#!/usr/bin/perl
use strict;
use warnings;
BEGIN { print "Vorher:\n"; print "»$_«\n" for @INC; }
# use lib '.';
BEGIN { print "Nachher:\n"; print "»$_«\n" for @INC; }
use Foo::Bar;
Foo::Bar::output();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
$ ./useModules.pl
Vorher:
»/etc/perl«
»/usr/local/lib/perl/5.8.7«
»/usr/local/share/perl/5.8.7«
»/usr/lib/perl5«
»/usr/share/perl5«
»/usr/lib/perl/5.8«
»/usr/share/perl/5.8«
»/usr/local/lib/site_perl«
»/usr/local/lib/perl/5.8.4«
».«
Nachher:
»/etc/perl«
»/usr/local/lib/perl/5.8.7«
»/usr/local/share/perl/5.8.7«
»/usr/lib/perl5«
»/usr/share/perl5«
»/usr/lib/perl/5.8«
»/usr/share/perl/5.8«
»/usr/local/lib/site_perl«
»/usr/local/lib/perl/5.8.4«
».«
Undefined subroutine &Foo::Bar::output called at ./useModules.pl line 9.
![]() |
|< 1 2 >| | ![]() |
18 Einträge, 2 Seiten |