Then there's of course the "Bozo.pm" module :#!/usr/bin/perl use strict; use warnings; use lib '.'; use Bozo; print go_bozo();
OK, so THIS work exactly as I'd expect it to work. Now, the stuff that's driving me nuts, let's change the script and add an additional module :use strict; use warnings; # module Bozo use Exporter; my @EXPORT=qw( go_bozo); sub go_bozo { return "BOZO!\n" } 1;
Then the module Foo.pm (please be patient):#!/usr/bin/perl use strict; use warnings; use lib '.'; use Foo; print Foo->Foo();
Fine, it still works! Now is coming whant I don't understand, just changing the script a little:#!/usr/bin/perl use strict; use warnings; package Foo; use lib '.'; use Bozo; sub Foo { return go_bozo() } 1;
And now it doesn't work anymore : Undefined subroutine &Foo::go_bozo called at Foo.pm line 13. I understand what's wrong : i'm useing Bozo.pm twice, and that's certainly evil (well actually I don't se why, but never mind...). But why doesn't it give an error such as importing twice the same module at Foo.pm line 10 then ?#!/usr/bin/perl use strict; use warnings; use lib '.'; use Bozo; use Foo; print go_bozo(); print Foo->Foo();
In reply to "use Foo.pm" twice from inside different packages... by wazoox
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |