Heb in config.pm hetvolgende:
Nou doe ik in autoexec.pl hetvolgende:
Deze code had ik na een aanzetje van http://www.aota.net/forums/showthread.php?threadid=13377 . Maar werken wil het niet:
Kijk, als je de stricts weghaald werkt het gewoon. Maar mijn vraag is dus, is het wel mogelijk als je de stricts gewoon laat staan?
Perl:
1
2
3
4
5
6
7
8
9
10
| use strict; use vars qw(%config); my %config; %config = ( "db_host" => "localhost", "db_user" => "blablabla" ); 1; |
Nou doe ik in autoexec.pl hetvolgende:
Perl:
1
2
3
4
5
6
7
8
9
10
11
| #!/usr/bin/perl # autoexec.pl # - Auto executes lots of things (also includes every config file) use strict; use DBI; use lib ("."); require config; print $config{'db_host'}; |
Deze code had ik na een aanzetje van http://www.aota.net/forums/showthread.php?threadid=13377 . Maar werken wil het niet:
code:
1
2
| Global symbol "%config" requires explicit package name at ./autoexec.pl line 11. Execution of ./autoexec.pl aborted due the compilation errors. |
Kijk, als je de stricts weghaald werkt het gewoon. Maar mijn vraag is dus, is het wel mogelijk als je de stricts gewoon laat staan?
[ Voor 14% gewijzigd door zeroxcool op 14-03-2003 15:35 ]