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