package Foo::Button; use strict; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw (newButton); ## short hand method that feeds some initial data to ## the constructor new() sub newButton { __PACKAGE__->new( {Up=>shift} ); } ## Class call only sub new { my $class = shift; my $self = {}; bless $self,$class; $self->{shape} = shift; ## fill up some other fields, then return $self; } 1; ## in file test.pl package main; use Foo::Button; my $b = newButton(@args);