A set of modules that allow easy mixing of code types to be interpretted as
a Tk application...
The input is in MIME-multipart/mixed format, and easy entity can be markdown
(displayed formatted
in a Text with options to add Tk windows and behaviours), perl (eval()ed),
yaml (structure made available
to app) or menu in yaml (posted on main mindow).
The purpose of this is to contribute to a compiled program (for
Windows/Mac/Linux) that can run appended scripts in this format. The reason
for having this format is that resources can be included in the one file.
The Markdown stuff
is to allow easy inclusion of controls in the context of a document.
Tk::MDText - a Tk::Text that displays Markdown with Tk "tags" to include
widgets inline.
Tk::MDTextBook - a Tk::NoteBook that reads multipart document and contructs
an app (using MDTexts)
Tk::MDTextBook::Data2Tk - quick sub to make a window and give <DATA> to
Tk::MDTextBook
Does that make sense to anybody?? Here's an example:
E.g.:
use strict;
use Tk::MDTextBook::Data2Tk; # exports one sub:
data2tk;
__DATA__
MIME Version: 1.0
Content-Type: multipart/mixed; boundary=##--##--##--##--##
Title: Window Title
Here is a prologue
--##--##--##--##--##
Content-Type: application/x-ptk.markdown
Title: _Basic MarkDown
ID: Page1
# MarkDown Tk Text Thingy.
## Here is a sub-header
And a paragraph here
because I wanted to
check that it handles stuff
right over several lines.
--##--##--##--##--##
Content-Type: application/x-ptk.markdown
Title: _Tk and Scripting
ID: Page2
##### Tk windows and scripts
Here is my markdown. Here is some stuff in a preformatted block:
field label <Tk::Entry> <-- put stuff here!
another label <Tk::Entry> ... and more
and so on <Tk::Button -text="Here is some text!">
--##--##--##--##--##
Content-Type: application/x-yaml.menu
---
- _File:
- _Exit: exit
- '---' : '---'
- _Help:
- _About: MyPackage::ShowPreamble
- _Help : MyPackage::ShowEpilog
--##--##--##--##--##
Content-Type: application/x-perl
package MyPackage;
## the most useful of the following will get included in the module
itself...
sub myScriptSub {
print "Hello from script sub!\n";
}
sub getObjectList {
my @shelf = @Tk::MDTextBook::Shelf;
my $object = $shelf[$#shelf]; # get the last one!
return $object->{Objects};
}
sub getMW {
return $Tk::MDTextBook::Data2Tk::MW;
}
sub getPreamble {
return getObjectList()->{Main}->{Preamble};
}
sub getEpilog {
return getObjectList()->{Main}->{Epilog};
}
sub ShowPreamble {
getMW()->messageBox(-message=>getPreamble());
}
sub ShowEpilog {
getMW()->messageBox(-message=>getEpilog());
}
--##--##--##--##--##--
Here is the epilogue
---
This email is free from viruses and malware because avast! Antivirus protection
is active.
http://www.avast.com