The constructor new() contains lines like
$self->{data} = $ENV{XDG_DATA_HOME} || "$local\\.local\\share\\";
...
$self->{data} = $ENV{XDG_DATA_HOME} || "$home/.local/share/";
Why is the path_class attribute not used to created the fallback dirs if the XDG_ environment variables are not set
$self->{data} = $ENV{XDG_DATA_HOME} || $self->_dir($local, '.local', 'share');
...
$self->{data} = $ENV{XDG_DATA_HOME} || $self->_dir($home, '.local', 'share');