Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CentralNic
pepper
Commits
e33eeecb
Unverified
Commit
e33eeecb
authored
Mar 30, 2017
by
Gavin Brown
Browse files
use our pretty printer
parent
e052f109
Changes
1
Hide whitespace changes
Inline
Side-by-side
pepper
View file @
e33eeecb
...
...
@@ -2,16 +2,26 @@
#
Copyright
CentralNic
Group
plc
.
#
This
program
is
Free
Software
;
you
can
use
it
and
/
or
modify
it
under
the
same
#
terms
as
Perl
itself
.
#
#
Pepper
::
EPPClient
is
our
own
wrapper
around
Net
::
EPP
::
Simple
#
package
Pepper
::
EPPClient
;
use
base
qw
(
Net
::
EPP
::
Simple
);
use
Data
::
Dumper
;
use
XML
::
Parser
;
use
strict
;
sub
new
{
my
($
package
,
%
params
)
=
@
_
;
my
$
self
=
$
package
->
SUPER
::
new
(%
params
);
$
self
->{
'outfh'
}
=
$
params
{
'outfh'
};
$
self
->{
'outfh'
}
=
$
Pepper
::
Higlighter
::
fh
=
$
params
{
'outfh'
};
$
self
->{
'pretty_parser'
}
=
XML
::
Parser
->
new
(
'Style'
=>
'Stream'
,
'Pkg'
=>
'Pepper::Higlighter'
,
);
return
$
self
;
}
...
...
@@ -19,14 +29,14 @@ sub new {
sub
get_frame
{
my
$
self
=
shift
;
my
$
response
=
$
self
->
SUPER
::
get_frame
;
map
{
$
self
->{
'
outfh'
}->
print
(
sprintf
(
"S: %s
\n
"
,
$
_
))
}
split
(/\
n
/,
$
response
->
toString
(
2
))
if
(
!$self->{'quiet'} && $response);
$
self
->{
'
pretty_parser'
}->
parse
(
$
response
->
toString
(
2
))
if
(
!$self->{'quiet'} && $response
&& ($response->isa('XML::LibXML::Document') || $response->isa('Net::EPP::Frame::Response'))
);
return
$
response
;
}
sub
send_frame
{
my
($
self
,
$
frame
,
$
wfcheck
)
=
@
_
;
map
{
$
self
->{
'
outfh'
}->
print
(
sprintf
(
"C: %s
\n
"
,
$
_
))
}
split
(/\
n
/,
$
frame
->
isa
(
'XML::LibXML::Document'
)
?
$
frame
->
toString
(
2
)
:
$
frame
)
unless
($
self
->{
'quiet'
}
);
;
$
self
->{
'
pretty_parser'
}->
parse
($
frame
->
toString
(
2
))
if
(
!$self->{'quiet'} && (
$frame->isa('XML::LibXML::Document')
||
$frame->
isa('Net::EPP::Frame'))
);
return
$
self
->
SUPER
::
send_frame
($
frame
,
$
wfcheck
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment