amrita and perl 5.12.2

38 views
Skip to first unread message

Roger Mason

unread,
Oct 22, 2010, 6:46:50 AM10/22/10
to amrita...@googlegroups.com
Hello,

I'm hoping to install amrita on a machine with perl 5.12.2.

Running

eval `$HOME/AMRITA/AMRITAv3.05/tools/amrshell -setup bash`

results in:

Can't do {n,m} with n > m in regex; marked by <-- HERE in m/^\040{1,0}
<-- HERE / at /home/rmason/AMRITA/AMRITAv3.05/Amrita/Filter/amrita.pm
line 257.

This works fine on a machine with perl 5.8.8, so I'm guessing something
has changed between the two versions.

Can someone can direct me to a fix?

Many thanks,
Roger

ralph

unread,
Oct 22, 2010, 10:25:43 PM10/22/10
to amrita-ebook
line 257 of $AMRITA/Amrita/Filter/amrita.pm is
$line =~ s/^\040{1,$nstrip}//;
Apparently the line is executed with $nstrip = 0
The perl line does the following.
If the string $line starts with $nstrip characters \040 (ascii code
for space, see man ascii for character codes)
then these characters are deleted.

The syntax of perl regular expressions can be found at
http://perldoc.perl.org/perlre.html#Regular-Expressions
It states that the quantifier {n,m} match at least n but not more than
m times.
And that n,m are limited to non-negative integral values less than a
preset limit defined when perl is built. This is usually 32766 on the
most common platforms.

If n > m then the regular expression should not match.
Apparently in the new perl version 5.12.2, this is treated as an
error.
This breaks backwards compatibility of perl scripts,
and I would regard it as a bug in the new version of perl.

For this particular case, a fix would be to change the line in
amrita.pm to read
$line =~ s/^\040{1,$nstrip}// if $nstrip > 0;
Note that the same line occur in amrita.pm at lines 209, 234, 238,
257.
The same changed would be required for each line.

You are likely to find that amrita runs a little further before it
runs into another non-compatible perl line.
In which case you would have to fix it and then iterate. This is a
slow tedious process.
It gives you an idea of all the work that James has to do to maintain
amrita when system utilities like perl or compilers,
or libraries that amrita uses get updated.

If you are in a hurry you might do better to install perl 5.8.8 on
your machine.

Ralph

Roger Mason

unread,
Oct 23, 2010, 1:18:03 PM10/23/10
to amrita...@googlegroups.com
Hello Ralph,

ralph <rmen...@uswest.net> writes:

> line 257 of $AMRITA/Amrita/Filter/amrita.pm is
> $line =~ s/^\040{1,$nstrip}//;
> Apparently the line is executed with $nstrip = 0
> The perl line does the following.
> If the string $line starts with $nstrip characters \040 (ascii code
> for space, see man ascii for character codes)
> then these characters are deleted.

[snip]

Many thanks. I had got as far as figuring out what the problem might
be. My next step was to going to be look through the incompatible
changes text for various perl vesisons that can be found on the
internet. You have saved me some work.

Before I resort to installing 5.8.8 in parallel with my existing 5.12.2
I'll have a go at working through the errors. I understand how tedious
this kind of thing can be: I have been contributing packages and fixing
one or two existing packages for T2 (http://www.t2-project.org/) for a
couple of months.

Depending how much progress I make, I'll try to post diffs to the list.

By the way, thanks for posting those links about scientific
programming. Very interesting. I agree with the sentiments expressed
within them wholeheartedly. I must say though, the professional
programming community is by no means blameless. Too many of them seem
overly concerned with "programming paradigms" like 'agile programming'
etc etc rather than with building good tools.

Thanks again.
Roger

Roger Mason

unread,
Oct 25, 2010, 6:49:22 PM10/25/10
to amrita...@googlegroups.com
Hello Ralph,

ralph <rmen...@uswest.net> writes:

> You are likely to find that amrita runs a little further before it
> runs into another non-compatible perl line.
> In which case you would have to fix it and then iterate. This is a
> slow tedious process.
> It gives you an idea of all the work that James has to do to maintain
> amrita when system utilities like perl or compilers,
> or libraries that amrita uses get updated.
>
> If you are in a hurry you might do better to install perl 5.8.8 on
> your machine.

I managed to work through some of the problems but got stuck on Exec.xs,
so I installed perl-5.8.9. I'm now running tests.

Thanks,
Roger

Roger Mason

unread,
Oct 26, 2010, 9:18:54 AM10/26/10
to amrita...@googlegroups.com
Hello,

ralph <rmen...@uswest.net> writes:

> If you are in a hurry you might do better to install perl 5.8.8 on
> your machine.

I installed Inline-0.46 and Inline-0.22 but when I run this simple
script:

echo hello world written by Python
fold::python { get stuffed
{ a block
print "Hello, world!"
}
}

I get a core dump after echo is evaluated. maybe this has something to
do with specific versions of Inline and Inline-Python?

Cheers,
Roger

James Quirk

unread,
Oct 26, 2010, 9:38:40 AM10/26/10
to Roger Mason, amrita...@googlegroups.com

Your script is generating a Python exception and unless
you're using the precise modules I ship with AMRITA the
exception will not be handled properly owing to a bug
in the CPAN version of Inline-Python. Anyhow, what you
should be running is:

echo hello world written in Amrita
fold::python {
print "Hello, world written in Python!"
}

And if you want to see some Python specific syntax:

echo hello world written in Amrita
fold::python {
print """Hello, world
written in Python!"""
}


Even then I would not recommend you spend too much time
on fold::python. For the version you have does not deal
with Python's indentation requirements gracefully.
Although my version 3.05 does.

I would also suggest you explore fold::print and how
AMRITA's re-entrant fold-documents far exceed the usefulness
of Python's """ """ mechanism. The only downside is that
the current implementation is slow, as its not compiled code.

As an added bonus, with 3.05 fold::print can now output XML.
For instance:

fold::print {
fold> print fold::* <xml>
fold::div {
@width=100 @height=100
The quick brown fox
}
}

would output:

<div width="100" height="100">
The quick brown fox
</div>

This functionality was added to support fold::mxml which
I'm currently using to build an annotated source code
browser for PDF documents. Of course, unless you actually
use amrgi then you won't accrue the full benfits of this mechanism.

James


>
> Cheers,
> Roger
>
>

Roger Mason

unread,
Oct 26, 2010, 12:18:18 PM10/26/10
to amrita...@googlegroups.com
hello,

Having found that Inline-Python did not work, and having moved some of
the relevant perl modules so they were on the @INC path I decided to
re-install from scratch and try again.

I have perl 5.8.9 in /usr/local/lib...

Running ./AMRITAsystem -verbose -check amrf77 results in:

AMRITA::system { verbose mode
gfortran -O3 -w -fPIC -fno-range-check -fno-automatic -I/usr/include \
-I/home/rmason/AMRITA/AMRITAv3.05/include/f77 \
-I/home/rmason/AMRITA/AMRITAv3.05/src -I/include/f77 -I. -I.. \
-I/home/rmason/.amrita/include/f77 -I/include/ -Dserial_code -DLinux_x86_32 \
-Damrgfortran -r -c ./a.f
./a.f:1.1: PROGRAM A 1 Error: Non-numeric character in statement label at (1) \
./a.f:1.1: PROGRAM A 1 Error: Unclassifiable statement at (1) ./a.f:2.1: \
WRITE(6,*) 'HELLO, WORLD!' 1 Error: Non-numeric character in statement label at \
(1) ./a.f:2.1: WRITE(6,*) 'HELLO, WORLD!' 1 Error: Unclassifiable statement at \
(1) ./a.f:3.1: END 1 Error: Non-numeric character in statement label at (1) \
./a.f:3.1: END 1 Error: Unclassifiable statement at (1)
}

I think this is because the prior amrpp: -lang f77 -srcin ./a.F -srcout ./a.f
writes a file with the fortran code in column 1.

Yesterday I had the same problem but I don't recall the fix, and I may
have messed up something else with ignorant tweaking.

Can someone please tell me what needs to be done?

Thanks,
Roger

Roger Mason

unread,
Oct 26, 2010, 3:09:38 PM10/26/10
to amrita...@googlegroups.com
Hello,

Roger Mason <rma...@mun.ca> writes:

> Having found that Inline-Python did not work, and having moved some of
> the relevant perl modules so they were on the @INC path I decided to
> re-install from scratch and try again.

[snip]

I found and fixed the problem.

Cheers,
Roger

Reply all
Reply to author
Forward
0 new messages