use strict; use warnings; require Carp; use lib 'lib'; require Widget; # Create a new widget. my $w = Widget->new or Carp::confess("new widget failed"); # Add a part of type 'Cog' to this widget, named 'cog-62' my $part = $w->addPart(type=>'Cog', name=>'cog-62') or Carp::confess("addPart failed"); # Show some info about the part just added: printf( "part name is: %s, of class: %s\n", $part->name(), ref($part) );