]> Dogcows Code - chaz/p5-File-KDBX/blob - lib/File/KDBX/Loader/Raw.pm
Simplify attribute generation
[chaz/p5-File-KDBX] / lib / File / KDBX / Loader / Raw.pm
1 package File::KDBX::Loader::Raw;
2 # ABSTRACT: A no-op loader that doesn't do any parsing
3
4 use warnings;
5 use strict;
6
7 use File::KDBX::Util qw(:class);
8 use namespace::clean;
9
10 extends 'File::KDBX::Loader';
11
12 our $VERSION = '999.999'; # VERSION
13
14 sub _read {
15 my $self = shift;
16 my $fh = shift;
17
18 $self->_read_body($fh);
19 }
20
21 sub _read_body {
22 my $self = shift;
23 my $fh = shift;
24
25 $self->_read_inner_body($fh);
26 }
27
28 sub _read_inner_body {
29 my $self = shift;
30 my $fh = shift;
31
32 my $content = do { local $/; <$fh> };
33 $self->kdbx->raw($content);
34 }
35
36 1;
37 __END__
38
39 =head1 SYNOPSIS
40
41 use File::KDBX::Loader;
42
43 my $kdbx = File::KDBX::Loader->load_file('file.kdbx', $key, inner_format => 'Raw');
44 print $kdbx->raw;
45
46 =head1 DESCRIPTION
47
48 A typical KDBX file is made up of an outer section (with headers) and an inner section (with the body). The
49 inner section is usually loaded using L<File::KDBX::Loader::XML>, but you can use the
50 B<File::KDBX::Loader::Raw> loader to not parse the body at all and just get the raw body content. This can be
51 useful for debugging or creating KDBX files with arbitrary content (see L<File::KDBX::Dumper::Raw>).
52
53 =cut
This page took 0.032985 seconds and 4 git commands to generate.