[WpProQuiz 2]
[WpProQuiz_toplist 2]
Perl Quiz on Data Types
Learning through sharing
[WpProQuiz 2]
[WpProQuiz_toplist 2]
What is Perl
Perl is the Swiss Army knife for scripting languages (rather call it programming language): powerful and adaptable. It was first developed by Larry Wall, a linguist working as a systems administrator for NASA in the late 1980s, as a way to make report processing easier.
Since then, it has moved into a large number of roles: automating system administration, acting as glue between different computer systems; and, of course, being one of the most popular languages for CGI programming on the Web.
For more information on Basic introduction on Perl, please click here
We have posted a small post on “Applications based on Perl”.
Why Modern Perl (2011-2012 edition)?
According to author Chromatic “When you have to solve a problem now, reach for Perl. When you have to solve a problem right, reach for Modern Perl.”
There are lots of books available on Perl in the market then why and how it is unique and very popular amongst Perl programmers?
The reason is very simple , it’s author Chromatic is well renowned face over the Perl community and this book covers various features that are introduced in 5.10,5.12 and 5.14 and it got released on February,2012
Its list of contents looks very promising to me. No matter who you are, a novice in Perl or an expert; this book has something new, interesting and informative contents for you.
First three chapters deal with Perl Philosophy, its community and Basics of Perl Language. The contents are very informative and full summary on what you can achieve through Perl. You can start writing simple Perl code just after reading first three chapters too!
Next three chapters on Operators, Functions and Regular Expression will make you almost a Perl programmer within no time. If you don’t want to use object oriented Perl, then You will find yourself a comfortable programmer in Perl’s zone. But Perl’s power can’t be judged by stopping there. So next few chapters will show you the real implementation and object Oriented Perl
The next three chapters deal with Perl objects, style and efficacy and managing real Programs. These chapters will teach you
Then last three chapters deal with some exceptional topics which other authors or programmers avoid usually. Chromatic has explained and portrayed these things beautifully. He has explained
Who is Chromatic
Well I put a small review on Modern Perl and praise author many times. Now who is Chromatic ?
He is a writer and free software programmer from USA. He is the author of many other popular books like
He has contributed to CPAN, Perl 5, Perl6 and Parrot too. He was the project secretary of Perl6 and Parrot Foundations too. He is the core developer for Parrot – an open source virtual machine created I n 2008.
From where we can buy it or download it
Rating for Modern Perl (4.5/5)
I would recommend this book for all Perl enthusiasts. If you wish to start a career in Perl programming or you are a beginner in Perl Programming then just read its first three chapters and decide ahead. Check our other books recommendation below.
For intermediate and Advanced level Perl Programmers, it’s a must read book.
It would be really nice if it would have shown some real example with screenshots and output.
There will be some situations where you will not be allowed:But you wish to send mail to your outside friend. Either you will use some proxy settings or will request administrator to allow sending or receiving any mail from outside. What if we can do it using an in-built command or through script?
Yes it is possible and it’s much more easy if you are using Linux rather than Windows (I know even now most of us are using Windows to read this article 😉 ).
This code will work only at Linux variants. If you want to use sendmail in Windows and Linux also with command line option instead of writing a Perl script, you need to download sendEmail readymade script written in Perl by Brandon Zehm .
Let’s see the explanation using codes:
[perl]
#!/usr/bin/perl
#################################################################################
# Author: Sanjeev Jaiswal
# Date: July, 2012
# Description: This script will use inbuilt command “sendmail” with -t option mainly.
# You can send an email to anyone from any valid email id, even if it’s not you.
# You can use it to prank your friends too or to do some serious stuffs.
#################################################################################
use strict;
use warnings;
# You can put as many email ids as you wish in to, cc, bcc
# But, be sure to use commas under one string. All mail ids are fake here, used just for demo 😛
# except admin@aliencoders.org 😉
my %config = (mail_from =>’ranjan2012@gmail.com’,
mail_to => ‘jaszi@gmail.com, sanjeejas@gmail.com’,
mail_cc => ‘jasse@gmail.com, jassi@hotmale.com’,
mail_bcc => ‘nazibal700@gmail.com, jasze@gmall.com’,
mail_subject => “Just testing Sendmail”
);
#Call method to send preformatted email
mail_target();
sub mail_target{
#Use \n\n to make sure that it will render as HTML format
my $message = “From: $config{mail_from}\nTo: $config{mail_to}\nCc: $config{mail_cc}\nBcc: $config{mail_bcc}\nSubject: $config{mail_subject}\nContent-Type: text/html;\n\n”;
$message.= “<strong>Hi Dear,</strong><br>If someone knows your email id, he/she can use it without your permission if he/she is using sendmail under Linux :D<br> Only issue is it says via which server. Through this you can find out from which server and location someone has used your email id.\n”;
my $MAIL_CMD = “/usr/sbin/sendmail -t -i”;
if(!open(SENDMAIL, “| $MAIL_CMD”)){
print “Unable to open an input pipe to $MAIL_CMD:”;
exit(1);
}
print SENDMAIL $message.”\n”;
close(SENDMAIL);
}
[/perl]
Masquerading Sendmail configuration (sendmail.mc not sendmail.cf)
Open your sendmail config file which will be located at /etc/mail/sendmail.mc:
[vim]
# vi /etc/mail/sendmail.mc
[/vim]
Append/add/modify these lines as follows: (usually these lines will be commented, so just uncomment it)
[vim]
MASQUERADE_AS(aliencoders.org)dnl
FEATURE(masquerade_envelope)dnl
FEATURE(masquerade_entire_domain)dnl
MASQUERADE_DOMAIN(aliencoders.org)dnl
[/vim]
Before restarting the server, let’s sendmail.inc make sendmail configuration file ready using m4 command. The m4 utility is a macro processor intended as a front end for C, assembler, and other languages. Type man m4 in Linux box for more details. So, don’t edit sendmail.cf manually.
[vim]
# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
# /etc/init.d/sendmail restart
[/vim]
Disclaimer: This article is for educational purpose only. We are not responsible if you get sued or fired from your company while using this script or such knowledge. Use it at your own risk!
There can be a situation where we need to convert IPv4 Address(32 bit) from 4 octet format i.e. 127.0.0.1 to it decimal equivalent value i.e. 2130706433 and vice-versa. We can use pack, unpack in-built Perl functions to achieve this situation or we can use Socket.pm module (if allowed) along with pack and unpack, whichever you feel easier; you can use it in your code.
Subscribe now to keep reading and get access to the full archive.