-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
«Error: Died: method not found: seq_build_by in class Games::Solitaire::Verify::VariantParams» after building expand-solitaire-multi-card-moves #27
Comments
Some more progress - got rid of a string eval, but seems like ->mk_acc_ref is not getting called in the first place: #!/bin/bash
git_repo="$HOME/progs/freecell/git"
gsv="$git_repo/fc-solve/cpan/Games-Solitaire-Verify"
inc()
{
local path="$1"
shift
echo "-I" "$gsv/$path/lib"
}
BASE="MyDir"
BASE_LIB="MyDir/lib"
for bn in "Games-Solitaire-Verify" "POSIX--replacement" "Exception-Class--replacement" "Getopt-Long--replacement" "List-Util--replacement" "Class-XSAccessor--replacement" ; do
p="$gsv/$bn/lib"
find "$p" -name '*.pm' | (while read fn ; do
g="${fn##$p/}"
mkdir -p "$BASE_LIB/$(dirname "$g")"
perl -lp -MSQ -e 's#\Ause parent $sq([^$sq]+)$sq;#use $1 (); use vars qw(\@ISA); \@ISA = (qw($1));#' < "$fn" > "$BASE_LIB/$g"
done)
done
cat <<'EOF' > 'mk_acc_ref.pl'
sub mk_acc_ref
{
my $pkg = shift;
my $names = shift;
my $mapping = +{ map { $_ => $_ } @$names };
{
foreach my $meth_name (keys %$mapping)
{
my $slot = $mapping->{$meth_name};
{
no strict;
*{"${pkg}::$meth_name"} = sub {
my $self = shift;
if (@_)
{
$self->{$slot} = shift;
}
return $self->{$slot};
};
}
}
}
}
EOF
perl -lp -i -0777 -MSQ -MIO::All -E 's#^sub mk_acc_ref\n(.*?)\n}\n#io()->file("mk_acc_ref.pl")->all#ems' "$BASE_LIB"/Games/Solitaire/Verify/Base.pm
# perl -MCarp::Always perlito5.pl -Cjs -I src5/lib/ $(inc "Games-Solitaire-Verify") $(inc "POSIX--replacement") $(inc "Exception-Class--replacement") $(inc "Getopt-Long--replacement") $(inc "List-Util--replacement") $(inc "Class-XSAccessor--replacement") "$gsv"/Games-Solitaire-Verify/script/expand-solitaire-multi-card-moves
perl -MCarp::Always perlito5.pl -Cjs -I src5/lib/ -I "$BASE_LIB" "$gsv"/Games-Solitaire-Verify/script/expand-solitaire-multi-card-moves |
running the script, I get this message: |
Exporting scalars is not yet implemented. |
I've made a few fixes, now I get:
|
Do you think it would be a good idea to copy your See also the %Perlito_internal_module table in 2014-11-02 14:41 GMT+01:00 Shlomi Fish notifications@github.com:
|
@fglock: don't know - they are really incomplete and ad-hoc. |
The context in which Perlito5 executes BEGIN blocks is incomplete, this is a bug. diff --git a/cpan/Games-Solitaire-Verify/Exception-Class--replacement/lib/Class/Data/Inheritable.pm b/cpan/Games-Soli
index df2aabb..95b54fb 100644
--- a/cpan/Games-Solitaire-Verify/Exception-Class--replacement/lib/Class/Data/Inheritable.pm
+++ b/cpan/Games-Solitaire-Verify/Exception-Class--replacement/lib/Class/Data/Inheritable.pm
@@ -4,6 +4,8 @@ use strict qw(vars subs);
use vars qw($VERSION);
$VERSION = '0.08';
+BEGIN {
+
use Carp ();
sub mk_classdata {
@@ -28,6 +30,8 @@ sub mk_classdata {
*{$declaredclass.'::'.$alias} = $accessor;
}
+}
+
1;
__END__
diff --git a/cpan/Games-Solitaire-Verify/Exception-Class--replacement/lib/Exception/Class/Base.pm b/cpan/Games-Solita
index 01ba90d..5f6cc56 100644
--- a/cpan/Games-Solitaire-Verify/Exception-Class--replacement/lib/Exception/Class/Base.pm
+++ b/cpan/Games-Solitaire-Verify/Exception-Class--replacement/lib/Exception/Class/Base.pm
@@ -8,6 +8,9 @@ use Class::Data::Inheritable 0.02;
our @ISA = ( qw(Class::Data::Inheritable) );
BEGIN {
+ use Class::Data::Inheritable 0.02;
+ our @ISA = ( qw(Class::Data::Inheritable) );
+
__PACKAGE__->mk_classdata('Trace');
__PACKAGE__->mk_classdata('NoRefs');
__PACKAGE__->NoRefs(1); |
I've created a perl script to investigate in more detail how BEGIN side-effects work - https://github.com/fglock/Perlito/blob/master/misc/typeglob/dumper.pl These features will be integrated back into Perlito5. In the meanwhile, the "dumper" could potentially be used to preprocess BEGIN blocks out, before the perl5-to-js step. |
@fglock : thanks - I'll see if it'll help me. |
@fglock : is there any progress with this? Can I help you some how? |
There was some progress with BEGIN blocks, but not enough to fix the problem. |
update: BEGIN blocks are now working |
Some of the problems are now fixed - in particular, BEGIN blocks now work in JavaScript and Java, and some of the core modules now work. Some problems can't be easily fixed - for example, only some functions of POSIX.pm can be ported. Possible follow up tasks: rewrite some of the problems we found here into unit tests. |
Running this script:
gives me this:
Seems like the method is not constructed in run time.
The text was updated successfully, but these errors were encountered: