our
$VERSION
=
'3.027'
;
our
$LAST_UPDATE
=
'3.027'
;
sub
new {
my
(
$class
,
@opts
) =
@_
;
my
(
$self
);
$class
=
ref
(
$class
)
if
ref
(
$class
);
$self
=
$class
->SUPER::new(
@_
);
$self
->{
' realised'
} = 1;
if
(
scalar
@opts
> 1) {
$self
->{
'-isdict'
} = 1;
my
%opt
=
@opts
;
foreach
my
$k
(
keys
%opt
) {
$self
->{
$k
} =
$opt
{
$k
};
}
}
elsif
(
scalar
@opts
== 1) {
$self
->{
'-literal'
} =
$opts
[0];
}
return
$self
;
}
sub
outobjdeep {
my
(
$self
,
$fh
,
$pdf
) =
@_
;
if
(
$self
->{
'-isdict'
}) {
if
(
defined
$self
->{
' stream'
}) {
$self
->{
'Length'
} =
length
(
$self
->{
' stream'
}) + 1;
}
else
{
delete
$self
->{
'Length'
};
}
$fh
->
print
(
"<< "
);
foreach
my
$k
(
sort
keys
%{
$self
}) {
next
if
$k
=~m|^[ \-]|o;
$fh
->
print
(
'/'
.PDF::Builder::Basic::PDF::Name::string_to_name(
$k
).
' '
);
if
(
ref
(
$self
->{
$k
}) eq
'ARRAY'
) {
$fh
->
print
(
'['
.
join
(
' '
,@{
$self
->{
$k
}}) .
"]\n"
);
}
elsif
(
ref
(
$self
->{
$k
}) eq
'HASH'
) {
$fh
->
print
(
'<<'
.
join
(
' '
,
map
{
'/'
.PDF::Builder::Basic::PDF::Name::string_to_name(
$_
) .
' '
.
$self
->{
$k
}->{
$_
} }
sort
keys
%{
$self
->{
$k
}}) .
" >>\n"
);
}
elsif
(blessed(
$self
->{
$k
}) and
$self
->{
$k
}->can(
'outobj'
)) {
$self
->{
$k
}->outobj(
$fh
,
$pdf
);
$fh
->
print
(
"\n"
);
}
else
{
$fh
->
print
(
"$self->{$k}\n"
);
}
}
$fh
->
print
(
">>\n"
);
if
(
defined
$self
->{
' stream'
}) {
$fh
->
print
(
"stream\n$self->{' stream'}\nendstream"
);
}
}
else
{
$fh
->
print
(
$self
->{
'-literal'
});
}
return
;
}
sub
val {
return
$_
[0]; }
1;