RPC
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hello, I'm currently creating a program that will use RPC. I have installed Event-RPC, PlRPC and DCE-Perl-RPC using PPM but I'm still having errors during compilation. What are the other needed packages? I'm using ActivePerl for windows and testing the code from CPAN (http://search.cpan.org/~jred/Event-RPC-0.85/lib/Event/RPC.pm) Thanks, Michael Louie Loria -BEGIN PGP SIGNATURE- Comment: Public Key: https://www.biglumber.com/x/web?qs=0x4A256EC8 Comment: Public Key: http://www.lorztech.com/GPG.txt Comment: Google, Skype, Yahoo ID: michaellouieloria iQEVAwUBQyGnLbXBHi2y3jwfAQqFvggAk77E/IEIBmn+N+Pyqzi/QyLbJoSf3WiS oGuWDDvam3H5ZwZXAA9gyb3ahHHs1Y8OJDm7T6+QZTgo8RFz9GfwbG0WExYMIA1N gOYL53JJZoJOKXzKzqe6qd7VBklM7DwqwOX0wXE2jhYCMqG7Kz5nRu/S2yN4XMzW yPC43GJbQ1vDd7eYhIYSjAG2XVQEKJb4/tGGl3dkYmP0BHOeJ0m9wwrUo7IuuiFq nEBAAUyjg7Ek1N7eVyPv0nDBUrz+FYH4H0s6auOmERM5umEwa2IRouXS8REGep+j r6bfwoFmCORh4HWXmSh4LC+lwdQLH7Hzu+32yBC+a1stec7XEuWNnQ== =6sxs -END PGP SIGNATURE- --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0536-2, 09/07/2005 Tested on: 9/9/2005 8:16:04 AM avast! - copyright (c) 1988-2005 ALWIL Software. http://www.avast.com -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.10.19/92 - Release Date: 9/7/2005 __ Click here to donate to the Hurricane Katrina relief effort. http://store.yahoo.com/redcross-donate3/ ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Split function in Perl
$Bill Luebkert wrote: > Michael Louie Loria wrote: > > >>I'm tesing the Text::ParseWords >> >>I'm new in Perl and I'm a little bit confused with the PATTERNS >>option but I'm learning it. >> >>Is this code good for checking valid date in the format -MM-DD? >>or do you have any other suggestions > > > What's with the ~'s starting each line ? > > >>sub isvaliddate { >>~ my $input = shift; >>~ if ($input =~ m!^((?:19|20)\d\d)[- /.](0[1-9]|1[012])[- >>/.](0[1-9]|[12][0-9]|3[01])$!) { >>~# At this point, $1 holds the year, $2 the month and $3 the day >>of the date entered >>~if ($3 == 31 and ($2 == 4 or $2 == 6 or $2 == 9 or $2 == 11)) { >>~ return 0; # 31st of a month with 30 days >>~} elsif ($3 >= 30 and $2 == 2) { >>~ return 0; # February 30th or 31st >>~} elsif ($2 == 2 and $3 == 29 and not ($1 % 4 == 0 and ($1 % 100 >><> 0 or $1 % 400 == 0))) { >>~ return 0; # February 29th outside a leap year >>~} else { >>~ return 1; # Valid date >>~} >>~ } else { >>~return 0; # Not a date >>~ } >>} >> >>The link for that code is >>http://www.regular-expressions.info/dates.html coz you might not >>understand the code > > > # test a few examples: > > foreach ('2005-02-30', '2005-04-31', '2005-13-30', '2005-02-35', '2005-02-00', > '2005-01-30',) { > > my $bool = isvaliddate ($_);# your code > printf "$_ is%s valid\n", $bool ? '' : ' not'; > > $bool = is_valid_date ($_); # alternative code > printf "$_ is%s valid\n", $bool ? '' : ' not'; > } > exit; > > # Reformatted it and changed <> to != and it seems ok to me : > > sub isvaliddate { > my $input = shift; > > # you could just use substr's and length() here instead of a RE > # for hopefully a little more speed : > > # return 0 if length $input != 10 or substr ($input, 4, 1) ne '-' > # or substr ($input, 7, 1) ne '-'; > # my $year = substr $input, 0, 4; > # my $month = substr $input, 5, 2; > # my $day = substr $input, 8, 2; > # then replace $1, $2 and $3 with $year, $month and $day > > if ($input !~ > m#^((?:19|20)\d\d)[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$#) { > return 0; # Not a date > } > > # $1 = year, $2 = month $3 = day of month > > if ($3 == 31 and ($2 == 4 or $2 == 6 or $2 == 9 or $2 == 11)) { > return 0; # 31st of a month with 30 days > } elsif ($3 >= 30 and $2 == 2) { > return 0; # February 30th or 31st > } elsif ($2 == 2 and $3 == 29 and not ($1 % 4 == 0 and > ($1 % 100 != 0 or $1 % 400 == 0))) {# <> 0 was wrong for != 0 > return 0; # February 29th outside a leap year > } > return 1; # Valid date > > } > > This should work as well (maybe better) - letting the system do most of the > grunt work but is much slower than yours : > > sub is_valid_date { > my $datestr = shift; > require Time::Local; > > my @d = (0, 0, 12, (split /-/, $datestr)[2, 1, 0]); > $d[4]--; $d[5] -= 1900; > eval "Time::Local::timegm ([EMAIL PROTECTED])"; # see if it converts to > epoch ok > return $@ ? 0 : 1;# return 0 if error else 1 > > } > > __END__ > > Sorry for the ~ character. My MUA added it. I have tested the code and is really good but I had to change a line of code elsif ($2 == 2 and $3 == 29 and not ($1 % 4 == 0 and ($1 % 100 <> 0 or $1 % 400 == 0))) to elsif ($2 == 2 and $3 == 29 and ($1 % 4 != 0 and ($1 % 100 == 0 or $1 % 400 != 0))) coz I had errors with the former. I think the culprit was the NOT [ not ($1 % 4 == 0 and ($1 % 100 <> 0 or $1 % 400 == 0) ]. Thanks again Michael Louie Loria __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com signature.asc Description: 3412282408-signature.asc ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Split function in Perl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Thanks for all the replies. I'm tesing the Text::ParseWords I'm new in Perl and I'm a little bit confused with the PATTERNS option but I'm learning it. Is this code good for checking valid date in the format -MM-DD? or do you have any other suggestions sub isvaliddate { ~ my $input = shift; ~ if ($input =~ m!^((?:19|20)\d\d)[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$!) { ~# At this point, $1 holds the year, $2 the month and $3 the day of the date entered ~if ($3 == 31 and ($2 == 4 or $2 == 6 or $2 == 9 or $2 == 11)) { ~ return 0; # 31st of a month with 30 days ~} elsif ($3 >= 30 and $2 == 2) { ~ return 0; # February 30th or 31st ~} elsif ($2 == 2 and $3 == 29 and not ($1 % 4 == 0 and ($1 % 100 <> 0 or $1 % 400 == 0))) { ~ return 0; # February 29th outside a leap year ~} else { ~ return 1; # Valid date ~} ~ } else { ~return 0; # Not a date ~ } } The link for that code is http://www.regular-expressions.info/dates.html coz you might not understand the code Thanks, Michael Louie Loria -BEGIN PGP SIGNATURE- Comment: Public Key: https://www.biglumber.com/x/web?qs=0x4A256EC8 Comment: Public Key: http://www.lorztech.com/GPG.txt Comment: Yahoo ID: michaellouieloria iQEVAwUBQua0F7XBHi2y3jwfAQoUaAf/dkEy1hqp6dG/tBONFj7EPU7/XP+YqBgL YRXEo64R8CP3yMkUJXTQrKSEUWVeitgF2lim1BRzR1VfvTDLFJn1kh02n7tVgw1z /F9n2y0O9pKbqkCm6BE7zzLiZpfPMS+weycbwUvp6dVUVjOLZ073b2LhAcvfq4UU bTMqRLicxIPFTq9U1HPXCq3rrq3PK/u1CLSNfu/7GXoQ64eXSb+TrPdnNTgGLwEh A9KtGrKgGrOkFyhA8dPNypR1aaRVszWTHTUSjRxivXlfjJOmtY1/iIEAN8pVLOUc 9z35ht6O4o3CIBGUOtDF34r8Y2MYTs9mFSJ/7lcBOYtnZN02dUYHSQ== =3GPb -END PGP SIGNATURE- __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Split function in Perl
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 Hello, I have a problem with the split function. string - - - one "two three" "four five" six seven should be split to - - - one two three four five six seven string - - - one two three four five six seven should be split to - - - one two three four five six seven the difference is the string enclosed with " " is considered as 1 string even with spaces. Thanks, Michael Louie Loria -BEGIN PGP SIGNATURE- Comment: Public Key: https://www.biglumber.com/x/web?qs=0x4A256EC8 Comment: Public Key: http://www.lorztech.com/GPG.txt Comment: Yahoo ID: michaellouieloria iQEVAwUBQuZ7drXBHi2y3jwfAQqL6QgAiROSQrYOyuoITOPNsSxdtYT4VLDeEy6u LFGQlEcdX2b4nkcPkmNcOEbt6qlnWHjnhQwODEH34+BjIpgAb/7yrIxmlQRPnmnj /4O4x0YnFa71Gl7jUwythyv3gDeBo12x6GA+SZU/sdNL0IbDGu1qe0aXxEL7dt0I kveNDhglPqihuWmAG6cqb0CatkV9na9Fg/whsfHbwIGPY4fYCSPi7GzXT+M/K0Mi yGslp31ibW4ZVWtDm+v6g8dV4RFiKfSSpk8c65S7i384vU0RdhdPMu6Qww2U4PYa yKdLLZ49XTG7AbMHiF/r6VUMf8rUJ0vE0I83uH1hAGI+x40K2tqiag== =icS0 -END PGP SIGNATURE- Start your day with Yahoo! - make it your home page http://www.yahoo.com/r/hs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs