I have a followup question on this solution.
I would like to put in do {} block inside the Embperl code itself, so I don’t
have to change my code.
As I look myself, do you or anyone else know where in the Embperl code I can do
that?
I would imagine it ought to be a simple single line insert, I am just not sure
where.
Best Regards
Matthew Kaiser – IT Department
630-515-6138
HelpDesk:
(630)-515-7361 – Illinois
(623)-572-3388 - Arizona
From: Kaiser, Matthew
Sent: Tuesday, March 16, 2021 7:13 AM
To: Dirk Melchers <[email protected]>
Cc: [email protected]
Subject: RE: substr no longer works in [+ tags +]?
Thanks Dirk,
Adding a “do {}” block to a substr call does work.
However the it’s seems to only be for substr.
We tested this code:
#!/opt/perl520/bin/perl
use Embperl;
my $template = <<'.';
<br/>
substr<br/>
<br/>
[- $str = substr('ABCD',2,2) -]
<p>[+ $str +]</p>
[- $str = 'ABCD' -]
<p>[+ substr($str,2,2) +]</p>
<p>[+ do {substr('ABCD',2,2)} +]</p>
<br/>
length - length of 'ABCD'<br/>
<br/>
<p>[+ length($str) +]</p>
[- $l = length($str) -]
<p>[+ $l +]</p>
<br/>
index - where's 'B' in 'ABCD'<br/>
<br/>
<p>[+ index($str,'B') +]</p>
[- $l = index($str,'B') -]
<p>[+ $l +]</p>
<br/>
rindex - where's 'B' in 'ABCD'<br/>
<br/>
<p>[+ rindex($str,'B') +]</p>
[- $l = rindex($str,'B') -]
<p>[+ $l +]</p>
<br/>
ord - the numeric value of first character of 'ABCD'<br/>
<br/>
<p>[+ ord($str) +]</p>
[- $l = ord($str) -]
<p>[+ $l +]</p>
.
my $body;
Embperl::Execute({input => \$template, param => '', output => \$body});
print "$body\n";
1;
------------------------And the results are:
<br/>
substr<br/>
<br/>
<p>CD</p>
<p></p>
<p>CD</p>
<br/>
length - length of 'ABCD'<br/>
<br/>
<p>4</p>
<p>4</p>
<br/>
index - where's 'B' in 'ABCD'<br/>
<br/>
<p>1</p>
<p>1</p>
<br/>
rindex - where's 'B' in 'ABCD'<br/>
<br/>
<p>1</p>
<p>1</p>
<br/>
ord - the numeric value of first character of 'ABCD'<br/>
<br/>
<p>65</p>
<p>65</p>
It appears the issue isn’t about just function calls. Just substr for some
reason.
Best Regards
Matthew Kaiser – IT Department
630-515-6138
HelpDesk:
(630)-515-7361 – Illinois
(623)-572-3388 - Arizona
From: Dirk Melchers <[email protected]<mailto:[email protected]>>
Sent: Tuesday, March 16, 2021 2:37 AM
To: Kaiser, Matthew <[email protected]<mailto:[email protected]>>
Cc: [email protected]<mailto:[email protected]>
Subject: Re: substr no longer works in [+ tags +]?
CAUTION: This email originated from outside of MWU
Hi,
let me quote a mail from myself from 2019, regarding problems with %udat, which
also hits you now:
Hi,
very late answer: we stumbled over the same problem now...
With newer perl versions there seems to be a very ugly bug when [+ +] only
contains a function call (which I believe access to a TIE (mdat,udat) is also).
Even [+ substr($string,0,4) +] does not work!
Look at this code example:
[- $udat{'jo'}=23 -]
substr:[+ substr("hallo",0,3) +]<br>
fdat:[+ $fdat{'jo'} +]<br>
udat:[+ $udat{'jo'} +]<br>
<br>
substr:[+ substr("hallo",0,3).'' +]<br>
fdat:[+ $fdat{'jo'}.'' +]<br>
udat:[+ $udat{'jo'}.'' +]<br>
In the first block, only fdat will be displayed, in the second one all three
values.
So make sure, that there is not a single function call in the [+ +] block!
Fun fact: the current debian patches simply changed the tests and added .''
or +0 to the tests to "fix" the problem...
Our fix: wrap everything in a "do {}" block: [+ do { $udat{foo} } +]
With best regards,
Dirk Melchers
/// IT/Software-Development ///
NUREG GmbH ///
Dorfäckerstraße 31 | 90427 Nürnberg | Germany
Tel. +49-911-32002-256 | Fax +49-911-32002-299
Mobil +49-172-9354670 | www.nureg.de<http://www.nureg.de>
Nürnberg HRB 22653 | USt.ID DE 814 685 653
Geschäftsführer: Michael Schmidt, Stefan Boas
Am 15.03.2021 um 21:48 schrieb Kaiser, Matthew
<[email protected]<mailto:[email protected]>>:
Hello all,
After being a lurker for years, I have a question for y’all.
We just tested a server running Perl 5.30 with Embperl 2.5.0 and we’re getting
a weird behavior.
The embperl code:
[+ substr(‘ABCD’,2,2) +]
no longer prints anything from within the .epl files.
The phrase:
[- $str = substr(‘ABCD’,2,2) -]
[+ $str +]
Works just fine.
Any idea on what’s causing this change in behavior?
Any ideas?
With My Best Regards
<image001.png>
Matthew E Kaiser
Systems Developer
IT Department
Midwestern University - Downer's Grove Campus
(630)-515-6138
[email protected]<mailto:[email protected]>
HelpDesk:
(630)-515-7361 – Illinois
(623)-572-3388 - Arizona
The information contained in this e-mail and any accompanying documents is
intended for the sole use of the recipient to whom it is addressed, and may
contain information that is privileged, confidential, proprietary to sender,
and prohibited from disclosure under applicable law. If you are not the
intended recipient, or authorized to receive this on behalf of the recipient,
you are hereby notified that any review, use, disclosure, copying, or
distribution is prohibited. If you are not the intended recipient(s) or have
received this communication in error, please contact the sender by e-mail,
delete it from your computer, and destroy all copies of the original message.
Thank you.
[https://online.midwestern.edu/images/MaskUp.gif]
.. ..