#!/usr/bin/perl use strict; my $main_object = bless( {} ); print "\$main_object is of type (", ref $main_object, ")\n"; $main_object->{blah} = 'blah'; $main_object->get_session(); #### Can't locate object method "get_session" via package "main" (perhaps you forgot to load "main"?) at bless_main.pl line 8. $main_object is of type (main) #### my $object = bless( {}, 'My::Object' ); #### sub new { my ( $item ) = @_; my $class = ref $item || $item; return bless( {}, $class ); }