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) |
||
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 | * '''Ubuntu Linux Operating System '''and | ||
− | * '''Windows Operating System''' | + | * '''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 | * '''Ubuntu Linux 12.04''' operating system | ||
* '''Windows 7''' | * '''Windows 7''' | ||
− | * '''Perl 5.14.2 | + | * '''Perl 5.14.2''' and |
− | * '''gedit | + | * ''''gedit' Text Editor'''. |
|- | |- | ||
Line 41: | Line 39: | ||
|- | |- | ||
| 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 70: | Line 67: | ||
|- | |- | ||
| 01:40 | | 01:40 | ||
− | | Before using, we have to install the''' Text colon colon CSV module''' | + | | Before using, we have to install the''' Text colon colon CSV module'''. |
|- | |- | ||
Line 90: | Line 87: | ||
|- | |- | ||
| 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 modules is installed in our system. |
|- | |- | ||
Line 114: | Line 111: | ||
|- | |- | ||
| 02:41 | | 02:41 | ||
− | | Now I will open the '''candidates.csv ''' which | + | | Now, I will open the '''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 163: | ||
|- | |- | ||
| 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. |
|- | |- | ||
Line 182: | Line 179: | ||
|- | |- | ||
| 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 191: | ||
|- | |- | ||
| 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 199: | ||
|- | |- | ||
| 04:53 | | 04:53 | ||
− | | This utility can be used to | + | | This utility can be used to: |
− | + | ||
* search module | * search module | ||
* install | * install | ||
* remove and | * remove and | ||
* upgrade | * 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 224: | ||
|- | |- | ||
| 05:30 | | 05:30 | ||
− | | If | + | | If Perl is not installed, refer to the '''Perl installation tutorial''' on this website. |
|- | |- | ||
Line 237: | Line 232: | ||
|- | |- | ||
| 05:41 | | 05:41 | ||
− | | At the | + | | At the “DOS” prompt, type: '''ppm install Text colon colon CSV''' and press '''Enter.''' |
|- | |- | ||
Line 253: | Line 248: | ||
|- | |- | ||
| 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 260: | ||
|- | |- | ||
| 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 | * '''Linux''' and | ||
− | * '''Windows''' | + | * '''Windows'''. |
|- | |- | ||
Line 279: | Line 273: | ||
# Try to install''' Date colon colon Calc''' module. | # Try to install''' Date colon colon Calc''' module. | ||
− | # Make use of the given website for module search | + | # 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 | * conducts workshops using spoken tutorials and | ||
* gives certificates on passing online tests. | * gives certificates on passing online tests. | ||
Line 304: | Line 297: | ||
|- | |- | ||
| 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. |
|} | |} |
Revision as of 15:22, 15 July 2016
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
|
00:17 | To record this tutorial, I am using:
|
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 modules is installed in our system. |
02:38 | Type 'q' to exit. |
02:41 | Now, I will open the 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:
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
|
06:34 | Here is an assignment for you.
|
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:
|
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. |