PERL/C3/Exception-and-error-handling-in-PERL/Khasi

From Script | Spoken-Tutorial
Revision as of 12:46, 29 August 2017 by Pdiangburom (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Time
Narration
00:01 Khublei ngi pdiangsngewbha iaphi sha ka Spoken Tutorial halor ka Exception and error handling ha ka PERL.
00:06 Ha kane ka jinghikai, ngin ia pule kumno ban:

Catch ia ki errors bad Handle ia ki exceptions.

00:12 Na ka bynta kane ka jinghikai, nga pyndonkam da ka:

Ubuntu Linux 12.04 operating system Perl 5.14.2 bad ka gedit Text Editor.

00:23 Phi lah ban pyndonkam ia kano kano ka text editor katkum kamon jong phi.
00:27 Ban bud ia kane ka jinghikai, phi dei ban don ia ka jingtip shaphang ka Perl programming.
00:32 Lada phim don, te leit sha ki spoken tutorials ba iadei halor ka Perl ha ka spoken tutorial website.
00:39 Ynda ka error ka mih, ka Exception handling ka pynkylla ia ka execution jong ka program na ka normal execution path.
00:47 Error handling ka iarap ban pynioh biang ia ka program, khlem da khang ia ka application.
00:53 Ngi lah ban ithuh bad trap ia ka error ha ki bun ki rukom. Ngin ia peit ia ki katto katne ki methods kiba shait pyndonkam ha ka Perl.
01:01 Ka warn function ka ai tang ia ka khubor kaba maham khlem da shim ia ka sien jam hadien kata.
01:07 Ka die function mar mar ka khang ia ka execution bad ka pyni ia ka error message.
01:13 To ngin ia pyrshang ban sngewthuh ia ka die function da kaba pyndonkam ia ka sample program kaba nga lah dep save lypa.
01:20 Leit sha ka terminal bad type: gedit die dot pl ampersand bad shon Enter.
01:29 Une u dei u code ha ka 'die.pl' file. To mynta ngin ia pyrshang ban sngewthuh ia une u code.
01:35 Hangne, ngi lah define ia ka function divide kaba shim ia ar tylli ki input parameters

kata dollar numerator bad dollar denominator.

01:46 At the rate underscore (@_) udei u special variable uba la pyndonkam ban pass ia ka parameter list sha ka function.
01:53 Lada u denominator udei zero, u die function un sa iehnoh ia ka script.
01:57 Kan sa pyni ruh ia ka error message na ka bynta ki nongpyndonkam ban pule. Lymda kumta, kan sa print ia ka output.
02:05 Kine kidei ki function call statements.
02:08 Ki ar tylli ki jingleh ba ha shwa, lah execute ia ka function namar ka parameter ba ar kam dei zero.
02:15 Ka jingleh balai, u denominator value udei zero. Te, ka die function kan sa execute.
02:23 Ka divide function ba khatduh kan nym execute namar ba ka die function ka iehnoh ia ka script.
02:29 Shon Ctrl + S ban save ia ka program.
02:32 To ngin ia execute ia ka program.
02:35 Phai biang sha ka terminal bad type: perl die dot pl bad shon Enter.
02:43 Ka output ka lah paw kumba pyni hangne.

"Can't divide by zero!"

02:49 Kane kadei ka error message kaba ngi lah ai ha ka program, ha ka die statement.
02:54 Hadien kane, ngin sa iohi kumno ban pyndonkam ia ka eval function ha ka error handling.
03:00 eval function lah pyndonkam na ka bynta ka handling run-time errors lane exceptions.
03:06 Kum ka nuksa, built-in errors kum ka out of memory, divide by zero lane user defined errors.
03:14 Ka general syntax na ka bynta ka eval function la pyni hangne.
03:19 Ka dollar exclamation($!) special variable ka buh ia ka error message, lada don.
03:25 Lymda kumta, ka dollar exclamation( $!) holds an empty string. Kaba mut ia ka la evaluate kum false.
03:33 To ngin ia pyrshang ban sngewthuh ia ka eval function da kaba pyndonkam ia ka sample program.

Leit sha ka terminal.

03:40 Type: gedit eval dot pl ampersand bad shon Enter.
03:47 Ha ka eval dot pl file, type ia u code harum kumba la pyni ha ka screen. To ngin ia batai mynta ia u code.
03:54 Hangne, ha ka nuksa jong ngi, open FILE ka pyntreikam ia ka die statement, lada don ia ka jingeh ha kaban plie ia ka “test.dat”.
04:05 Perl ka ai ia ka system error message na ka eval block ba khatduh sha ka variable dollar exclamation( $!).
04:13 Shon Ctrl + S ban save ia ka file.
04:17 Phai biang sha ka terminal bad type: perl eval dot pl bad shon Enter.
04:25 Ka system error message ka paw kumba la pyni.
04:30 To ngin ia peit ia kiwei pat ka nuksa. Ha kane ka program, ngin sa iohi ia ka error message kaba pynphai na ka eval function da kaba pyndonkam ia ka '$@' (dollar at the rate).
04:40 To ngin ia phai biang sha ka eval dot pl file.
04:44 Type ia u code kumba la pyni ha ka screen.
04:48 Ngi ia pass ia ka $total, $count kum ka input parameters sha ka function average.
04:56 Ngi lah ban ioh ia ka error lada ka count kadei zero.
05:00 Hangne, lah peit ia ka da ka die statement.
05:04 Ka error message kaba pynphai na ka eval kapaw da kaba pyndonkam ia ka $@ ( dollar at the rate).
05:11 Lada kam paw, kan sa print ia ka Average value.
05:15 Shon Ctrl +S ban save ia ka file. To ngin ia execute ia ka program.
05:22 Phai biang sha ka terminal bad type: perl eval.pl bad shon Enter.
05:31 Ka output kadei kumba la pyni hangne.
05:35 Da kane ngi la poi sha kaba kut jong kane ka jinghikai. To ngin ia batai kyllum.
05:41 Ha kane ka jinghikai, ngi lah pule kumno ban:

Catch ia ki error bad Handle ia ki exceptions.

05:47 Kum ka kam, leh ia kane harum.

Ha ka Linux machine jong phi, shna ia ka file 'emp.txt' ryngkat 5 tylli ki kyrteng jong ki employee

05:57 Pynkylla ia ka permission jong ka 'emp.txt' sha ka READ only.
06:02 Kynmaw: Leit sha ka Linux spoken tutorials ba iadei ha ka spoken tutorial website na ka bynta ka change permission
06:10 Thoh ia ka Perl program ban plie ia ka 'emp.txt' file ha ka WRITE mode bad pyndap katto katne ki kyrteng jong ki employee ha ka.
06:19 Pyndonkam ia ka "eval", print ia ka error message ba iadei lada ka open/write operation kam treikam.
06:26 Ka video ha ka link harum ka kyllum lang ia ka Spoken Tutorial project. Sngewbha download bad peit ia ka.
06:33 Ka kynhun jong ka Spoken Tutorial Project:

Ka pynlong ia ki workshops da kaba pyndonkam ia ki spoken tutorials bad Ka ai ia ki certificates sha kito kiba pass ha ka online tests.

06:42 Na ka bynta ki jingtip ba bniah, sngewbha thoh sha ngi.
06:46 Ia ka Spoken Tutorial project la bei tyngka da ka NMEICT, MHRD, Sorkar India.
06:53 Kham bun ki jingtip halor kane ka mission kidon ha kane ka link.
06:58 Ma nga u Pdiangburom na Shillong, nga pynkut ia kane. Khublei shibun.

Contributors and Content Editors

Pdiangburom