I can certainly write a function to do this, but would be very glad
to take advantage of any that's already available.
Thanks,
Pm
.sub _main
load_bytecode "runtime/parrot/library/Data/Escape.pbc"
.local pmc escaper
escaper = find_global "Data::Escape", "String"
$S0 = "\n"
$S1 = escaper($S0, "\"")
print $S1
print $S0
end
.end
> .sub _main
> load_bytecode "runtime/parrot/library/Data/Escape.pbc"
^^^^^^^^^^^^^^^
Just drop that prefix - "library/foo" ought to do it.
leo
Good bet, thanks.
> > .sub _main
> > load_bytecode "runtime/parrot/library/Data/Escape.pbc"
> ^^^^^^^^^^^^^^^
> Just drop that prefix - "library/foo" ought to do it.
On my machine 'library/foo' doesn't seem to be sufficient -- I have
to provide a complete path (relative or absolute) to the resource.
Or is there some other environment variable or the like that I should
have set?
[pmichaud@localhost parrot]$ cat esc.pir
.sub _main
load_bytecode 'library/Data/Escape.pbc'
$P0 = find_global "Data::Escape", "String"
$S0 = $P0("hello\nthere\n", '"')
print $S0
print "\n"
.end
[pmichaud@localhost parrot]$ parrot esc.pir
Parrot VM: Can't stat library/Data/Escape.pbc, code 2.
Segmentation fault
[pmichaud@localhost parrot]$ uname -a
Linux localhost.localdomain 2.4.20-31.9 #1 Tue Apr 13 18:04:23 EDT 2004 i686 i686 i386 GNU/Linux
Pm
>> > .sub _main
>> > load_bytecode "runtime/parrot/library/Data/Escape.pbc"
>> ^^^^^^^^^^^^^^^
>> Just drop that prefix - "library/foo" ought to do it.
> On my machine 'library/foo' doesn't seem to be sufficient -- I have
> to provide a complete path (relative or absolute) to the resource.
Argh, yes. Loading bytecode didn't search the library paths. Fixed.
BTW still patches wanted that check the filename, if it's absolute.
> Pm
leo