diff --git a/libs/perlbind/include/perlbind/scalar.h b/libs/perlbind/include/perlbind/scalar.h index ea2d97ade..ab54c17b2 100644 --- a/libs/perlbind/include/perlbind/scalar.h +++ b/libs/perlbind/include/perlbind/scalar.h @@ -251,4 +251,6 @@ private: scalar m_value; }; +using ref = reference; + } // namespace perlbind diff --git a/libs/perlbind/include/perlbind/stack_push.h b/libs/perlbind/include/perlbind/stack_push.h index 61a514cce..2a9830c24 100644 --- a/libs/perlbind/include/perlbind/stack_push.h +++ b/libs/perlbind/include/perlbind/stack_push.h @@ -28,8 +28,8 @@ struct pusher ++m_pushed; } void push(const std::string& value) { mPUSHp(value.c_str(), value.size()); ++m_pushed; } - void push(scalar value) { mPUSHs(value.release()); ++m_pushed; }; - void push(reference value) { mPUSHs(value.release()); ++m_pushed; }; + void push(scalar value) { mPUSHs(value.release()); ++m_pushed; } + void push(reference value) { mPUSHs(value.release()); ++m_pushed; } void push(array value) { @@ -38,7 +38,8 @@ struct pusher for (int i = 0; i < count; ++i) { // mortalizes one reference to array element to avoid copying - PUSHs(sv_2mortal(SvREFCNT_inc(value[i].sv()))); + SV** sv = av_fetch(static_cast(value), i, true); + mPUSHs(SvREFCNT_inc(*sv)); } m_pushed += count; } diff --git a/libs/perlbind/include/perlbind/stack_read.h b/libs/perlbind/include/perlbind/stack_read.h index fe5794124..095436d1d 100644 --- a/libs/perlbind/include/perlbind/stack_read.h +++ b/libs/perlbind/include/perlbind/stack_read.h @@ -242,7 +242,7 @@ struct read_as static bool check(PerlInterpreter* my_perl, int i, int ax, int items) { int remaining = items - i; - return remaining > 0 && remaining % 2 == 0 && SvTYPE(ST(i)) == SVt_PV; + return remaining > 0 && remaining % 2 == 0 && SvTYPE(ST(i)) < SVt_PVAV; } static hash get(PerlInterpreter* my_perl, int i, int ax, int items) diff --git a/libs/perlbind/include/perlbind/version.h b/libs/perlbind/include/perlbind/version.h index bc6f6e3d8..68aee2773 100644 --- a/libs/perlbind/include/perlbind/version.h +++ b/libs/perlbind/include/perlbind/version.h @@ -1,7 +1,7 @@ #pragma once constexpr int perlbind_version_major = 1; -constexpr int perlbind_version_minor = 0; +constexpr int perlbind_version_minor = 1; constexpr int perlbind_version_patch = 0; constexpr int perlbind_version()