getlines#
IO.xs:520-565 getlines(…) / getline / gets These call pp_readline internally. For our implementation: getlines (ix=0): reads all lines in list context, croaks in scalar context. getline/gets (ix=1,2): reads one line in scalar context.
IO.xs constructs a fake UNOP with op_ppaddr=PL_ppaddr[OP_READLINE]
and calls CALLRUNOPS. This is deeply tied to perl5 internals.
DEVIATION: We implement getlines/getline via call_method(“readline”) rather than constructing a fake op and calling CALLRUNOPS. This achieves the same observable behavior (reads lines from the filehandle) without requiring access to PL_ppaddr and the ability to construct ops at runtime. The C code does this hack specifically because Perl-level implementation couldn’t properly propagate lexical hints to pp_readline — but we’re calling through the C runtime which handles this natively.