Hi, I was gonna ask this on IRC, but nobody's answering, so I'll try it here.

OK, what I want to do, is put the metadata that comes through a source 
somewhere. Let's say I just want to write it to a file.

So I have my source "full" and I want something to be done with the metadata:

full = on_metadata(writemeta, full)

let's have a look at writemeta and the other functions:


mdstring = ""

def conc(data)
    mdstring = mdstring ^ "#{fst(data)}=\'#{snd(data)}\',"
    system("echo '#{mdstring}' > ~/meta.txt")
end

def writemeta(mdata)
    mdstring = ""
    list.iter(conc, mdata)
#    system("echo \"#{mdstring}\" > ~/meta.txt")
end

This is taken from what I'm currently working on, so it doesn't make an awefull 
lot of sense.
Anyway, there's this global variable mdstring which is to be filled with 
everything that's inside the metadata.
The conc() function is ment to make that happen, but somehow, global variables 
don't work.
I can't appent a string to another like this.
mdstring is always "" when entering conc().

The idea is to prepare the string with all available metadata, and then write 
it to a file (the commented-out line in writemeta()).
Writing to the file in conc() is just for debug purposes.

I read in an OCaml tutorial, that I'm supposed to use

let mdstring = ref 0

and then dereferencing the string with !mdstring, and using mdstring := "blah" 
when assigning values.
But it doesn't work!

OK, would be great if someone could help me with that.

Oh, and if you were to say just to use string_of(mdata), that doesn't quite 
work.
My metadata contains UTF-8 characters, that get mingled by string_of() into 
things like "\194\184" (the actual byte representation of the character).

Cheers,
        polemon

-- 
polemon <pole...@gmail.com>

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to