I understand that there are several such questions on the air, but I canβt solve the problem. Perhaps I should improve my lateral thinking.
I have a module that I am testing. This module looks something like this:
package MyModule; use strict; use warnings; ...
This is my test file:
#!/usr/bin/perl -w use strict; use MyModule; use Test::More tests => 1; use Data::Dumper; print "Name: "; my $name; chomp($name = <STDIN>); print "chosen name: $name\n"; my %options = ( option1 => 'blah blah blah', option2 => 'blu blu blu', ); my $name_object = MyModule->new($name,\%options); print Dumper($name_object); isa_ok($name_object,'MyModule'); $name_object->init; print Dumper($name_object);
Now it works before isa_ok , but then it appears:
Can't locate object method "init" via package "MyModule" at test_MyModule.t line 31, <STDIN> line 1.
This happened only now, when I try (and somewhat fail) to use objects. Therefore, therefore, I believe that I misunderstand the application of objects in Perl! Any help would be appreciated ...
source share