sub setDoctype { my XML::ValidWriter $self = &_self ; $self->{DOCTYPE} = shift if @_ ; return ; } sub _self { ## MUST be called as C< &_self ;> ## If it's a reference to anything but a plain old hash, then the ## first param is either an XML::ValidWriter, a reference to a glob ## a reference to a SCALAR, or a reference to an IO::Handle. return shift if ( @_ && ref $_[0] && isa( $_[0], 'XML::ValidWriter' ) ) ; my $callpkg = caller(1) ; croak "No default XML::ValidWriter declared for package '$callpkg'" unless $pkg_writers{$callpkg} ; return $pkg_writers{$callpkg} ; }