BTC USD 81,068.1 Gold USD 4,378.12
Time now: Jun 1, 12:00 AM

Belajar Perl

ni pc zaman purba..

32bit

sysinfoo.jpg


dah agak dah ni mesti masalah pc atau os.. btw memang tak boleh buat apa2 ke? Kalau boleh tak nak usik laptop lain.. nak guna pc dan os ni jugak...

cuba check apa version perl yang you pakai:

c:\perl -v
 
cuba check apa version perl yang you pakai:

c:\perl -v


C:\>perl -v

This is perl 5, version 16, subversion 2 (v5.16.2) built for MSWin32-x86-multi-t
hread
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2012, Larry Wall

Binary build 1602 [296513] provided by ActiveState http://www.ActiveState.com
Built Dec 19 2012 12:35:59

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.


C:\>perl -V
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Summary of my perl5 (revision 5 version 16 subversion 2) configuration:

Platform:
osname=MSWin32, osvers=5.2, archname=MSWin32-x86-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='C:\Perl\site\bin\gcc.exe', ccflags ='-DNDEBUG -DWIN32 -D_CONSOLE -DNO_ST
RICT -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_
IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T -DHASATTRIBUTE -fno-strict-aliasin
g -mms-bitfields',
optimize='-O2',
cppflags='-DWIN32'
ccversion='', gccversion='3.4.5 (mingw-vista special r3)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksi
ze=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='C:\Perl\site\bin\g++.exe', ldflags ='-L"C:\Perl\lib\CORE"'
libpth=\lib
libs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32
-lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -
lodbccp32 -lcomctl32 -lmsvcrt
perllibs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshel
l32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc
32 -lodbccp32 -lcomctl32 -lmsvcrt
libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl516.lib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-mdll -L"C:\Perl\lib\CORE"'


Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY
PERLIO_LAYERS PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS
PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PL_OP_SLAB_ALLOC
USE_ITHREADS USE_LARGE_FILES USE_LOCALE
USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_SITECUSTOMIZE
Locally applied patches:
ActivePerl Build 1602 [296513]
Built under MSWin32
Compiled at Dec 19 2012 12:35:59
@INC:
C:/Perl/site/lib
C:/Perl/lib
.

C:\>
 
Nampak gaya kena install module manually. Tapi sebelum itu, kita cuba yg mudah sikit guna Perl Package Manager. Just run dia dan pilih Win32::GUI.



C:\>perl -v

This is perl 5, version 16, subversion 2 (v5.16.2) built for MSWin32-x86-multi-t
hread
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2012, Larry Wall

Binary build 1602 [296513] provided by ActiveState http://www.ActiveState.com
Built Dec 19 2012 12:35:59

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.


C:\>perl -V
Set up gcc environment - 3.4.5 (mingw-vista special r3)
Summary of my perl5 (revision 5 version 16 subversion 2) configuration:

Platform:
osname=MSWin32, osvers=5.2, archname=MSWin32-x86-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='C:\Perl\site\bin\gcc.exe', ccflags ='-DNDEBUG -DWIN32 -D_CONSOLE -DNO_ST
RICT -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_
IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T -DHASATTRIBUTE -fno-strict-aliasin
g -mms-bitfields',
optimize='-O2',
cppflags='-DWIN32'
ccversion='', gccversion='3.4.5 (mingw-vista special r3)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksi
ze=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='C:\Perl\site\bin\g++.exe', ldflags ='-L"C:\Perl\lib\CORE"'
libpth=\lib
libs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32
-lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -
lodbccp32 -lcomctl32 -lmsvcrt
perllibs=-lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshel
l32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc
32 -lodbccp32 -lcomctl32 -lmsvcrt
libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl516.lib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-mdll -L"C:\Perl\lib\CORE"'


Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES HAVE_INTERP_INTERN MULTIPLICITY
PERLIO_LAYERS PERL_DONT_CREATE_GVSV
PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS
PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PL_OP_SLAB_ALLOC
USE_ITHREADS USE_LARGE_FILES USE_LOCALE
USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_SITECUSTOMIZE
Locally applied patches:
ActivePerl Build 1602 [296513]
Built under MSWin32
Compiled at Dec 19 2012 12:35:59
@INC:
C:/Perl/site/lib
C:/Perl/lib
.

C:\>
 
Maaf yea saya tak akan dapat nak reply semua soalan anda dengan cepat memandangkan masa yang limited :)
 
Nampak gaya kena install module manually. Tapi sebelum itu, kita cuba yg mudah sikit guna Perl Package Manager. Just run dia dan pilih Win32::GUI.

sebelum ni dah pernah try command line ppm install Win32::GUI tapi tak jadi jugak.. ajar install secara manual terus la bro.. macam mana tu? kena download file Win32-GUI-1.06.tar.gz ke? :-?

Maaf yea saya tak akan dapat nak reply semua soalan anda dengan cepat memandangkan masa yang limited :)

tak kisah la reply lambat pun.. belajar perl ni pun suka2 je :D
 
use Win32::GUI();

$text = defined($ARGV[0]) ? $ARGV[0] : "HELLO, World";

$main = Win32::GUI::Window->new (
-name => 'Main',
-text => 'Perl',
);

$font = Win32::GUI::Font->new (
-name => "Comic Sans MS",
-size => 14,
);

$label = $main->Addlabel (
-text => $text,
-font => $font,
-foreground => [255, 0, 0],
);

$ncw = $main->Width() - $main->ScaleWidth();
$nch = $main->Height() - $main->ScaleHeight();
$w = $label->Width() + $ncw;
$h = $label->Height() + $nch;

$desk = Win32::GUI::GetDesktopWindow();
$dw = Win32::GUI::Width($desk);
$dh = Win32::GUI::Height($desk);
$x = ($dw - $w) / 2;
$y = ($dh - $h) / 2;

$main ->Change(-minsize => [$w, $h]);
$main ->Resize($w, $h);
$main ->Move($x, $y);
$main ->Show();

Win32::GUI::Dialog();

sub Main_Terminate {
-1;
**

sub Main_Resize {
my $mw = $main->ScaleWidth();
my $mh = $main->ScaleHeight();
my $lw = $label->Width();
my $lh = $label->Height();

$label->left(int(($mw - $lw) / 2));
$label->Top(int(($mh - $lh) / 2));
**


SIFU...kat mana salah ni??bila execute je keluar cmd skjp..pastu diam je...~X(~X(
 
sebelum ni dah pernah try command line ppm install Win32::GUI tapi tak jadi jugak.. ajar install secara manual terus la bro.. macam mana tu? kena download file Win32-GUI-1.06.tar.gz ke? :-?



tak kisah la reply lambat pun.. belajar perl ni pun suka2 je :D

Guna ppm through command line akan popup windows GUI perl package manager kan. Dah try tapi tak boleh juga ke? Apa error dia kata?
 
use Win32::GUI();

$text = defined($ARGV[0]) ? $ARGV[0] : "HELLO, World";

$main = Win32::GUI::Window->new (
-name => 'Main',
-text => 'Perl',
);

$font = Win32::GUI::Font->new (
-name => "Comic Sans MS",
-size => 14,
);

$label = $main->Addlabel (
-text => $text,
-font => $font,
-foreground => [255, 0, 0],
);

$ncw = $main->Width() - $main->ScaleWidth();
$nch = $main->Height() - $main->ScaleHeight();
$w = $label->Width() + $ncw;
$h = $label->Height() + $nch;

$desk = Win32::GUI::GetDesktopWindow();
$dw = Win32::GUI::Width($desk);
$dh = Win32::GUI::Height($desk);
$x = ($dw - $w) / 2;
$y = ($dh - $h) / 2;

$main ->Change(-minsize => [$w, $h]);
$main ->Resize($w, $h);
$main ->Move($x, $y);
$main ->Show();

Win32::GUI::Dialog();

sub Main_Terminate {
-1;
**

sub Main_Resize {
my $mw = $main->ScaleWidth();
my $mh = $main->ScaleHeight();
my $lw = $label->Width();
my $lh = $label->Height();

$label->left(int(($mw - $lw) / 2));
$label->Top(int(($mh - $lh) / 2));
**


SIFU...kat mana salah ni??bila execute je keluar cmd skjp..pastu diam je...~X(~X(

You kena masuk command prompt. Bukan double click terus execute. Kalau tak u tak akan nampak error message dia apa.

Dalam command prompt kena taip:

c:\perl <nama script u>
cotoh:
c:\perl test.pl

error akan beritahu line berapa ada error dan you perbaiki line tersebut sahaja. :)
Guna vi editor macam saya beritahu kat awal2 thread kalau nak edit, sebab senang nak cari line number ke berapa. Kalau pakai Notepad susah u nak kena kira setiap baris.
 
use Win32::GUI();

$text = defined($ARGV[0]) ? $ARGV[0] : "HELLO, World";

$main = Win32::GUI::Window->new (
-name => 'Main',
-text => 'Perl',
);

$font = Win32::GUI::Font->new (
-name => "Comic Sans MS",
-size => 14,
);

$label = $main->Addlabel (
-text => $text,
-font => $font,
-foreground => [255, 0, 0],
);

$ncw = $main->Width() - $main->ScaleWidth();
$nch = $main->Height() - $main->ScaleHeight();
$w = $label->Width() + $ncw;
$h = $label->Height() + $nch;

$desk = Win32::GUI::GetDesktopWindow();
$dw = Win32::GUI::Width($desk);
$dh = Win32::GUI::Height($desk);
$x = ($dw - $w) / 2;
$y = ($dh - $h) / 2;

$main ->Change(-minsize => [$w, $h]);
$main ->Resize($w, $h);
$main ->Move($x, $y);
$main ->Show();

Win32::GUI::Dialog();

sub Main_Terminate {
-1;
**

sub Main_Resize {
my $mw = $main->ScaleWidth();
my $mh = $main->ScaleHeight();
my $lw = $label->Width();
my $lh = $label->Height();

$label->left(int(($mw - $lw) / 2));
$label->Top(int(($mh - $lh) / 2));
**


SIFU...kat mana salah ni??bila execute je keluar cmd skjp..pastu diam je...~X(~X(

Dari apa yg I check I nampak error banyak pada basic principle of scripting yg you salah buat. Yang ini you kena pastikan you buat dengan betul.

Contoh basic guideline nak buat functions dalam Perl ialah:



HTML:
sub function_name {**





Kemudian selalu error2 ni jugak disebabkan kita salah taip, tertinggal character, terlupa letak penutup function dsbnya. So asas kena tau dulu kemudian kena tau macam mana nak trace error,
baru senang.

InshaAllah pelan2 kayoh..



****Dalam CG ni nak copy paste coding guna CODE tag ke, HTML tag ke, PHP tag ke nampaknya ada problem... di akan tukarkan right parenthesis jadi ** :-?
****Untuk siapa yg subscribe belajar Perl I akan buat menggunakan video tutorial... direct dari PC I. So senang u all nak faham :)
 
Last edited:
You kena masuk command prompt. Bukan double click terus execute. Kalau tak u tak akan nampak error message dia apa.

Dalam command prompt kena taip:

c:\perl <nama script u>
cotoh:
c:\perl test.pl

error akan beritahu line berapa ada error dan you perbaiki line tersebut sahaja. :)
Guna vi editor macam saya beritahu kat awal2 thread kalau nak edit, sebab senang nak cari line number ke berapa. Kalau pakai Notepad susah u nak kena kira setiap baris.

lupa plak SIFU..kene execute guna command prompt..:p:p

ptt laa tak jadi2...:eek::eek:

Dari apa yg I check I nampak error banyak pada basic principle of scripting yg you salah buat. Yang ini you kena pastikan you buat dengan betul.

Contoh basic guideline nak buat functions dalam Perl ialah:



HTML:
sub function_name {**





Kemudian selalu error2 ni jugak disebabkan kita salah taip, tertinggal character, terlupa letak penutup function dsbnya. So asas kena tau dulu kemudian kena tau macam mana nak trace error,
baru senang.

InshaAllah pelan2 kayoh..




****PS: Untuk siapa yg subscribe belajar Perl I akan buat menggunakan video tutorial... direct dari PC I. So senang u all nak faham :)

yg ni tak brp cerah ni SIFU...

principle scripting mcm mn tu??
 
Back
Top
Log in Register