Sponsored Content
Top Forums UNIX for Dummies Questions & Answers transforming small javascript into perl Post 302190353 by cbkihong on Tuesday 29th of April 2008 11:05:15 AM
Old 04-29-2008
Then that is a client-side Javascript problem. It has nothing to do with Perl even though Perl is used to generate the Javascript.

If what you want to do is to execute different bits of Javascript depending on condition. That is possible with Javascript alone. People are doing that all over the Web to address different browsers. Sometimes you may need to wrap the code in a try ... catch block to catch exceptions so that you can try several variations until finding one that works!

Of course, unless you have reasons to generate dynamic Javascript from Perl, moving all the javascript away from the HTML to a separate .js file that is sourced from the HTML esp. if you have lots of javascript. Then you can serve that JS file with Apache directly rather than wasting resources generating JS from Perl.
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help Required In Transforming A File

How will i convert a file <LREC><L:EPOCH>1198331268.553</L:EPOCH><LDATE>10-12-07</LDATE><L:SERVER>NONE</L:SERVER><L:PORT>NONE</L:PORT><LTIME>13:47:48.553</LTIME><LTEXT>dnvdmxk</LTEXT></LREC>... (3 Replies)
Discussion started by: anju
3 Replies

2. UNIX for Dummies Questions & Answers

onChange + javascript in perl CGI - question

Hello all, Am trying to include a onChange java script to my perl CGI application which uses POST method to upload files to file_server This is how I embedded javascript in the perl code that renders CGI application print qq| <script type="text/javascript" src="display.js"> </script>... (4 Replies)
Discussion started by: matrixmadhan
4 Replies

3. Shell Programming and Scripting

transforming records

Hi all In input file I have records like this: 0,1,0,87,0,0,"6,87","170,03",0,"43,5",0,0,0,0,"6,87","126,53" and in output file I need that these records transforms in : 0 1 0 87 0 0 6,87 170,03 0 43,5 0 0 0 0 6,87 126,53 Could you help me in this case? Please (13 Replies)
Discussion started by: shizik
13 Replies

4. UNIX for Advanced & Expert Users

Transforming psmf to ogv

Hi all. I would like to create a program that converts psmf file format (PSMF - MultimediaWiki) to ogv (Ogg - Wikipedia, the free encyclopedia). I know C++ and I worked with BMPs (so I can understand a simple file system like the BMP header is) but I didn't touch any kind of sound/video file... (1 Reply)
Discussion started by: lilezek
1 Replies

5. Shell Programming and Scripting

How to use JavaScript in Perl Object Oriented

i am new to Perl CGI Object oriented. I want to use some java script in my Perl CGI but i am not able to do that. I am using Submit button then via param() i am getting all field parameters. But i want to validate all fields first then i want to move. But Use of Java script, i don't know (1 Reply)
Discussion started by: Navrattan Bansa
1 Replies

6. Shell Programming and Scripting

How to call perl web service from javascript?

Hi, I would like to call the below perl web service from javascript .Any help would be appreciated.I am new to web services.Please do the needful. Server Program(Perl Web Service) #!/usr/bin/perl use lib '/usr/lib/perl5/5.8.8/SOAP-Lite-0.65_3/lib'; use SOAP::Transport::HTTP; use Demo;... (3 Replies)
Discussion started by: liyakathali
3 Replies

7. Programming

Transforming data to other format

Dear All I would like to transform data from one format to another format. my Input: 0 0 1 0 1 0.308 0 2 0.554 0 3 0.287 output: Z (0,0)= 1 Z (0,1)=0.308 Z (0,2)=0.554 Z (0,3)=0.287 (2 Replies)
Discussion started by: bala06
2 Replies

8. UNIX for Dummies Questions & Answers

Transforming data so it looks like the one you specified

Lets say for instance I have this data within a file named transform xxx#yyy@zzz and I want it to be in the format ofZZZ xxx-yyy How do I go about doing this? (3 Replies)
Discussion started by: l3monz
3 Replies
Template::Toolkit(3)					User Contributed Perl Documentation				      Template::Toolkit(3)

NAME
Template::Toolkit - Template Processing System Introduction The Template Toolkit is a collection of Perl modules which implement a fast, flexible, powerful and extensible template processing system. It is "input-agnostic" and can be used equally well for processing any kind of text documents: HTML, XML, CSS, Javascript, Perl code, plain text, and so on. However, it is most often used for generating static and dynamic web content, so that's what we'll focus on here. Although the Template Toolkit is written in Perl, you don't need to be a Perl programmer to use it. It was designed to allow non- programmers to easily create and maintain template-based web sites without having to mess around writing Perl code or going crazy with cut- n-paste. However, the Template Toolkit is also designed to be extremely flexible and extensible. If you are a Perl programmer, or know someone who is, then you can easily hook the Template Toolkit into your existing code, data, databases and web applications. Furthermore, you can easily extend the Template Toolkit through the use of its plugin mechanism and other developer APIs. Whatever context you use it in, the primary purpose of the Template Toolkit is to allow you to create a clear separation between the presentation elements of your web site and everything else. If you're generating static web pages, then you can use it to separate the commonly repeated user interface elements on each page (headers, menus, footers, etc.) from the core content. If you're generating dynamic web pages for the front end of a web application, then you'll also be using it to keep the back-end Perl code entirely separate from the front-end HTML templates. Either way, a clear separation of concerns is what allow you to concentrate on one thing at a time without the other things getting in your way. And that's what the Template Toolkit is all about. Documentation The documentation for the Template Toolkit is organised into five sections. The Template::Manual contains detailed information about using the Template Toolkit. It gives examples of its use and includes a full reference of the template language, configuration options, filters, plugins and other component parts. The Template::Modules page lists the Perl modules that comprise the Template Toolkit. It gives a brief explanation of what each of them does, and provides a link to the complete documentation for each module for further information. If you're a Perl programmer looking to use the Template Toolkit from your Perl programs then this section is likely to be of interest. Most, if not all of the information you need to call the Template Toolkit from Perl is in the documentation for the Template module. You only really need to start thinking about the other modules if you want to extend or modify the Template Toolkit in some way, or if you're interested in looking under the hood to see how it all works. The documentation for each module is embedded as POD in each module, so you can always use "perldoc" from the command line to read a module's documentation. e.g. $ perldoc Template $ perldoc Template::Context ...etc... It's worth noting that all the other documentation, including the user manual is available as POD. e.g. $ perldoc Template::Manual $ perldoc Template::Manual::Config ...etc... The Template::Tools section contains the documentation for Template::Tools::tpage and Template::Tools::ttree. These are two command line programs that are distributed with the Template Toolkit. tpage is used to process a single template file, ttree for processing entire directories of template files. The Template::Tutorial section contains two introductory tutorials on using the Template Toolkit. The first is Template::Tutorial::Web on generating web content. The second is Template::Tutorial::Datafile on using the Template Toolkit to generate other data formats including XML. The final section of the manual is Template::FAQ which contains answers to some of the Frequently Asked Questions about the Template Toolkit. You can read the documentation in HTML format either online at the Template Toolkit web site, http://template-toolkit.org/ <http://template-toolkit.org/>, or by downloading the HTML version of the documentation from http://template-toolkit.org/download/index.html#html_docs <http://template-toolkit.org/download/index.html#html_docs> and unpacking it on your local machine. Author The Template Toolkit was written by Andy Wardley (<http://wardley.org/> <mailto:abw@wardley.org>) with assistance and contributions from a great number of people. Please see Template::Manual::Credits for a full list. Copyright Copyright (C) 1996-2008 Andy Wardley. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See Also Template, Template::Manual, Template::Modules, Template::Tools, Template::Tutorial perl v5.12.1 2009-07-20 Template::Toolkit(3)
All times are GMT -4. The time now is 01:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy