| 1 | package Claude::Agent::Content; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 12 | ▶ | use 5.020; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 12 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 12 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 12 | ▶ | use Claude::Agent::Types; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 12 | ▶ | use Claude::Agent::Content::Text; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 12 | ▶ | use Claude::Agent::Content::Thinking; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 12 | ▶ | use Claude::Agent::Content::ToolUse; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 12 | ▶ | use Claude::Agent::Content::ToolResult; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 12 | my %CLASS_FOR = ( | |||||||||||||||||||
| 14 | text => 'Claude::Agent::Content::Text', | ||||||||||||||||||||
| 15 | thinking => 'Claude::Agent::Content::Thinking', | ||||||||||||||||||||
| 16 | tool_use => 'Claude::Agent::Content::ToolUse', | ||||||||||||||||||||
| 17 | tool_result => 'Claude::Agent::Content::ToolResult', | ||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 17 | ▶ | sub from_json { | ||||||||||||||||||
|
Subroutine
from_json: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 21 | 17 | my ($class, $data) = @_; | |||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 17 | ▶ | my $target = $CLASS_FOR{ $data->{type} // '' } or return $data; | ||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$data->{"type"} // ""
MC/DC100%1/1
$data->{"type"} // ""
$data->{"type"}
Truth table100%2/2
A
A= $data->{"type"}
| |||||||||||||||||||||
| 24 | 12 | return $target->new( | |||||||||||||||||||
| 25 | Claude::Agent::Types::known_args($target, $data), | ||||||||||||||||||||
| 26 | raw => $data, | ||||||||||||||||||||
| 27 | ); | ||||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 12 | 1; | |||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | __END__ | ||||||||||||||||||||