POD2HTML and PODS2HTML

pod2html is a CPAN package, which converts file from pod format (see perlpod) to HTML format.

pods2html is a CPAN package, which converts files in a folder from pod format (see perlpod) to HTML format with same folder name and same file names.

Which is use full for the developers to understand the functions and  args of the script.

Advertisements

Perl Script To Create Index.html

I wrote a Perl script to generate index.html file for a folder which contains .html files. We can change the design for the index.html in the below script. In my script I am fetching the file name which has the .html extension only.

create_index.pl

#!/usr/bin/perl -w

#AUTHOR MANIKANADN . R

if ($#ARGV<0 || $#ARGV>0)

{

print “pass only one  ARGUMENT ‘pathofsourcefolder’ \n”;

print “Eg: create_index.pl DESPATH \n”;

exit;

}

$des= $ARGV[0];

opendir(DIR, “$des”);

@files = grep(/\.html$/,readdir(DIR)); #change this if you want to read other formate files.

closedir(DIR);

open FILE, “>”, “$des/index.html” or die $!;

print FILE “<title>MANI CODE TO CREATE INDEX.HTML</title><h1>INDEX PAGE</h1>\n”; #change this to require design.

close FILE;

foreach $file (@files){ open FILE, “>>”, “$des/index.html” or die $!;

print FILE “<p><a href=”.$file.”>”.$file.”</a></p>\n”; #change this to require design.

close FILE;

}

it create the index.html file in destination folder itself.

Create MVC In Catalyst

To create controller/model/view ….as follows

$script/mani_create.pl controller controllername.

$script/mani_create.pl model modelname.

$script/mani_create.pl view viewname.

I am following these things from the Catalyst books.

I hope these books are really use full to Catalyst learners.

To create a Database model with MySQL as follows

perl script/mani_create.pl model Mani DBIC::Schema Mani::Schema create=static components=TimeStamp dbi:mysql:dbname=test root password

Here Mani is model name, test is database name, root is username of mysql,password is password for mysql and this model is going to use Schema CPAN packages. If the database is not exist the it will through error.

Catalyst [CGI Perl] Installed

At final I installed the required CPAN packages. To create a new catalyst application run $catalyst.pl appname. Here I created application name mani. I start the server by running the script/mani_script.pl. If any CPAN package is missed , the this script will throw error. Then we need to install one by one. Now its working fine. To check on browser type URL localhost:3000.

Catalyst [CGI Perl]

Catalyst is a MVC framework written in Perl called CPAN(Comprehensive Perl Archive Network) packages. I started to learn this using the PDF. It is interesting to me while learning I knew about the View , Model and Controller flow how it works. I want to try it in my local system , so it may be easy to learn.

To install CPAN Pakages in LINUX

$su – root   //Remember when we install by root user then only its possible to run by all user in a single machine. I come to know about this by my colloquies.

$ cpan Catalyst

$ cpan Catalyst::Devel

$ cpan Catalyst::Engine

This will install 50% to 75% of packages which need to run Catalyst.

After that I am facing to install the missing packages. When I  try to create a new application as

$catalyst.pl appname

Its throwing error of missing packages. So we need to look the error message and find out the missing package like can not find/load .. Eg: couldn’t locate Http/Proxy/Engine then we need to install package as ” $cpan  Http::Proxy::Engine ” .

For Install maximum need packages it will take 8 to 12 hrs in medium speed Internet connection. For me to it takes 11 hrs :).  After that also I am facing some problem in packages missing. I hope that I will install successfully.

Append and Prepand In Jquery

Append will add the content at starting level of selected element block. Prepandwill add the content at end level of selected element block.

SYNTAX

$(target).append(content) or $(content).appendTo(target).

$(target).prepand(content) or $(content).prepandTo(target).

Exmple:

html <div id=”name”><p>world</p></div>

code:

$(‘#name’).append(“<p>hello</p>”);

// O/P will be <div id=”name”><p>hello</p><p>world</p></div>

$(‘#name’).prepand(“<p>hello</p>”);

// O/P will be <div id=”name”><p>world</p><p>hello</p></div>