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