]> Dogcows Code - chaz/p5-File-KDBX/blob - lib/File/KDBX/Dumper/Raw.pm
Add function for creating class attributes
[chaz/p5-File-KDBX] / lib / File / KDBX / Dumper / Raw.pm
1 package File::KDBX::Dumper::Raw;
2 # ABSTRACT: A no-op dumper that dumps content as-is
3
4 use warnings;
5 use strict;
6
7 use File::KDBX::Util qw(:class);
8
9 extends 'File::KDBX::Dumper';
10
11 our $VERSION = '999.999'; # VERSION
12
13 sub _dump {
14 my $self = shift;
15 my $fh = shift;
16
17 $self->_write_body($fh);
18 }
19
20 sub _write_headers { '' }
21
22 sub _write_body {
23 my $self = shift;
24 my $fh = shift;
25
26 $self->_write_inner_body($fh);
27 }
28
29 sub _write_inner_body {
30 my $self = shift;
31 my $fh = shift;
32
33 $fh->print($self->kdbx->raw);
34 }
35
36 1;
37 __END__
38
39 =head1 SYNOPSIS
40
41 use File::KDBX::Dumper;
42 use File::KDBX;
43
44 my $kdbx = File::KDBX->new;
45 $kdbx->raw("Secret file contents\n");
46
47 $kdbx->dump_file('file.kdbx', $key, inner_format => 'Raw');
48 # OR
49 File::KDBX::Dumper->dump_file('file.kdbx', $key,
50 kdbx => $kdbx,
51 inner_format => 'Raw',
52 );
53
54 =head1 DESCRIPTION
55
56 A typical KDBX file is made up of an outer section (with headers) and an inner section (with the body). The
57 inner section is usually dumped using L<File::KDBX::Dumper::XML>, but you can use the
58 B<File::KDBX::Dumper::Raw> dumper to just write some arbitrary data as the body content. The result won't
59 necessarily be parseable by typical KeePass implementations, but it can be read back using
60 L<File::KDBX::Loader::Raw>. It's a way to encrypt any file with the same high level of security as a KDBX
61 database.
62
63 =cut
This page took 0.032815 seconds and 4 git commands to generate.