using Markdown as a perl module

european bob bob at wolfwall.com
Wed May 12 13:35:35 EDT 2004


On Wed, 2004-05-12 at 17:50, Angie Ahl wrote:
> I've just started experimenting with Markdown and thought that I could 
> posisbly tie it into my own system which is all done with perl modules.

xMarkdown is a Perl module :o)

> I changed the name from Markdown.pl to Markdown.pm and tried this:
> 
> use Markdown;
> $ItemTextMU = Markdown->Markdown($ItemText);

Perl's object system is a bit more sophisticated than that, I'm afraid.
First, you're calling on object method on a class, which even Perl won't
'make work' ;) I haven't tried it, but Markdown::Markdown($ItemText)
might work.

One potential problem you have: Markdown uses globals, which in a .pm
would basically be a package lexical. If you use a .pm as I suggest
above, you basically have a static class, and you would need some kind
of reset function to clear out the package globals.

It's unlikely you could simply alter the existing Markdown.pl system to
turn it into a "proper" class with constructors, etc., btw, so I
wouldn't bother trying - you would have to fiddle with a lot of lines.

Hope this helps!

-- bob.



More information about the Markdown-discuss mailing list