ntruchsess / perl-firmata

Perl implementation of the firmata client. Originally authored by Aki Mimoto (amimoto) this repository was transfered to Norbert Truchsess (ntruchsess) in 02/2013. Anybody willing to contribute is very wellcome! Please submitt pull-requests against branch 'dev'
http://www.firmata.org
Other
21 stars 11 forks source link

Add missing sub SerialIO::close() #31

Closed git-developer closed 4 years ago

git-developer commented 4 years ago

Device::Firmata::Platform->close() is calling close() on the IO device being a Device::Firmata::IO::SerialIO when obtained from Firmata, but SerialIO does not offer this sub.

jnsbyr commented 4 years ago

Hi Christian,

thanks for your suggestion. Compared with Device::Firmata::IO::NetIO the close() method is missing in SerialIO. I propose the following enhancement of your request:

=head2 data_read

Close serial connection to Firmata device.

=cut

sub close($) {
# --------------------------------------------------
  my ( $self ) = @_;  
  if ($self->{handle}) {
    $self->{handle}->close();
    delete $self->{handle};
  }    
}

Please test this variant and give a feedback if it works for you. If it does, update your merge request, but add sub close() after sub data_read(). Also change the merge target branch to develop. There are some additional details that must be updated for a new release that I will take care of before updating the master branch.

Regards, Jens

git-developer commented 4 years ago

Hi Jens,

thanks for your help. I successfully tried your proposal and applied it as suggested.

One more question: which is repo should be used for pull requests - ntruchsess/perl-firmata or jnsbyr/perl-firmata? It's not clear to me which one is the "official" main repo.

jnsbyr commented 4 years ago

Thanks for your feedback, I will merge your request. It will take a few days until I can prepare and publish a new release on the master branch and on CPAN.

To your question regarding the "official" repo: It's stated in the project description:

Originally authored by Aki Mimoto (amimoto) ... transfered to Norbert Truchsess (ntruchsess) ...

So the "official" source code development takes place in the repo of ntruchsess. My own repo is "only" a fork. The reason I appear on both sides is that I also help to maintain the main repo. On the other hand one can say that the "official" repo is on CPAN, because CPAN is the official distribution point for Perl modules. And there are some people that assume that this Perl module is a inherent part of the FHEM project, but FHEM only distributes a copy of this project to avoid the additional installation step for end users.