| 1 | package CXC::Gnuplot::V1::Title; | ||
| 2 | |||
| 3 | 1 | ▶ | use v5.38; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use experimental 'builtin', 'declared_refs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use Object::Pad 0.821; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 6 | |||
| 7 | our $VERSION = 'v0.29.3'; | ||
| 8 | |||
| 9 | class CXC::Gnuplot::V1::Title : isa(CXC::Gnuplot::V1::Base) does( CXC::Gnuplot::V1::Role::Clone ); | ||
| 10 | |||
| 11 | use builtin 'is_bool', 'true'; | ||
| 12 | |||
| 13 | no namespace::clean; | ||
| 14 | |||
| 15 | use Ref::Util 'is_ref'; | ||
| 16 | |||
| 17 | use namespace::clean; | ||
| 18 | |||
| 19 | use CXC::Gnuplot::V1::Types | ||
| 20 | -lexical => 'NonEmptyStr', | ||
| 21 | 'CoordOffset3D', | ||
| 22 | 'SetFormats', | ||
| 23 | 'signature_for'; | ||
| 24 | |||
| 25 | use CXC::Gnuplot::V1::Util -lexical, 'maybe_quote', | ||
| 26 | 'pvalidate', 'to_hash_r', 'render_opts', 'render_set'; | ||
| 27 | |||
| 28 | my sub croak { | ||
| 29 | require Carp; | ||
| 30 | goto \&Carp::croak; | ||
| 31 | } | ||
| 32 | |||
| 33 | #<<< notidy | ||
| 34 | field $text :param :reader = undef; | ||
| 35 | field $offset :param :reader = undef; | ||
| 36 | field $font :param :reader = undef; | ||
| 37 | field $textcolor :param :reader = undef; | ||
| 38 | field $enhanced :param :reader = undef; | ||
| 39 | #>>> | ||
| 40 | |||
| 41 | |||
| 42 | |||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | |||
| 47 | |||
| 48 | |||
| 49 | |||
| 50 | |||
| 51 | |||
| 52 | |||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | |||
| 57 | |||
| 58 | |||
| 59 | ADJUST { | ||
| 60 | |||
| 61 | defined $offset | ||
| 62 | and pvalidate( offset => CoordOffset3D => \$offset ); | ||
| 63 | |||
| 64 | pvalidate( font => Font => \$font ); | ||
| 65 | |||
| 66 | pvalidate( textcolor => ColorSpec => \$textcolor ); | ||
| 67 | |||
| 68 | defined $enhanced | ||
| 69 | and !is_bool( $enhanced ) | ||
| 70 | and croak( q{invalid value for "enhanced" parameter; must be bool} ); | ||
| 71 | |||
| 72 | } | ||
| 73 | |||
| 74 | |||
| 75 | |||
| 76 | |||
| 77 | |||
| 78 | |||
| 79 | |||
| 80 | |||
| 81 | |||
| 82 | |||
| 83 | |||
| 84 | |||
| 85 | |||
| 86 | |||
| 87 | method BUILDARGS : common (@args ) { | ||
| 88 | return ( text => $args[0] ) if @args == 1 && !is_ref( $args[0] ); | ||
| 89 | return $class->SUPER::BUILDARGS( @args ); | ||
| 90 | } | ||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | |||
| 95 | |||
| 96 | |||
| 97 | |||
| 98 | |||
| 99 | |||
| 100 | method to_hash { | ||
| 101 | |||
| 102 | to_hash_r( { | ||
| 103 | ( defined $text ? ( text => $text ) : () ), | ||
| 104 | ( defined $offset ? ( offset => $offset ) : () ), | ||
| 105 | ( defined $font ? ( font => $font ) : () ), | ||
| 106 | ( defined $textcolor ? ( textcolor => $textcolor ) : () ), | ||
| 107 | ( defined $enhanced ? ( enhanced => $enhanced ) : () ), | ||
| 108 | } ); | ||
| 109 | |||
| 110 | } | ||
| 111 | |||
| 112 | |||
| 113 | |||
| 114 | |||
| 115 | |||
| 116 | |||
| 117 | method opts { | ||
| 118 | |||
| 119 | my @opts; | ||
| 120 | |||
| 121 | defined $text | ||
| 122 | and push @opts, maybe_quote( $text ); | ||
| 123 | |||
| 124 | |||
| 125 | push @opts, render_opts( offset => $offset ); | ||
| 126 | |||
| 127 | push @opts, render_opts( font => $font ); | ||
| 128 | |||
| 129 | push @opts, render_opts( textcolor => $textcolor ); | ||
| 130 | |||
| 131 | defined $enhanced | ||
| 132 | and push @opts, ( $enhanced ? 'enhanced' : 'noenhanced' ); | ||
| 133 | |||
| 134 | return @opts; | ||
| 135 | } | ||
| 136 | |||
| 137 | |||
| 138 | |||
| 139 | |||
| 140 | |||
| 141 | signature_for set => ( | ||
| 142 | method => 1, | ||
| 143 | named => [ | ||
| 144 | as => SetFormats, | ||
| 145 | { default => 'string' }, | ||
| 146 | ], | ||
| 147 | ); | ||
| 148 | |||
| 149 | method set ( $opt ) { | ||
| 150 | |||
| 151 | return render_set( [ render_opts( [ set => 'title' ], $self ) ], $opt->as ); | ||
| 152 | } | ||
| 153 | |||
| 154 | |||
| 155 | 1; | ||
| 156 | |||
| 157 | # | ||
| 158 | # This file is part of CXC-Gnuplot | ||
| 159 | # | ||
| 160 | # This software is Copyright (c) 2024 by Smithsonian Astrophysical Observatory. | ||
| 161 | # | ||
| 162 | # This is free software, licensed under: | ||
| 163 | # | ||
| 164 | # The GNU General Public License, Version 3, June 2007 | ||
| 165 | # | ||
| 166 | |||
| 167 | __END__ | ||