Perl + Korn + HTML

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl + Korn + HTML
# 1  
Old 08-07-2008
Perl + Korn + HTML

I have a perl script that prints up the html code and executes a few korn scripts to populate the web code.

Disclaimer === I can throw together some korn scripts pretty quick. This code changes pretty frequently. I don't know enough about perl to do everything I need. One day maybe I'll get there but for now -- This does work at least on the web side.

Basically I call a korn script in a variable with tics and print the var inside the html code....
See Below:

Perl Code:
$KSH_CHECK_SCRIPT="scripts/scriptname"; #Check script for UISSssh

foreach (<IN>) {
print "<tr align=left><th width=20%>$HOST</th><th width=20%>yes</th><th width=20%>yes</th><th width=20%>$KSH_CHECK</th><th width=20%>yes</th></tr>";
close IN;

Keep in mind this does work and gives me my expected results. Pretty ? Prob not.

After churning the ksh script, it simply echos y or n
I would like to also echo some output to a file. The script does exactly that and works as designed when I execute either the ksh script by itself or from executing perl script from the command line.

My Problem.....
However when I call the perl script form the browser it will not output the additional info from the ksh script to the text file....

In the example below, it is line 32 the is not being executed when running the perl script from the browser.

    1  #!/bin/ksh
	SNIP out a bunch os variables 
    16  VER=$( sed -n "/$PKG/"'s/.*'"$PKG"'(\([^)]*\)).*/\1/p'  $COLLECT ) ## Thanks JP!
    18  if [[ $VER = $CORRECT_VER ]];then
    19          if [[ $STATUS = N ]];then
    20              continue
    21          else
    22              STATUS=Y
    23          fi
    24  else
    25      STATUS=N
    26      MESSAGE="$MESSAGE Update Needed for ${PKG}:$VER to $CORRECT_VER"
    27  fi
    29  if [[ $STATUS = Y ]];then
    30          echo "$STATUS"
    31  else
    32          print $MESSAGE >> $OUTPUT
    33          echo "$STATUS"
    34  fi

Again all the will work if I run the perl script form the command line.

Any Ideas?

# 2  
Old 08-07-2008
If you are comfortable using ksh, use that; forget about perl.
# 3  
Old 08-07-2008
Permissions related? Are you sure it is being run by a user that has access to append output to that file? Try changing it to print $MESSAGE >> /tmp/somenewfile to test...
# 4  
Old 08-07-2008
Originally Posted by Annihilannic
Permissions related? .............
%%*&^*&^ (*(*&^*&^*&^ ^%$654%^$

Ok I'm shaking my head in shame.
Yes permission problems. The since it executed from the web -- It is a different user.

Well thanks very much for pointing out the obvious Smilie
# 5  
Old 08-07-2008
Perl buffers output by default. Maybe when you execute from browser you never see the buffered output. Set $| = 1; (or $AUTOFLUSH = 1) and you will turn off buffering on the CURRENTLY SELECTED FILE HANDLE which I'm guessing is STDOUT anyway when you get to that print statement in the perl script...

Anyway, no harm trying it...
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Writing an HTML file in perl

I'm writing a perl script that writes an html file. use Tie::File; my ($dir) = @ARGV; open (HTML,">","$dir/file.html") || die $!; #-----Building HTML file--------------------------- print HTML "<!DOCTYPE html> <html> <head> <title>Output</title> <link... (3 Replies)
Discussion started by: jrymer
3 Replies

2. UNIX for Advanced & Expert Users

Calling PERL from a Korn shell script

I am currently in Afghanistan and do not have access to some of the resources I normally do back in the US. Just accessed this site and it looks promising! Hopefully you will not find my question too much of a waste of your time. I write mostly Korn Shell and PERL on Solaris systems for the... (2 Replies)
Discussion started by: mseanowen
2 Replies

3. Shell Programming and Scripting

HELP on Perl array / sorting - trying to convert Korn Shell Script to Perl

Hi all, Not sure if this should be in the programming forum, but I believe it will get more response under the Shell Programming and Scripting FORUM. Am trying to write a customized df script in Perl and need some help with regards to using arrays and file handlers. At the moment am... (3 Replies)
Discussion started by: newbie_01
3 Replies

4. Shell Programming and Scripting

Embedding HTML in Perl script

My webpage is hosted from perlscript(, i want to add piece of html code in the footer of the homepage. I simply pasted the html code at the end of the perl script as below... ======================================================== close(OUTSQL); ... (4 Replies)
Discussion started by: paventhan
4 Replies

5. Shell Programming and Scripting

HTML Encoded characters -- Perl

Hello all I have a string like " Have Fun for the rest of the day !. I will meet you tomorrow!" ! is the HTML Equivalent of ! symbol. From the above string, i would like to remove only the HTML encoded special characters. Output should be like " Have Fun for the rest of the day... (4 Replies)
Discussion started by: vasuarjula
4 Replies

6. Shell Programming and Scripting

Converting html to pdf perl

Hi All, I have a requirement of converting an html form into pdf using perl. The html form contains images, tables and css implementation. I tried using various perl modules but failed to achive the target. I succeeded in generating a pdf from the html file using... (2 Replies)
Discussion started by: DILEEP410
2 Replies

7. Shell Programming and Scripting

Korn Shell and Perl Administrative Script

I have this script that I want to be able to scan a list of IP address from a file (namlist and snifflist)and Hostnames of network devices to see if they are alive or down and if telnet port 23 is open. I originally started to write this in Korn Shell and ran into some issue trying to closed a... (0 Replies)
Discussion started by: metallica1973
0 Replies

8. Shell Programming and Scripting

HTML parsing by PERL

i have a HTML report file..its in attachment(a part of the whole report is "input html.doc").also its source is attached in "report source code.txt" i just want to seperate the datas like in first line it should be.. NHTEST-3848498958-NHTEST-10.2-no-baloo a and so on for whole... (3 Replies)
Discussion started by: avik1983
3 Replies

9. Shell Programming and Scripting

perl and html

hi. im very new to perl. is it possible to fill up a web form and submit it using perl? example, i would like to sign up for a yahoo account though a perl script (ofcourse, granting the "type the characters as shown in imgage" is absent)? (8 Replies)
Discussion started by: marcpascual
8 Replies
Login or Register to Ask a Question

Featured Tech Videos