QML::File - Basic parsing of the high-level structure of QML files.
use QML::File my $parser = new QML::File('main.qml'); my @imports = $parser->imports; foreach my $import (@imports) { print "Found import of $import->{name} on line $import->{lineNum}\n"; } my $objectType = $parser->objectType; my $id = $parser->id my @properties = $parser->propertyDeclarations; my @signals = $parser->signalDeclarations; my @functions = $parser->javaScriptFunctions; my @objectProperties = $parser->objectProperties; my @childObjects = $parser->childObjects;
This module parses QML files at a very high level, allowing you to determine basic information like the signals, properties, functions, and child objects defined in the QML file.
use QML::File; my $file = new QML::File('Filename.qml');
Returns a newly created QML::File object for the specified QML file.
QML::File
Returns a list of child objects. Each element in the returned array is a hash of the form:
my $child = {type => $childType, line => $line, lineNum => $lineNum};
Returns the ID of the main component.
my @imports = $parser->imports;
Returns the list of imports defined in the file. Each element in the returned array is a hash of the form:
my $fileImport = {filename => $filename, line => $line, lineNum => $lineNum};
or
my $namedImport = {name => $name, line => $line, lineNum => $lineNum};
depending on the type of import.
Returns an array of Javascript functions defined in the QML component. Each element in the returned array is a hash of the form:
my $function = {name => $functionName, line => $line, lineNum => $lineNum};
Returns the name of the QML component defined by the QML file.
Returns an array of object properties assigned. Each element in the returned array is a hash of the form:
my $objectProperty = {name => $name, line => $line, lineNum => $lineNum};
Returns the type of the main component defined in the QML file.
Returns an array of property declarations. Each element in the returned array is a hash of the form:
my $property = {name => $name, line => $line, lineNum => $lineNum};
Returns an array of signal declarations. Each element in the returned array is a hash of the form:
my $signal = {name => $name, line => $line, lineNum => $lineNum};
check_qml.pl - Checks a QML file for coding conventions described at http://doc.qt.digia.com/qt/qml-coding-conventions.html
check_qml.pl
Zachary Blair, <zblair@cpan.org>
Copyright (C) 2013 by Zachary Blair
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
To install QML::File, copy and paste the appropriate command in to your terminal.
cpanm
cpanm QML::File
CPAN shell
perl -MCPAN -e shell install QML::File
For more information on module installation, please visit the detailed CPAN module installation guide.