Difference between revisions of "PERL/C3/Downloading-CPAN-module/English-timed"
From Script | Spoken-Tutorial
PoojaMoolya (Talk | contribs) (Created page with "{| border =1 | '''Time''' | '''Narration''' |- | 00:01 | Welcome to the''' Spoken Tutorial''' on''' Downloading CPAN modules.''' |- | 00:06 | In this tutorial we will learn...") |
Sandhya.np14 (Talk | contribs) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 9: | Line 9: | ||
|- | |- | ||
| 00:06 | | 00:06 | ||
− | | In this tutorial we will learn how to download required '''CPAN modules '''in | + | | In this tutorial, we will learn how to download required '''CPAN modules '''in '''Ubuntu Linux Operating System '''and |
− | + | '''Windows Operating System'''. | |
− | + | ||
− | + | ||
|- | |- | ||
| 00:17 | | 00:17 | ||
− | | To record this tutorial, I am using | + | | To record this tutorial, I am using: |
− | + | '''Ubuntu Linux 12.04''' operating system, | |
− | + | '''Windows 7''', '''Perl''' 5.14.2 and ''''gedit' Text Editor'''. | |
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
Line 37: | Line 32: | ||
|- | |- | ||
| 00:48 | | 00:48 | ||
− | | First we will learn how to download '''CPAN modules''' in''' Ubuntu Linux OS'''. | + | | First, we will learn how to download '''CPAN modules''' in''' Ubuntu Linux OS'''. |
|- | |- | ||
| 00:55 | | 00:55 | ||
− | | Switch to the | + | | Switch to the terminal. |
|- | |- | ||
| 00:57 | | 00:57 | ||
− | | Type '''sudo | + | | Type '''sudo space cpan''' and press '''Enter.''' Enter the password if required. |
|- | |- | ||
| 01:06 | | 01:06 | ||
− | | If cpan is not installed in your system, it will prompt you for the installation process. | + | | If '''cpan''' is not installed in your system, it will prompt you for the installation process. |
− | + | ||
|- | |- | ||
Line 62: | Line 56: | ||
|- | |- | ||
| 01:26 | | 01:26 | ||
− | | Say for example, I want to extract some data from a '''CSV | + | | Say for example, I want to extract some data from a '''CSV''' file and use in my '''Perl''' program. |
|- | |- | ||
Line 70: | Line 64: | ||
|- | |- | ||
| 01:40 | | 01:40 | ||
− | | Before using, we have to install the''' Text colon colon CSV | + | | Before using, we have to install the''' Text colon colon CSV''' module. |
|- | |- | ||
Line 78: | Line 72: | ||
|- | |- | ||
| 01:48 | | 01:48 | ||
− | | Type''' | + | | Type: '''install Text colon colon CSV''' and press '''Enter.''' |
|- | |- | ||
| 01:55 | | 01:55 | ||
− | | We can see the installation of corresponding packages of this | + | | We can see the installation of corresponding packages of this module. |
|- | |- | ||
Line 90: | Line 84: | ||
|- | |- | ||
| 02:06 | | 02:06 | ||
− | | Now let us check whether the | + | | Now, let us check whether the module is installed successfully or not. |
|- | |- | ||
| 02:12 | | 02:12 | ||
− | | Hit the 'q' key to exit cpan. | + | | Hit the 'q' key to exit '''cpan'''. |
|- | |- | ||
| 02:16 | | 02:16 | ||
− | | Type | + | | Type: "instmodsh" and press '''Enter'''. |
|- | |- | ||
| 02:23 | | 02:23 | ||
− | | Type | + | | Type 'l' to list all installed modules. |
|- | |- | ||
| 02:28 | | 02:28 | ||
− | | Here we can see''' Text colon colon CSV | + | | Here, we can see''' Text colon colon CSV '''which shows that the module is installed in our system. |
|- | |- | ||
Line 114: | Line 108: | ||
|- | |- | ||
| 02:41 | | 02:41 | ||
− | | Now I will open | + | | Now, I will open '''candidates.csv ''' which I have already saved. |
|- | |- | ||
| 02:47 | | 02:47 | ||
− | | Type | + | | Type: '''gedit candidates.csv '''and press''' Enter.''' |
|- | |- | ||
| 02:53 | | 02:53 | ||
− | | Here we can see name, age, gender and email details of the candidates with a comma separator. | + | | Here, we can see- name, age, gender and email details of the candidates with a comma separator. |
|- | |- | ||
| 03:02 | | 03:02 | ||
− | | Now I will open '''csvtest.pl''' file in which I have written a '''Perl''' program that uses this | + | | Now I will open '''csvtest.pl''' file in which I have written a '''Perl''' program that uses this module. |
|- | |- | ||
| 03:11 | | 03:11 | ||
− | | This program will extract the name field values which are stored in the''' csv | + | | This program will '''extract''' the '''name field''' values which are stored in the''' csv''' file. |
|- | |- | ||
| 03:18 | | 03:18 | ||
− | | '''use '''statement loads the '''Text colon colon CSV | + | | '''use '''statement loads the '''Text colon colon CSV''' module. |
|- | |- | ||
| 03:23 | | 03:23 | ||
− | | I have declared the | + | | I have declared the "candidates.csv" file to a '''local variable''' '''dollar file'''. |
|- | |- | ||
| 03:29 | | 03:29 | ||
− | | The next statement will open the file in '''READ''' mode | + | | The next statement will open the file in '''READ''' mode. |
|- | |- | ||
| 03:34 | | 03:34 | ||
− | | '''Text colon colon CSV''' is the class and we can create an instance | + | | '''Text colon colon CSV''' is the '''class''' and we can create an '''instance''' by calling the '''constructor''' with '''new.''' |
|- | |- | ||
| 03:42 | | 03:42 | ||
− | | This line creates an object setting the separator character to be comma (,). | + | | This line creates an '''object''' setting the separator character to be comma (,). |
|- | |- | ||
| 03:48 | | 03:48 | ||
− | | Here, | + | | Here, "while" loop fetches the data, line by line, using the "getline()" '''method'''. |
|- | |- | ||
| 03:54 | | 03:54 | ||
− | | | + | | "getline" '''method''' returns a '''reference''' to an '''array'''. |
|- | |- | ||
Line 166: | Line 160: | ||
|- | |- | ||
| 04:02 | | 04:02 | ||
− | | Index of zero represents the name field in the csv file. | + | | '''Index''' of zero represents the '''name field''' in the '''csv''' file. |
|- | |- | ||
| 04:07 | | 04:07 | ||
− | | '''Print''' statement prints the names from the csv file. | + | | '''Print''' statement prints the names from the '''csv''' file. |
|- | |- | ||
| 04:11 | | 04:11 | ||
− | | Now, press''' Ctrl+S''' to save the file. | + | | Now, press''' Ctrl+S''' to '''save''' the file. |
|- | |- | ||
| 04:15 | | 04:15 | ||
− | | Let us execute the program. | + | | Let us '''execute''' the program. |
|- | |- | ||
| 04:18 | | 04:18 | ||
− | | Switch back to the | + | | Switch back to the terminal and type: '''perl csvtest.pl''' and press''' Enter'''. |
|- | |- | ||
| 04:27 | | 04:27 | ||
− | | Here we can see names field as output. | + | | Here, we can see names field as output. |
|- | |- | ||
Line 194: | Line 188: | ||
|- | |- | ||
| 04:39 | | 04:39 | ||
− | | When '''Perl '''is installed, a utility called''' PPM ie. Perl Package Module''' | + | | When '''Perl '''is installed, a utility called''' PPM''' ie. '''Perl Package Module''' gets installed automatically. |
|- | |- | ||
Line 202: | Line 196: | ||
|- | |- | ||
| 04:53 | | 04:53 | ||
− | | This utility can be used to | + | | This utility can be used to: |
− | + | search module | |
− | + | install | |
− | + | remove and | |
− | + | upgrade | |
− | + | required modules on '''Windows Operating System'''. | |
− | + | ||
− | required | + | |
|- | |- | ||
| 05:04 | | 05:04 | ||
− | | Now let us open the command window in '''Windows OS'''. | + | | Now, let us open the command window in '''Windows OS'''. |
|- | |- | ||
| 05:09 | | 05:09 | ||
− | | To open the '''command window''', click on '''Start '''and type | + | | To open the '''command window''', click on '''Start '''and type "cmd" and press '''Enter.''' |
|- | |- | ||
| 05:17 | | 05:17 | ||
− | | Type '''perl hyphen v ''' to | + | | Type: '''perl hyphen v ''' to check whether '''Perl''' is installed on your '''Windows OS''' machine. |
|- | |- | ||
Line 229: | Line 221: | ||
|- | |- | ||
| 05:30 | | 05:30 | ||
− | | If | + | | If Perl is not installed, refer to the '''Perl Installation''' tutorial on this website. |
|- | |- | ||
Line 237: | Line 229: | ||
|- | |- | ||
| 05:41 | | 05:41 | ||
− | | At the | + | | At the “DOS” prompt, type: '''ppm install Text colon colon CSV''' and press '''Enter.''' |
|- | |- | ||
Line 253: | Line 245: | ||
|- | |- | ||
| 06:08 | | 06:08 | ||
− | | Let us execute the '''Perl '''program now. | + | | Let us '''execute''' the '''Perl '''program now. |
|- | |- | ||
| 06:11 | | 06:11 | ||
− | | In the '''command window''' type '''perl csvtest.pl''' and press''' Enter'''. | + | | In the '''command window''', type: '''perl csvtest.pl''' and press''' Enter'''. |
|- | |- | ||
Line 265: | Line 257: | ||
|- | |- | ||
| 06:21 | | 06:21 | ||
− | | This brings us to the end of this tutorial. Let us | + | | This brings us to the end of this tutorial. Let us summarize. |
|- | |- | ||
| 06:26 | | 06:26 | ||
− | | In this tutorial we learnt about how to download required CPAN modules in | + | | In this tutorial, we learnt about how to download required '''CPAN modules''' in '''Linux''' and '''Windows'''. |
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
| 06:34 | | 06:34 | ||
| Here is an assignment for you. | | 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 | | 06:47 | ||
− | | The video at the following link | + | | The video at the following link summarizes the Spoken Tutorial project. Please download and watch it. |
|- | |- | ||
| 06:54 | | 06:54 | ||
− | | The''' Spoken Tutorial Project''' | + | | The''' Spoken Tutorial Project''' team: |
− | + | conducts workshops using spoken tutorials and | |
− | + | gives certificates on passing online tests. | |
− | + | ||
|- | |- | ||
Line 298: | Line 285: | ||
|- | |- | ||
| 07:06 | | 07:06 | ||
− | | Spoken Tutorial project is funded by NMEICT, MHRD, Government of India. | + | | Spoken Tutorial project is funded by NMEICT, MHRD, Government of India.More information on this mission is available at this link. |
− | + | ||
− | More information on this mission is available at this link. | + | |
|- | |- | ||
| 07:18 | | 07:18 | ||
− | | This is Nirmala Venkat from IIT Bombay, signing off. Thanks for watching. | + | | This is Nirmala Venkat from '''IIT Bombay''', signing off. Thanks for watching. |
|} | |} |
Latest revision as of 20:15, 10 October 2017
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. |