No, it's not crazy. That's exactly what PlantUML has been designed for. Integration with POD is indeed a great idea! I hope that you will make it works, and if you write a how-to document, I will add a link to that document.
The thing that seems to prevent this at the minute is that if PlantUML finds two @startuml declarations referring to the same output file (img/my_diagram.png above), the last one will always overwrite those before it.
What you can do, is to use @startuml tag without giving filename (see http://plantuml.sourceforge.net/sources.html). In that case, there is an automatic increment number added to the generated file name.
More over, you can use =@startuml notation in your POD, because PlantUML also recognize non letters character before the @startuml tag:
=head1 Method name
Paragraph of text, blah blah blah.
=@startuml
...
=@startuml
=end
sub foo {
...perl code here...
}
=head1 Another method name
Blah blah, I talk a lot...
=@startuml
...
=@startuml
=end
sub bar {
...more perl code...
}
Note also that you can use another feature of PlantUML : it seems to me that you can put comment using a # inside POD.
This means that you can use this:
=head1 Method name
Paragraph of text, blah blah blah.
# @startuml
# Alice-> Bob
# @startuml
=end
sub foo {
...perl code here...
}
=head1 Another method name
Blah blah, I talk a lot...
# @startuml
# ...
# @startuml
=end
sub bar {
...more perl code...
}
This text can be parsed by POD (because # line will be ignored), and parsed by PlantUML (using command line/ant task because PlantUML will recognize @startuml, even if they are in # line). You have to add a link toward images generated somewhere in the POD source.
One drawback of using @startuml without filename is that, since file are automatically numbered, when you update your documentation and insert an new diagram, you may have to update all links toward the other images (because the numbering may change).
So I am thinking about allowing to use special tag when defining filename. For example:
@startuml {filename}_init.png
Where {filename} will be replaced by plantuml by the filename of the file containing the diagram (without the extension). So if this line is in file called foo1.perl, then the generated image will be foo1_init.png.
What do you think about that ? Keep us informed of your work.