/usr/share/perl5/CQL/PrefixNode.pm is in libcql-parser-perl 1.12-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | package CQL::PrefixNode;
use strict;
use warnings;
use base qw( CQL::Node );
use CQL::Prefix;
use Carp qw( croak );
=head1 NAME
CQL::PrefixNode - represents a prefix node in a CQL parse tree
=head1 SYNOPSIS
use CQL::PrefixNode;
my $prefix = CQL::PrefixNode->new(
name => '',
identifier => '',
subtree => $node
);
=head1 DESCRIPTION
=head1 METHODS
=head2 new()
Creates a new CQL::PrefixNode inducing a mapping from the
specified qualifier-set name to the specified identifier across
the specified subtree.
=cut
sub new {
my ($class,%opts) = @_;
croak( 'must supply name' ) if ! exists $opts{name};
croak( 'must supply identifier' ) if ! exists $opts{identifier};
croak( 'must supply subtree' ) if ! exists $opts{subtree};
my $prefix = CQL::Prefix->new(
name => $opts{name},
identifier => $opts{identifier}
);
my $self = {
prefix => $prefix,
subtree => $opts{subtree}
};
return bless $self, ref($class) || $class;
}
=head2 getPrefix()
=cut
sub getPrefix {
return shift->{prefix};
}
=head2 getSubtree()
=cut
sub getSubtree {
return shift->{subtree};
}
=head2 toCQL()
=cut
sub toCQL {
my $self = shift;
my $prefix = $self->getPrefix();
my $subtree = $self->getSubtree();
return ">" . $prefix->getName() . '="' . $prefix->getIdentifier() . '" ' .
'(' . $subtree->toCQL() . ')';
}
=head2 toXCQL()
=cut
sub toXCQL {
my ($self,$level,@prefixes) = @_;
$level = 0 if ! $level;
push( @prefixes, $self->getPrefix() );
my $xml = $self->getSubtree()->toXCQL( $level, @prefixes );
return $self->addNamespace( $level, $xml );
}
1;
|