Welcome Visitor, Please Login or Register Now Wednesday, November 22, 2017 12:51 PM 
Forums Index>Mewsoft>Documentations>Embeded Perl code in templates and widgets
New Topic   New Reply
Search for:
Author Message
mewsoft mewsoft's personal page
Administrator Team Member
Posts: 5381 Display member's posts
Joined: 11-22-17 12:51 PM
Location: knxoville, TN, USA
Member Offline
View Member's Profile Visit member's website Mewsoft Corporation Send private message ICQ Messenger: ICQ AIM Messenger: AIM YIM Messenger: Yahoo MSN Messenger: MSN
 
Back to top
Embeded Perl code in templates and widgets Edit Delete Reply with quote Quote
First Post Posted on: 08-27-16 03:39 AM last post first post



Embeded Perl Code API



Begaining with Auctionawy 2012 version 15.00 a new API integration tools implemended.

The new version API includes Widgets, Gadgets, Embeded Perl code, new templates tags, new template parsing etc.


Embeding Perl code inside html templates and widgets
===================================

Imagine now you can write Perl code direct inside the html templates (views) and widgets.

The embeded Perl code will run within the application context so you have direct access to all

the application database connection, all global variables and functions, access to your entire server

allowed resources, you embed Perl code as you write any Perl script and the Embeded Perl parser

will run this perl code snippet and will capture its output and insert it in the place holder specified by the code.

Embeded Perl code is inserted inside templates and widgets in this format:



Code: HTML    Select All    Expand All
[perl::] 
# your perl code goes here
[::perl]


To skip a block, put ! in front of it like that !
Code: HTML    Select All    Expand All
[perl::]...[::perl]


Gadgets Output
===========
All gadgets output must be printed to the stdout with the regular print function. This output will

be captured by displayed at the same location in the templates.

Do Not Return values from the gadgets as these values will be ignored, to display anything you

have to print it to the stdout.


Since your embeded code will run in the application context then all the application functions and

modules can be called and used.


Simple Example

===========

A simple example for embeded Perl code, say you want to display a message with the current logged in username,

Here is the code that you use inside the templates or widgets:


[perl::]

if ($Global{UserID} ne "") {
  print "Hello " . $Global{UserID};

}

else {

  print "welcome guest, please signin or register now";

}

[::perl]




Now the output will be displayed in the same place and all this perl code will be removed from the output html code.

You can write any code short or long simple or complex the embeded parser will grap anything between the


Code: HTML    Select All    Expand All
[perl::] and [::perl]

tags.


If your Perl code has any errors the program will not exist and will display the error messge received

for you to debug and fix your code.


Mewsoft Support
www.mewsoft.com

Page 1 of 1
Go to page:

New Topic   New Reply Mark Unread
Jump to:  
Delete   Move     Lock   +Favorits   +Notify   Print