In order to simplify some existing tools, I wanted to replace several arrays with an array of structs. So I made a simple example code to test the creation of the structs. The code used is as follows:
use strict;
use warnings;
#package Net_Node;
use Class::Struct Net_Node => [host => '$', access => '$', pass => '$'];
#struct( host => '$', access => '$', user => '$', pass => '$' );
my $example = new Net_Node;
$example->host('dir ip');
$example->access('TELNET');
$example->user('hjack');
$example->pass('buttstalion');
print "\n\n\n";
print "${example->host}\n";
print "${example->access}\n";
print "${example->pass}\n";
The issue is when I try to execute this script, I get this error:
Can't locate object method "host" via package "example" (perhaps you forgot to load "example"?) at test_2.pl line 15.
Can you please help me find out what do I need to correct??