Skip to content

Does it really make sense for ClassName to accept objects overloading stringification? #21

@tobyink

Description

@tobyink

Consider:

has ua_class => (
  is       => 'ro',
  isa      => t('ClassName'),
  default  => 'HTTP::Tiny',
);

has ua => (
  is       => 'ro',
  isa      => t('Object'),
  default  => sub { shift->ua_class->new() },
);

If somebody sets ua_class to an object overloading stringification, and the stringification yields a valid classname, then what will ua be?

This seems a source for very hard to diagnose bugs, especially as things like warn $self->ua_class will hide the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions