Listing 4: A derived PuppetOpen routine
pascal ComponentResult PTBlockyPuppetOpen(ComponentInstance self)
{
	ComponentResult		result = noErr;
	PTBLPrivateGlobals**	storage = NULL;
	
	storage = (PTBLPrivateGlobals**) NewHandleClear(sizeof(PTBLPrivateGlobals));
	if (storage != NULL)
	{
			// store our globals in the component instance
		SetComponentInstanceStorage(self, (Handle) storage);
		(**storage).self = self;
		
			// get the Blocky media handler component
		(**storage).delegate = OpenDefaultComponent(PuppetComponentType, BasePuppetComponentType);
		ComponentSetTarget((**storage).delegate, self);
		
			// initially we target ourselves
		(**storage).target = self;
	}
	
	return (result);
}