demeter icon indicating copy to clipboard operation
demeter copied to clipboard

Larch.pm fails to import on Windows, Perl 5.18

Open bruceravel opened this issue 8 years ago • 1 comments

Trying does this, according to @newville in #44

C:\Users\newville\Documents\GitHub\demeter>perl -e 'use Larch;'
Can't find string terminator "'" anywhere before EOF at -e line 1.

C:\Users\newville\Documents\GitHub\demeter>perl -e "use Larch;"
syntax error at C:/Users/newville/AppData/Roaming/DemeterPerl/perl/site/lib/Larch.pm line 136, near "$dat{__class__"
Global symbol "$class" requires explicit package name at C:/Users/newville/AppData/Roaming/DemeterPerl/perl/site/lib/Lar
ch.pm line 138.
Global symbol "$class" requires explicit package name at C:/Users/newville/AppData/Roaming/DemeterPerl/perl/site/lib/Lar
ch.pm line 140.
syntax error at C:/Users/newville/AppData/Roaming/DemeterPerl/perl/site/lib/Larch.pm line 141, near "$dat{value"
syntax error at C:/Users/newville/AppData/Roaming/DemeterPerl/perl/site/lib/Larch.pm line 142, near "$dat{__dtype__"
Global symbol "$dat" requires explicit package name at C:/Users/newville/AppData/Roaming/DemeterPerl/perl/site/lib/Larch
.pm line 143.
syntax error at C:/Users/newville/AppData/Roaming/DemeterPerl/perl/site/lib/Larch.pm line 143, near "$dat{__shape__"
syntax error at C:/Users/newville/AppData/Roaming/DemeterPerl/perl/site/lib/Larch.pm line 143, near "->value}"
Global symbol "$value" requires explicit package name at C:/Users/newville/AppData/Roaming/DemeterPerl/perl/site/lib/Lar
ch.pm line 144.
syntax error at C:/Users/newville/AppData/Roaming/DemeterPerl/perl/site/lib/Larch.pm line 145, near "}"
C:/Users/newville/AppData/Roaming/DemeterPerl/perl/site/lib/Larch.pm has too many errors.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

C:\Users\newville\Documents\GitHub\demeter>perl -v

This is perl 5, version 18, subversion 2 (v5.18.2) built for MSWin32-x86-multi-thread-64int

Copyright 1987-2013, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

bruceravel avatar Nov 30 '16 18:11 bruceravel

@bruceravel It may be that much of the code in "decode_data" is overkill for extracting simple scalars and arrays, as Demeter currently uses. The idea was to be able to unpack dictionaries and Groups (as dictionaries), as Demeter might want to do that eventually.

But, if not or in the spirit of doing the least amount now, it may be that using "simple_request" instead of "send_request" method could simplify decoding and/or remover this problem:

# decode_data for simple_request, arrays and scalars only
sub decode_data {
  my ($dat) = @_;
  my %dat;
  if (ref($dat) eq 'ARRAY') {
    return @$dat;
  }  elsif (ref($dat) eq 'HASH') {
    return $dat->{value};
  } else {
    return $dat;
  }

and perhaps even simpler than that. Untested on Windows though.

newville avatar Dec 01 '16 03:12 newville