using Markdown as a perl module
Angie Ahl
alists at vertebrate.co.uk
Wed May 12 14:25:03 EDT 2004
>> 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.
That's what I thought. It was just wishful thinking.
I've written over 17 modules now. I'm still newbie, but I don't scare
easily anymore.
The fact that searching for "bless" made BBedit go ping was a clue ;)
> 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.
I have Grep, I can change those vars to my, I can write bless. I can
try.... and possibly fail
Of course I'm no perl guru yet, but my understanding of it is I never
will be unless I hack at cool code ;)
Or are you suggesting someone already has.... xMarkdown is that
something else? Google just brings me back to you ;)
Cheers
Angie
More information about the Markdown-discuss
mailing list