Skip to content

Commit 3efd21f

Browse files
committed
Install eds2xdd script alongside module
1 parent 3fe493b commit 3efd21f

File tree

6 files changed

+103
-49
lines changed

6 files changed

+103
-49
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@
33
.DS_Store
44
Convert-EDS-XDD-*/
55
Convert-EDS-XDD-*.tar.gz
6-
eds2xdd
76
fatlib/
8-

README.pod

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,37 @@ Convert::EDS::XDD - Convert CANopen EDS to POWERLINK XDD
88

99
=head1 SYNOPSIS
1010

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

1314
=head1 DESCRIPTION
1415

1516
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.
1617

17-
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>.
18+
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>.
19+
20+
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>.
1821

1922
=head1 LIMITATIONS
2023

21-
May not handle all details of the EDS. Pull requests and reports (issues on Github) welcome.
24+
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.
2225

2326
=head1 METHODS AND ARGUMENTS
2427

2528
=over 4
2629

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

29-
Here, the [] indicate an optional parameter.
32+
Here, the C<[]> indicate an optional parameter.
3033

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

3336
Function croaks if opening file fails.
3437

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

38-
Do not add a prefix to $encoding, such as '<' or '<:'.
41+
Do not add a prefix to C<$encoding>, such as C<< '<' >> or C<< '<:' >>.
3942

4043
=item eds2xdd_string($string)
4144

@@ -57,7 +60,7 @@ Ahmad Fatoum C<< <athreef@cpan.org> >>, L<http://a3f.at>
5760

5861
=head1 COPYRIGHT AND LICENSE
5962

60-
Copyright (C) 2017 Ahmad Fatoum
63+
Copyright (C) 2017-2018 Ahmad Fatoum
6164

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

bin/eds2xdd

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!perl
2+
use strict;
3+
use warnings;
4+
# VERSION
5+
6+
use Getopt::Std;
7+
use Convert::EDS::XDD qw(eds2xdd_string);
8+
9+
$Getopt::Std::STANDARD_HELP_VERSION = 1;
10+
11+
getopts '', \my %opts;
12+
13+
local $/;
14+
while (<>) {
15+
print eds2xdd_string $_;
16+
}
17+
18+
sub VERSION_MESSAGE() { print "Convert::EDS::XDD v$Convert::EDS::XDD::VERSION\n"; }
19+
sub HELP_MESSAGE() {
20+
print <<"EOT"
21+
Usage: $0 [eds_file]
22+
echo 'eds_content' | $0
23+
24+
Opens files passed as arguments and writes them to stdout as XDD.
25+
If there are no arguments, stdin is read
26+
EOT
27+
}
28+
29+
=pod
30+
31+
=head1 NAME
32+
33+
eds2xdd - Command-line utility for L<Convert::EDS::XDD>
34+
35+
=head1 SYNOPSIS
36+
37+
$ cpan Convert::EDS::XDD # install from CPAN
38+
$ eds2xdd profile.eds > profile.xdd # Convert with the eds2xdd script
39+
40+
=head1 DESCRIPTION
41+
42+
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.
43+
44+
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>.
45+
46+
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>.
47+
48+
=head1 LIMITATIONS
49+
50+
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.
51+
52+
=head1 GIT REPOSITORY
53+
54+
L<http://github.com/epl-viz/Convert-EDS-XDD>
55+
56+
=head1 SEE ALSO
57+
58+
L<EPL-Viz - Visualization for Ethernet POWERLINK|http://github.com/epl-viz>
59+
60+
=head1 AUTHOR
61+
62+
Ahmad Fatoum C<< <athreef@cpan.org> >>, L<http://a3f.at>
63+
64+
=head1 COPYRIGHT AND LICENSE
65+
66+
Copyright (C) 2017-2018 Ahmad Fatoum
67+
68+
This library is free software; you can redistribute it and/or modify
69+
it under the same terms as Perl itself.

dist.ini

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ name = Convert-EDS-XDD
22
author = Ahmad Fatoum <athreef@cpan.org>
33
license = Perl_5
44
copyright_holder = Ahmad Fatoum
5-
copyright_year = 2017
5+
copyright_year = 2018
66

77
[@Starter]
88

99
[AutoPrereqs]
10+
[MetaProvides::Package]
1011

1112
[GithubMeta]
1213
issues = 1
13-
user = athreef
14+
user = epl-viz
1415
[@Git]
1516
[Git::Init]
16-
remote = origin git@github.com:athreef/%N.git
17+
remote = origin git@github.com:epl-viz/%N.git
1718
[Git::NextVersion]
1819
[ChangelogFromGit]
1920
[OurPkgVersion]
@@ -23,3 +24,10 @@ type = pod
2324
filename = README.pod
2425
location = root
2526

27+
[Test::MinimumVersion]
28+
max_target_perl = 5.10
29+
[MinimumPerlFast]
30+
[Test::Perl::Critic]
31+
[Test::Version]
32+
[Test::NoTabs]
33+
[Test::EOL]

eds2xdd.pl

Lines changed: 0 additions & 27 deletions
This file was deleted.

lib/Convert/EDS/XDD.pm

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,20 @@ Convert::EDS::XDD - Convert CANopen EDS to POWERLINK XDD
2626
2727
=head1 SYNOPSIS
2828
29-
perl -MConvert::EDS::XDD=eds2xdd -e "print eds2xdd 'profile.eds'" > profile.xdd
29+
$ cpan Convert::EDS::XDD # install from CPAN
30+
$ eds2xdd profile.eds > profile.xdd # Convert with the eds2xdd script
3031
3132
=head1 DESCRIPTION
3233
3334
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.
3435
35-
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>.
36+
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>.
37+
38+
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>.
3639
3740
=head1 LIMITATIONS
3841
39-
May not handle all details of the EDS. Pull requests and reports (issues on Github) welcome.
42+
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.
4043
4144
=cut
4245

@@ -82,16 +85,16 @@ sub _extract {
8285
8386
=item eds2xdd($filename, [$encoding])
8487
85-
Here, the [] indicate an optional parameter.
88+
Here, the C<[]> indicate an optional parameter.
8689
8790
Returns the EDS' content as XML string on success or undef on error in file contents.
8891
8992
Function croaks if opening file fails.
9093
91-
$encoding may be used to indicate the encoding of the file, e.g. 'utf8' or
92-
'encoding(iso-8859-1)'.
94+
C<$encoding> may be used to indicate the encoding of the file, e.g. C<'utf8'> or
95+
C<'encoding(iso-8859-1)'>.
9396
94-
Do not add a prefix to $encoding, such as '<' or '<:'.
97+
Do not add a prefix to C<$encoding>, such as C<< '<' >> or C<< '<:' >>.
9598
9699
=cut
97100

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

110113
croak "Reading from '$file' returned undef" unless defined $contents;
111-
eds2xdd_string($contents) or return undef;
114+
eds2xdd_string($contents) or return;
112115
};
113116

114117
my $template = do {
@@ -285,7 +288,7 @@ Ahmad Fatoum C<< <athreef@cpan.org> >>, L<http://a3f.at>
285288
286289
=head1 COPYRIGHT AND LICENSE
287290
288-
Copyright (C) 2017 Ahmad Fatoum
291+
Copyright (C) 2017-2018 Ahmad Fatoum
289292
290293
This library is free software; you can redistribute it and/or modify
291294
it under the same terms as Perl itself.

0 commit comments

Comments
 (0)