Front page | perl.perl5.porters |
Postings from October 2014
Re: Windows help request
Thread Previous
|
Thread Next
From:
bulk88
Date:
October 14, 2014 04:41
Subject:
Re: Windows help request
Message ID:
BLU436-SMTP2484E05A56BE7AA086559ACDFAD0@phx.gbl
Father Chrysostomos wrote:
> The smoke-me/destroio branch won't build on Windows and I cannot
> figure out why from the logs. Could someone lend a hand?
>
i attached a doio.i from destrio branch from miniperl (not full perl) build.
--------------------------------------------
#line 1055 "..\\doio.c"
#line 1 "c:\\perl521\\srcnewb4opt\\perliol.h"
typedef struct {
PerlIO_funcs *funcs;
SV *arg;
} PerlIO_pair_t;
--------------------------------------------
above is the first appearance of PerlIO_funcs token.
in blead miniperl doio.i, token PerlIO_funcs never appears in doio.i,
also perliol.h is never #included.
In commit "Have close() set $! and $^E" you added
--------------------------------------------
doio.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/doio.c b/doio.c
index a631eeb..9551aa4 100644
--- a/doio.c
+++ b/doio.c
@@ -1051,6 +1051,8 @@ Perl_do_close(pTHX_ GV *gv, bool not_implicit)
return retval;
}
+#include "perliol.h" /* PerlIO_restore_errno needs this */
+
bool
Perl_io_close(pTHX_ IO *io, bool not_implicit)
{
-------------------------------------------
BTW commit
-------------------------------------------
* Reword implicit filehandle closure warning
I did not realise we already had a similar warning when open()
implicitly closes a handle. So use similar wording.
--------------------------------------------
needs to be squashed
in commit
--------------------------------------------
* [perl #57512] Warnings for implicitly closed handles
If the implicit close() fails, warn about it, mentioning $! in the
message. This is a default warning in the io category.
--------------------------------------------
If possible
--------------------------------------------
#
-# There is no need for DESTROY to do anything, because when the
+# Under perl 5.21.4 and higher, the perl core itself defines a
+# DESTROY method.
+#
+# Under other perl versions, there is no
+# need for DESTROY to do anything, because when the
# last reference to an IO object is gone, Perl automatically
# closes its associated files (if any). However, to avoid any
# attempts to autoload DESTROY, we here define it to do nothing.
#
-sub DESTROY {}
+if (! defined &DESTROY) { eval 'sub DESTROY {}' }
--------------------------------------------
should be install determined to one or the other based on version,
something like DynaLoader_pm.PL
--------------------------------------------
diff --git a/universal.c b/universal.c
index 906f74c..1c9b6b6 100644
--- a/universal.c
+++ b/universal.c
@@ -998,6 +998,46 @@ XS(XS_re_regexp_pattern)
/* NOT-REACHED */
}
********************Why this implemented in an XSUB and not in sv_clear?
#57512 doesn't show any IO::Handle objects *****************
+XS(XS_IO_Handle_DESTROY)
+{
+ dVAR;
+ dXSARGS;
+ SV *arg;
+ GV *gv = NULL;
+ IO *io = NULL;
+
*********how would this happen???******
+ if (!items) XSRETURN(0);
+ arg = ST(0);
+ SvGETMAGIC(arg);
+ if (SvROK(arg)) arg = SvRV(arg);
*******************so what is an IO::Handle object? why are there 2
different internals to it?????*********************
+ if (isGV(arg)) {
+ gv = (GV *)arg;
+ io = GvIO(gv);
+ }
+ else if (SvTYPE(arg) == SVt_PVIO)
+ io = (IO *)arg;
+
****************this looked too complicated/too much overhead, why not
check packWARN(WARN_IO) before calling io_close() or looking in the IO
body struct? ***********
+ if (io && IoIFP(io) && (IoTYPE(io) == IoTYPE_WRONLY ||
+ IoTYPE(io) == IoTYPE_RDWR ||
+ IoTYPE(io) == IoTYPE_APPEND)
+ && IoIFP(io) != PerlIO_stdin()
+ && IoIFP(io) != PerlIO_stdout()
+ && IoIFP(io) != PerlIO_stderr()
+ && !(IoFLAGS(io) & IOf_FAKE_DIRP)) {
+ const bool success = io_close(io, FALSE);
+ if (!success) {
+ if (gv)
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_IO),
+ "Error closing handle %"HEKf": %"SVf,
+ GvNAME_HEK(gv), get_sv("!",GV_ADD));
+ else Perl_ck_warner_d(aTHX_ packWARN(WARN_IO),
+ "Error closing handle: %"SVf,
+ get_sv("!",GV_ADD));
+ }
+ }
+ XSRETURN(0);
+}
+
#include "vutil.h"
#include "vxs.inc"
----------------------------------------------------
Thread Previous
|
Thread Next