Closed traumschule closed 5 years ago
Unfortunately removing the ampersand didn't help. Did you see that the documentation linked above does the same? Did you try to use Pass 3 in a while? What could be the issue here?
@traumschule : please see https://github.com/shlomif/how-to-share-code-online - give me a repo URL to clone. I use pass 3 / ePerl all the time.
With wml 2.0.12 (16-Apr-2008) from debian stable and 2.12.0 in testing the following fails:
$ cat >test.wml <<EOF
<perl>
sub isotime _lbrace_
my ($time) = @_;
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
localtime($time);
my ($str) = sprintf("%04d-%02d-%02d %02d:%02d:%02d",
$year+1900, $mon+1, $mday, $hour, $min, $sec);
return $str;
_rbrace_
</perl>
The current date is <:= &isotime(time()) :>.
EOF
$ wml test.wml
ePerl:Error: Perl runtime error (interpreter rc=255)
---- Contents of STDERR channel: ---------
Undefined subroutine &main::isotime called at /tmp/wml.cZyjms/wml.8370.tmp1.wml line 33.
------------------------------------------
** WML:Break: Error in Pass 3 (rc=1).
$ wml --version
Use of uninitialized value in pattern match (m//) at /usr/share/wml/TheWML/Frontends/Wml/WmlRc.pm line 48.
TheWML::Frontends::Wml::WmlRc::_process_wmlrc(TheWML::Frontends::Wml::WmlRc=HASH(0xc892b4)) called at /usr/share/wml/TheWML/Frontends/Wml/Runner.pm line 858
TheWML::Frontends::Wml::Runner::run_with_ARGV(TheWML::Frontends::Wml::Runner=HASH(0xb8a01c), HASH(0xe0a570)) called at /usr/bin/wml line 47
This is WML Version 2.12.0
Copyright (c) 1996-2001 Ralf S. Engelschall.
Copyright (c) 1999-2001 Denis Barbier.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
$ wml test.wml
ePerl:Error: Perl runtime error (interpreter rc=255)
---- Contents of STDERR channel: ---------
Undefined subroutine &main::isotime called at /tmp/wml.18959.tmp1 line 28.
------------------------------------------
** WML:Break: Error in Pass 3 (rc=1).
Died at /usr/share/wml/TheWML/Frontends/Wml/Runner.pm line 403.
TheWML::Frontends::Wml::Runner::_run_pass(TheWML::Frontends::Wml::Runner=HASH(0x226301c), 3, SCALAR(0x25a62b8), SCALAR(0x25a6290), SCALAR(0x25a62a4)) called at /usr/share/wml/TheWML/Frontends/Wml/Runner.pm line 441
TheWML::Frontends::Wml::Runner::_passes_loop(TheWML::Frontends::Wml::Runner=HASH(0x226301c)) called at /usr/share/wml/TheWML/Frontends/Wml/Runner.pm line 726
TheWML::Frontends::Wml::Runner::_output_and_cleanup(TheWML::Frontends::Wml::Runner=HASH(0x226301c)) called at /usr/share/wml/TheWML/Frontends/Wml/Runner.pm line 930
TheWML::Frontends::Wml::Runner::run_with_ARGV(TheWML::Frontends::Wml::Runner=HASH(0x226301c), HASH(0x2500d0c)) called at /usr/bin/wml line 47
@traumschule : this wml file works:
<:
sub isotime {
my ($time) = @_;
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
localtime($time);
my ($str) = sprintf("%04d-%02d-%02d %02d:%02d:%02d",
$year+1900, $mon+1, $mday, $hour, $min, $sec);
return $str;
}
:>
The current date is <:= &isotime(time()) :>.
are you sure one does not need a wml include to get the <perl>
macro working?
This works for me, thanks!
On Sat, 12 Jan 2019 21:18:49 -0800 Traumschule notifications@github.com wrote:
This works for me, thanks!
you're welcome.
Shlomi Fish http://www.shlomifish.org/ http://shlomifishswiki.branchable.com/Encourage_criticism_and_try_to_get_offended/
Bigamy: Having one wife too many. Monogamy: The same thing! — Unknown source.
Please reply to list if it's a mailing list post - http://shlom.in/reply .
Using Pass 3 fails with
Is this function no longer usable?
STR
At the beginning of a .wml file a subroutine is defined and later called: