This code does not really sets the lib path as expected but if I hard code this path instead of using this $libDir variable it simply works. So I decided to use a hardcoded lib path for testing purposes which exposed the next problem. In the directory "/home/avarus/perl/myPackages/" there is a package called "test.pm" which defines package "Test".my $libDir = "/home/avarus/perl/myPackages/"; use lib "$libDir";
this example works, but...use lib "/home/avarus/perl/myPackages/"; use test; # works
At the moment I am working around this problem with "require" and bla::blub constructs but then I don't have the functionality I want to make use of as described in perldoc perlobj. When I solved all those problems the next one is how I can create a new instance like this:use lib "/home/avarus/perl/myPackages/"; my $packageName = "test"; use $packageName; # does not work, segfaults
this of course does not work, but that's like I wanna do that :). It would be great if you can give me some hints. Thanks in advance, Andreas Schipplock.my $objName = "foo"; my $testObj = new $objName();
In reply to Loading and using packages dynamically by avarus.com.ar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |