≡ Menu


Perl sprintf: How Do I Use sprintf In a Perl Script?

How do I use sprintf() function in a perl script under Linux or UNIX?
[click to continue…]

Plesk type themes for webmin Web hosting control panel

Q. Where can I download Plesk type themes for webmin Web hosting control panel?

A. Webmin is a system configuration tool for Unix-like systems. It has a web-based interface (GUI) desktop environment independent, for configuring some of the internals of the operating system. Webmin is largely based on Perl, and is running as its own process, and web server. It usually uses TCP port 10000 for communicating, and can be configured to use SSL if OpenSSL is installed.

Download sdditional webmin themes

Webmin comes with few built in themes such as caldera and some default. There is no plesk like theme exists for Webmin. However you can download other themes from following location.
=> Third party webmin themes

MySQL server status with mysqlreport report script

Q. How to find out more information about MySQL server status?

A. The MySQL server maintains many status variables that provide information about its operation. You can see upto date variables lists and explanation of its usages online. For example you can connect to MySQL server and execute SHOW STATUS
$ mysql -u vivek -p
mysql> show status;

| Variable_name                  | Value      |
| Aborted_clients                | 0          |
| Aborted_connects               | 4          |
| Binlog_cache_disk_use          | 0          |
| Binlog_cache_use               | 0          |
| Bytes_received                 | 208711192  |
| Bytes_sent                     | 2331972589 |
| Com_admin_commands             | 1          |
| Com_alter_db                   | 0          |
| Com_alter_table                | 0          |
| Threads_connected              | 1          |
| Threads_created                | 53         |
| Threads_running                | 1          |
| Uptime                         | 143182     |
186 rows in set (0.00 sec)

However it takes some time to understand these variables. I recommend using mysqlreport which makes a friendly report of important status variables.

From the project home page:
It makes a friendly report of nearly every status value from SHOW STATUS. Unlike SHOW STATUS which simply dumps over 100 values to screen in one long list, mysqlreport interprets and formats the values and presents the basic values and many more inferred values in a human-readable format. Numerous example reports are available at the mysqlreport web page.

The benefit of mysqlreport is that it allows you to very quickly see a wide array of performance indicators for your MySQL server which would otherwise need to be calculated by hand from all the various SHOW STATUS values

How do I use mysqlreport?

First, download mysqlreport perl script:
$ wget http://hackmysql.com/scripts/mysqlreport

Now, execute mysqlreport
$ ./mysqlreport --user vivek --host localhost --port 3306 --socket /var/lib/mysql/mysql.sock --passwordOutput:

Password for database user vivek:
MySQL 4.1.20             uptime 1 15:51:22      Fri Oct 20 00:39:46 2006

__ Key _________________________________________________________________
Buffer used     2.92M of 500.00M  %Used:   0.58
  Current      94.22M            %Usage:  18.84
Write ratio      0.83
Read ratio       0.01

__ Questions ___________________________________________________________
Total         575.29k    4.01/s
Slow                0    0.00/s  %Total:   0.00  %DMS:   0.00
DMS           165.78k    1.16/s           28.82

__ Table Locks _________________________________________________________
Waited              5    0.00/s  %Total:   0.00
Immediate     174.21k    1.21/s

__ Tables ______________________________________________________________
Open               99 of 4000    %Cache:   2.48
Opened          1.82k    0.01/s

__ Connections _________________________________________________________
Max used           15 of  400      %Max:   3.75
Total          76.37k    0.53/s

__ Created Temp ________________________________________________________
Disk table      6.21k    0.04/s
Table          14.24k    0.10/s
File               22    0.00/s

=> Download Link
=> Documentation

How to access MySQL database using Perl

Q. How do I access my MySQL database server using Perl programming language?
[click to continue…]

Find out What Perl Modules Already Installed On My System

Quick question – What command I need to type to list all installed Perl modules on my Linux / UNIX system?
[click to continue…]

How do I send html email from Perl?

Q. How Can I send html email from cgi perl program under UNIX / Linux and Apache web sever?

A. Sending HTML email is an easy task with MIME::Lite CPAN module. It is a low-calorie MIME generator.

It can be use to send html emails, graphics file email attachments as a single-part or multi-part message. Here is simple perl script that sends html email.

Install Perl MIME::Lite

If you do not have MIME::Lite module, install using following command (login as a root user):

# cpan -i MIME::Lite

Perl script code

Script to send html email from perl:

#!/usr/bin/perl -w use strict; use MIME::Lite; # SendTo email id my $email = 'user@somewhere.com'; # create a new MIME Lite based email my $msg = MIME::Lite->new ( Subject => "HTML email test", From => 'YOU@somewhere.com', To => $email, Type => 'text/html', Data => '<H1>Hello</H1><br>This is a test email. Please visit our site <a href="http://cyberciti.biz/">online</a><hr>' ); $msg->send();

Save the script and execute it. Here is an email (sample) send by above script:

Read man page of MIME::Lite for more information:

perldoc MIME::Lite

Sending mail with Perl mail script

Q. How can I send an email with perl?
[click to continue…]

HowTo Find Out Perl Version

How do I find out Perl version by running a cgi script from a webbrowser? How do I find out Perl version from a command prompt under Windows OR Linux / UNIX OR Apple MAC OS X operating systems?
[click to continue…]

What is MySQL?

MySQL is open source database server. It is reliable and widely used by web developers around the world. You can use PHP or Perl scripting to access a MySQL database. However, thousands of ready to use application available for MySQL, here is list of some of the most popular application (written in PHP [PHP (Hypertext Preprocessor) is a widely used, general-purpose scripting language that is especially suited for web development and can be embedded into HTML]):

Once you are, experienced user, you may also use MySQL to create dynamic web pages or software(s) for yourself. For more information see: