line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Convert::PerlRef2String;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
29502
|
use 5.008003;
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
40
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
5
|
1
|
|
|
1
|
|
107
|
use warnings;
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
49
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter;
|
8
|
1
|
|
|
1
|
|
2482
|
use AutoLoader qw(AUTOLOAD);
|
|
1
|
|
|
|
|
2131
|
|
|
1
|
|
|
|
|
8
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
44
|
use vars qw(@ISA @EXPORT @EXPORT_OK);
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
120
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @ISA = qw(Exporter);
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export
|
15
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead.
|
16
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants.
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# This allows declaration use Convert::PerlRef2String ':all';
|
19
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
|
20
|
|
|
|
|
|
|
# will save memory.
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
@EXPORT = qw(perlref2string string2perlref string2perlcode);
|
23
|
|
|
|
|
|
|
@EXPORT_OK = qw(perlref2string string2perlref string2perlcode);
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our $VERSION = '0.03';
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Preloaded methods go here.
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program.
|
31
|
1
|
|
|
1
|
|
1184
|
use MIME::Base64;
|
|
1
|
|
|
|
|
1068
|
|
|
1
|
|
|
|
|
259
|
|
32
|
1
|
|
|
1
|
|
3226
|
use Compress::Zlib;
|
|
1
|
|
|
|
|
116681
|
|
|
1
|
|
|
|
|
342
|
|
33
|
1
|
|
|
1
|
|
4023
|
use Data::Dumper;
|
|
1
|
|
|
|
|
12111
|
|
|
1
|
|
|
|
|
424
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub perlref2string {
|
36
|
0
|
|
|
0
|
0
|
|
my $perlref = shift;
|
37
|
0
|
0
|
|
|
|
|
die "Argument undefined" unless(defined $perlref);
|
38
|
0
|
|
|
|
|
|
my ($string,$zipped,$encoded);
|
39
|
0
|
0
|
|
|
|
|
if(ref $perlref){
|
40
|
0
|
|
|
|
|
|
eval{$string = Dumper($perlref);};
|
|
0
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
die $! if($@);
|
42
|
|
|
|
|
|
|
}else{
|
43
|
0
|
|
|
|
|
|
$string = $perlref;
|
44
|
|
|
|
|
|
|
}
|
45
|
0
|
|
|
|
|
|
eval{$zipped = Compress::Zlib::memGzip($string);};
|
|
0
|
|
|
|
|
|
|
46
|
0
|
0
|
|
|
|
|
die $! if($@);
|
47
|
0
|
|
|
|
|
|
eval{$encoded = encode_base64($zipped);};
|
|
0
|
|
|
|
|
|
|
48
|
0
|
0
|
|
|
|
|
die $! if($@);
|
49
|
0
|
|
|
|
|
|
return $encoded;
|
50
|
|
|
|
|
|
|
}
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub string2perlref {
|
53
|
0
|
|
|
0
|
0
|
|
my $string = shift;
|
54
|
0
|
0
|
|
|
|
|
return unless(defined $string);
|
55
|
0
|
|
|
|
|
|
my($decoded,$perlref,$VAR1);
|
56
|
0
|
|
|
|
|
|
eval{$decoded = decode_base64($string);};
|
|
0
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
die $! if($@);
|
58
|
0
|
|
|
|
|
|
$perlref = eval($VAR1 = Compress::Zlib::memGunzip($decoded));
|
59
|
0
|
0
|
|
|
|
|
die $! if($@);
|
60
|
0
|
|
|
|
|
|
return $perlref;
|
61
|
|
|
|
|
|
|
}
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub string2perlcode {
|
64
|
0
|
|
|
0
|
0
|
|
my $string = shift;
|
65
|
0
|
0
|
|
|
|
|
return unless(defined $string);
|
66
|
0
|
|
|
|
|
|
my($decoded,$perlcode);
|
67
|
0
|
|
|
|
|
|
eval{$decoded = decode_base64($string);};
|
|
0
|
|
|
|
|
|
|
68
|
0
|
0
|
|
|
|
|
die $! if($@);
|
69
|
0
|
|
|
|
|
|
eval {$perlcode = Compress::Zlib::memGunzip($decoded);};
|
|
0
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
die $! if($@);
|
71
|
0
|
|
|
|
|
|
return $perlcode;
|
72
|
|
|
|
|
|
|
}
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1;
|
75
|
|
|
|
|
|
|
__END__
|