Skip to content

Instantly share code, notes, and snippets.

@xenoterracide
Created July 22, 2012 15:46
Show Gist options
  • Select an option

  • Save xenoterracide/3160025 to your computer and use it in GitHub Desktop.

Select an option

Save xenoterracide/3160025 to your computer and use it in GitHub Desktop.
Request/Response Trace
# impossible
package Trace {
use Moose::Role;
has trace => (
isa => 'TraceObject',
is => 'ro',
);
}
package Request {
with 'Trace';
has '+trace' => (
is => 'rw',
traits => ['SetOnce'],
);
}
package Response {
with 'Trace';
}
# Possible
package Message {
use Moose;
has trace => (
isa => 'TraceObject',
is => 'ro',
);
}
package Request {
use Moose;
extends 'Message';
has '+trace' => (
is => 'rw',
traits => ['SetOnce'],
);
}
package Response {
use Moose;
extends 'Message';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment