NAME

PDK::Content::Role - A Moose role for content parsing and management

SYNOPSIS

package MyContentParser;
use Moose;
with 'PDK::Content::Role';

# Implement required methods
sub config { ... }
sub confContent { ... }
sub cursor { ... }
sub goToHead { ... }
sub nextLine { ... }
sub prevLine { ... }
sub nextUnParsedLine { ... }
sub moveBack { ... }
sub ignore { ... }
sub getUnParsedLines { ... }

DESCRIPTION

PDK::Content::Role is a Moose role that defines a common interface for content parsing and management. It provides a set of attributes and required methods that implementing classes must define to handle configuration content effectively.

ATTRIBUTES

id

An integer representing the unique identifier of the content. This attribute is required and read-only.

name

A string representing the name of the content, used for display and identification. This attribute is required and read-only.

type

A string representing the type or category of the content. This attribute is required and read-only.

sign

A string representing the configuration signature, used to verify the integrity of the content. This attribute is required and read-only.

timestamp

A string representing the timestamp of when the content was created or modified. This attribute is required and read-only.

lineParsedFlags

An arrayref of integers representing the parse status of each line in the content. It is built using the _buildLineParsedFlags method, which must be implemented by the consuming class.

debug

An integer representing the debug level, used to control the output of debug information. This attribute is optional and read-only.

REQUIRED METHODS

The following methods must be implemented by any class consuming this role:

config

Method to get or set the configuration.

confContent

Method to get the configuration content as text.

cursor

Method to get or set the current parsing position.

goToHead

Method to reset the parsing position to the beginning.

nextLine

Method to move to the next line and return its content.

prevLine

Method to move to the previous line and return its content.

nextUnParsedLine

Method to find and return the next unparsed line, skipping already parsed lines.

moveBack

Method to return to the previous parsing position.

ignore

Method to skip the current line.

getUnParsedLines

Method to return all unparsed lines.

AUTHOR

WENWU YAN <968828@gmail.com>

LICENSE

This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.