Skip to content

Commit

Permalink
Install eds2xdd script alongside module
Browse files Browse the repository at this point in the history
  • Loading branch information
a3f committed Jan 14, 2018
1 parent 3fe493b commit 3efd21f
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 49 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
.DS_Store
Convert-EDS-XDD-*/
Convert-EDS-XDD-*.tar.gz
eds2xdd
fatlib/

19 changes: 11 additions & 8 deletions README.pod
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,37 @@ Convert::EDS::XDD - Convert CANopen EDS to POWERLINK XDD

=head1 SYNOPSIS

perl -MConvert::EDS::XDD=eds2xdd -e "print eds2xdd 'profile.eds'" > profile.xdd
$ cpan Convert::EDS::XDD # install from CPAN
$ eds2xdd profile.eds > profile.xdd # Convert with the eds2xdd script

=head1 DESCRIPTION

EDS is an L<ini|Config::Tiny> based format specified by the CiA e.V. in order to describe CANopen devices. The Ethernet POWERLINK Standardization Group specifies an EDS-based L<XML|XML::Writer> format for EPL devices.

This module Takes in an EDS file or a string with its content and returns a XDD string. A self-contained (fatpacked) C<epl2xdd> script is available L<at the Github releases page|https://github.com/epl-viz/Convert-EDS-XDD/releases/latest>.
This module takes in an EDS file or a string with its content and returns a XDD string. An L<eds2xdd> wrapper script is also installed into the C<PATH>.

C<eds2xdd> is also available as a self-contained (fatpacked) script L<at the Github releases page|https://github.com/epl-viz/Convert-EDS-XDD/releases/latest>.

=head1 LIMITATIONS

May not handle all details of the EDS. Pull requests and reports (issues on Github) welcome.
May not handle all details of the EDS. Pull requests and reports (L<issues on Github|https://github.com/epl-viz/Convert-EDS-XDD/issues>) are welcome.

=head1 METHODS AND ARGUMENTS

=over 4

=item eds2xdd($filename, [$encoding])

Here, the [] indicate an optional parameter.
Here, the C<[]> indicate an optional parameter.

Returns the EDS' content as XML string on success or undef on error in file contents.

Function croaks if opening file fails.

$encoding may be used to indicate the encoding of the file, e.g. 'utf8' or
'encoding(iso-8859-1)'.
C<$encoding> may be used to indicate the encoding of the file, e.g. C<'utf8'> or
C<'encoding(iso-8859-1)'>.

Do not add a prefix to $encoding, such as '<' or '<:'.
Do not add a prefix to C<$encoding>, such as C<< '<' >> or C<< '<:' >>.

=item eds2xdd_string($string)

Expand All @@ -57,7 +60,7 @@ Ahmad Fatoum C<< <[email protected]> >>, L<http://a3f.at>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2017 Ahmad Fatoum
Copyright (C) 2017-2018 Ahmad Fatoum

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
Expand Down
69 changes: 69 additions & 0 deletions bin/eds2xdd
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!perl
use strict;
use warnings;
# VERSION

use Getopt::Std;
use Convert::EDS::XDD qw(eds2xdd_string);

$Getopt::Std::STANDARD_HELP_VERSION = 1;

getopts '', \my %opts;

local $/;
while (<>) {
print eds2xdd_string $_;
}

sub VERSION_MESSAGE() { print "Convert::EDS::XDD v$Convert::EDS::XDD::VERSION\n"; }
sub HELP_MESSAGE() {
print <<"EOT"
Usage: $0 [eds_file]
echo 'eds_content' | $0

Opens files passed as arguments and writes them to stdout as XDD.
If there are no arguments, stdin is read
EOT
}

=pod

=head1 NAME

eds2xdd - Command-line utility for L<Convert::EDS::XDD>

=head1 SYNOPSIS

$ cpan Convert::EDS::XDD # install from CPAN
$ eds2xdd profile.eds > profile.xdd # Convert with the eds2xdd script

=head1 DESCRIPTION

EDS is an L<ini|Config::Tiny> based format specified by the CiA e.V. in order to describe CANopen devices. The Ethernet POWERLINK Standardization Group specifies an EDS-based L<XML|XML::Writer> format for EPL devices.

This module takes in an EDS file or a string with its content and returns a XDD string. An L<eds2xdd> script (this one here) is also installed into the C<PATH>.

C<eds2xdd> is also available as a self-contained (fatpacked) script L<at the Github releases page|https://github.com/epl-viz/Convert-EDS-XDD/releases/latest>.

=head1 LIMITATIONS

May not handle all details of the EDS. Pull requests and reports (L<issues on Github|https://github.com/epl-viz/Convert-EDS-XDD/issues>) are welcome.

=head1 GIT REPOSITORY

L<http://github.com/epl-viz/Convert-EDS-XDD>

=head1 SEE ALSO

L<EPL-Viz - Visualization for Ethernet POWERLINK|http://github.com/epl-viz>

=head1 AUTHOR

Ahmad Fatoum C<< <[email protected]> >>, L<http://a3f.at>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2017-2018 Ahmad Fatoum

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
14 changes: 11 additions & 3 deletions dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ name = Convert-EDS-XDD
author = Ahmad Fatoum <[email protected]>
license = Perl_5
copyright_holder = Ahmad Fatoum
copyright_year = 2017
copyright_year = 2018

[@Starter]

[AutoPrereqs]
[MetaProvides::Package]

[GithubMeta]
issues = 1
user = athreef
user = epl-viz
[@Git]
[Git::Init]
remote = origin [email protected]:athreef/%N.git
remote = origin [email protected]:epl-viz/%N.git
[Git::NextVersion]
[ChangelogFromGit]
[OurPkgVersion]
Expand All @@ -23,3 +24,10 @@ type = pod
filename = README.pod
location = root

[Test::MinimumVersion]
max_target_perl = 5.10
[MinimumPerlFast]
[Test::Perl::Critic]
[Test::Version]
[Test::NoTabs]
[Test::EOL]
27 changes: 0 additions & 27 deletions eds2xdd.pl

This file was deleted.

21 changes: 12 additions & 9 deletions lib/Convert/EDS/XDD.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,20 @@ Convert::EDS::XDD - Convert CANopen EDS to POWERLINK XDD
=head1 SYNOPSIS
perl -MConvert::EDS::XDD=eds2xdd -e "print eds2xdd 'profile.eds'" > profile.xdd
$ cpan Convert::EDS::XDD # install from CPAN
$ eds2xdd profile.eds > profile.xdd # Convert with the eds2xdd script
=head1 DESCRIPTION
EDS is an L<ini|Config::Tiny> based format specified by the CiA e.V. in order to describe CANopen devices. The Ethernet POWERLINK Standardization Group specifies an EDS-based L<XML|XML::Writer> format for EPL devices.
This module Takes in an EDS file or a string with its content and returns a XDD string. A self-contained (fatpacked) C<epl2xdd> script is available L<at the Github releases page|https://github.com/epl-viz/Convert-EDS-XDD/releases/latest>.
This module takes in an EDS file or a string with its content and returns a XDD string. An L<eds2xdd> wrapper script is also installed into the C<PATH>.
C<eds2xdd> is also available as a self-contained (fatpacked) script L<at the Github releases page|https://github.com/epl-viz/Convert-EDS-XDD/releases/latest>.
=head1 LIMITATIONS
May not handle all details of the EDS. Pull requests and reports (issues on Github) welcome.
May not handle all details of the EDS. Pull requests and reports (L<issues on Github|https://github.com/epl-viz/Convert-EDS-XDD/issues>) are welcome.
=cut

Expand Down Expand Up @@ -82,16 +85,16 @@ sub _extract {
=item eds2xdd($filename, [$encoding])
Here, the [] indicate an optional parameter.
Here, the C<[]> indicate an optional parameter.
Returns the EDS' content as XML string on success or undef on error in file contents.
Function croaks if opening file fails.
$encoding may be used to indicate the encoding of the file, e.g. 'utf8' or
'encoding(iso-8859-1)'.
C<$encoding> may be used to indicate the encoding of the file, e.g. C<'utf8'> or
C<'encoding(iso-8859-1)'>.
Do not add a prefix to $encoding, such as '<' or '<:'.
Do not add a prefix to C<$encoding>, such as C<< '<' >> or C<< '<:' >>.
=cut

Expand All @@ -108,7 +111,7 @@ sub eds2xdd {
close($eds);

croak "Reading from '$file' returned undef" unless defined $contents;
eds2xdd_string($contents) or return undef;
eds2xdd_string($contents) or return;
};

my $template = do {
Expand Down Expand Up @@ -285,7 +288,7 @@ Ahmad Fatoum C<< <[email protected]> >>, L<http://a3f.at>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2017 Ahmad Fatoum
Copyright (C) 2017-2018 Ahmad Fatoum
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
Expand Down

0 comments on commit 3efd21f

Please sign in to comment.