| 1 | package MToken::DeviceSkel; # $Id: DeviceSkel.pm 101 2021-10-09 18:57:43Z minus $ | ||
| 2 | use strict; | ||
| 3 | use utf8; | ||
| 4 | |||
| 5 | =encoding utf8 | ||
| 6 | |||
| 7 | =head1 NAME | ||
| 8 | |||
| 9 | MToken::DeviceSkel - Internal helper's methods for MToken | ||
| 10 | |||
| 11 | =head1 VIRSION | ||
| 12 | |||
| 13 | Version 1.01 | ||
| 14 | |||
| 15 | =head1 SYNOPSIS | ||
| 16 | |||
| 17 | none | ||
| 18 | |||
| 19 | =head1 DESCRIPTION | ||
| 20 | |||
| 21 | Internal helper's methods for MToken | ||
| 22 | |||
| 23 | no public methods | ||
| 24 | |||
| 25 | =head2 build, dirs, pool | ||
| 26 | |||
| 27 | Main methods. For internal use only | ||
| 28 | |||
| 29 | =head1 SEE ALSO | ||
| 30 | |||
| 31 | L<MToken>, L<CTK::Skel> | ||
| 32 | |||
| 33 | =head1 AUTHOR | ||
| 34 | |||
| 35 | Serż Minus (Sergey Lepenkov) L<http://www.serzik.com> E<lt>abalama@cpan.orgE<gt> | ||
| 36 | |||
| 37 | =head1 COPYRIGHT | ||
| 38 | |||
| 39 | Copyright (C) 1998-2021 D&D Corporation. All Rights Reserved | ||
| 40 | |||
| 41 | =head1 LICENSE | ||
| 42 | |||
| 43 | This program is free software; you can redistribute it and/or | ||
| 44 | modify it under the same terms as Perl itself. | ||
| 45 | |||
| 46 | See C<LICENSE> file and L<https://dev.perl.org/licenses/> | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | use constant SIGNATURE => "device"; | ||
| 51 | |||
| 52 | use vars qw/ $VERSION /; | ||
| 53 | $VERSION = '1.01'; | ||
| 54 | |||
| 55 | use MToken::Const qw/DIR_PRIVATE DEVICE_CONF_FILE DEVICE_MANIFEST_FILE DB_FILE/; | ||
| 56 | |||
| 57 | sub build { # Building | ||
| 58 | my $self = shift; | ||
| 59 | |||
| 60 | my $rplc = $self->{rplc}; | ||
| 61 | $rplc->{TODO} = "TODO"; | ||
| 62 | $rplc->{ENDSIGN} = "__END__"; # END signature | ||
| 63 | $rplc->{DIR_PRIVATE} = DIR_PRIVATE; | ||
| 64 | $rplc->{DEVICE_CONF_FILE} = DEVICE_CONF_FILE; | ||
| 65 | $rplc->{DEVICE_MANIFEST_FILE} = DEVICE_MANIFEST_FILE; | ||
| 66 | $rplc->{DB_FILE} = DB_FILE; | ||
| 67 | |||
| 68 | $self->maybe::next::method(); | ||
| 69 | return 1; | ||
| 70 | } | ||
| 71 | sub dirs { # Directories and permissions as array of hashs | ||
| 72 | my $self = shift; | ||
| 73 | $self->{subdirs}{(SIGNATURE)} = [ | ||
| 74 | { | ||
| 75 | path => DIR_PRIVATE, | ||
| 76 | mode => 0755, | ||
| 77 | }, | ||
| 78 | ]; | ||
| 79 | $self->maybe::next::method(); | ||
| 80 | return 1; | ||
| 81 | } | ||
| 82 | sub pool { # Multipart pool of files | ||
| 83 | my $self = shift; | ||
| 84 | my $pos = tell DATA; | ||
| 85 | my $data = scalar(do { local $/; <DATA> }); | ||
| 86 | seek DATA, $pos, 0; | ||
| 87 | $self->{pools}{(SIGNATURE)} = $data; | ||
| 88 | $self->maybe::next::method(); | ||
| 89 | return 1; | ||
| 90 | } | ||
| 91 | |||
| 92 | 1; | ||
| 93 | |||
| 94 | __DATA__ |