PERL/C3/Downloading-CPAN-module/English-timed

From Script | Spoken-Tutorial
Jump to: navigation, search
Time Narration
00:01 Welcome to the Spoken Tutorial on Downloading CPAN modules.
00:06 In this tutorial, we will learn how to download required CPAN modules in Ubuntu Linux Operating System and

Windows Operating System.

00:17 To record this tutorial, I am using:

Ubuntu Linux 12.04 operating system, Windows 7, Perl 5.14.2 and 'gedit' Text Editor.

00:32 You can use any text editor of your choice.
00:36 To follow this tutorial, you should have working knowledge of Perl programming.
00:41 If not, then go through the relevant Perl spoken tutorials on the spoken tutorial website.
00:48 First, we will learn how to download CPAN modules in Ubuntu Linux OS.
00:55 Switch to the terminal.
00:57 Type sudo space cpan and press Enter. Enter the password if required.
01:06 If cpan is not installed in your system, it will prompt you for the installation process.
01:13 Please proceed with the steps. Your computer must be connected to the internet for the installation process.
01:21 We can see the prompt changes to cpan.
01:26 Say for example, I want to extract some data from a CSV file and use in my Perl program.
01:35 For this, we will use Text colon colon CSV module.
01:40 Before using, we have to install the Text colon colon CSV module.
01:46 Switch to the terminal.
01:48 Type: install Text colon colon CSV and press Enter.
01:55 We can see the installation of corresponding packages of this module.
02:00 Installation will take sometime to complete depending upon your internet speed.
02:06 Now, let us check whether the module is installed successfully or not.
02:12 Hit the 'q' key to exit cpan.
02:16 Type: "instmodsh" and press Enter.
02:23 Type 'l' to list all installed modules.
02:28 Here, we can see Text colon colon CSV which shows that the module is installed in our system.
02:38 Type 'q' to exit.
02:41 Now, I will open candidates.csv which I have already saved.
02:47 Type: gedit candidates.csv and press Enter.
02:53 Here, we can see- name, age, gender and email details of the candidates with a comma separator.
03:02 Now I will open csvtest.pl file in which I have written a Perl program that uses this module.
03:11 This program will extract the name field values which are stored in the csv file.
03:18 use statement loads the Text colon colon CSV module.
03:23 I have declared the "candidates.csv" file to a local variable dollar file.
03:29 The next statement will open the file in READ mode.
03:34 Text colon colon CSV is the class and we can create an instance by calling the constructor with new.
03:42 This line creates an object setting the separator character to be comma (,).
03:48 Here, "while" loop fetches the data, line by line, using the "getline()" method.
03:54 "getline" method returns a reference to an array.
03:58 We need to dereference it, to fetch the value.
04:02 Index of zero represents the name field in the csv file.
04:07 Print statement prints the names from the csv file.
04:11 Now, press Ctrl+S to save the file.
04:15 Let us execute the program.
04:18 Switch back to the terminal and type: perl csvtest.pl and press Enter.
04:27 Here, we can see names field as output.
04:32 Next, let us see how to download required CPAN modules in Windows Operating System.
04:39 When Perl is installed, a utility called PPM ie. Perl Package Module gets installed automatically.
04:48 To use PPM, your computer must be connected to the internet.
04:53 This utility can be used to:

search module install remove and upgrade required modules on Windows Operating System.

05:04 Now, let us open the command window in Windows OS.
05:09 To open the command window, click on Start and type "cmd" and press Enter.
05:17 Type: perl hyphen v to check whether Perl is installed on your Windows OS machine.
05:25 You will see the Perl version number that is installed on your machine.
05:30 If Perl is not installed, refer to the Perl Installation tutorial on this website.
05:36 It will tell you how to install Perl on Windows OS.
05:41 At the “DOS” prompt, type: ppm install Text colon colon CSV and press Enter.
05:49 Please note, module names are case sensitive.
05:53 We can see the installation process has begun. Wait until the installation gets completed.
06:00 I have copied the candidates.csv and csvtest.pl file to the present working directory.
06:08 Let us execute the Perl program now.
06:11 In the command window, type: perl csvtest.pl and press Enter.
06:18 Here is the output.
06:21 This brings us to the end of this tutorial. Let us summarize.
06:26 In this tutorial, we learnt about how to download required CPAN modules in Linux and Windows.
06:34 Here is an assignment for you.

Try to install Date colon colon Calc module. Make use of the given website for module search.

06:47 The video at the following link summarizes the Spoken Tutorial project. Please download and watch it.
06:54 The Spoken Tutorial Project team:

conducts workshops using spoken tutorials and gives certificates on passing online tests.

07:03 For more details, please write to us.
07:06 Spoken Tutorial project is funded by NMEICT, MHRD, Government of India.More information on this mission is available at this link.
07:18 This is Nirmala Venkat from IIT Bombay, signing off. Thanks for watching.

Contributors and Content Editors

PoojaMoolya, Sandhya.np14