Re: Help with Regex (UserName, Email)
Hi rolinson, Read perldoc perlrequick perldoc perlre perldoc perlretut perldoc perl perldoc perlfaq6 If you read this and if you tried something with this and still if you are facing some trouble you Post to the group with the doubts. Hope this helps you a lot. Thnx Prabu Jeff Pang <[EMAIL PROTECTED]> wrote: --- [EMAIL PROTECTED] wrote: > Hello! > > Help with Regex, Thanks in avance! > > > 1. Validation of Name > > Enable ALL keys on keyboard EXCEPT 0, 1, 2., > 9 > Change to uppercase of 1st alphabet of every word > and lowercase for > the rest of the word. > Example: aDa AdA 12DDD 12ddd dd12dd ¨¤ Ada Ada 12Ddd > 12Ddd Dd12dd > > > a) If Name (0-2 characters) < 3 characters, > excluding spacing and > punctuations > > OR > > b) If Any Part of Name has 4 or more consecutive > A-Z/0-9 in ascending > or descending order, excluding case sensitivity. > (e.g. 6789, 9876, > wxYz, zyXw, Test2345ing, 122abcdZ444) > > OR > > c) If Name = 3 or more consecutive A-Z/0-9 in > ascending or descending > order, excluding case sensitivity. (e.g. 678, 987, > 6789, 9876, Wxy, > Yxw, wxYz, zyXw) > > OR > > d) If Name = ALL recurring characters, excluding > spacing, > punctuations and case sensitivity > (e.g. @@@, AaAaaA, 9, EE EEE , eE E;e'E > Ee#eE) > > OR > > e) If Any Part of Name has 3 or more repeat > sequence of 2 characters > excluding spacing and case sensitivity. (e.g. > sasasa, dfdfdf, > MunununT, MunZUnuNT, a12e12p12, aAbATaBt edab, EaA > GAa Raa) > ShowMessage: Please re-enter the Name again. > > END > > > > f) If Name at least 1 character = 0, 1, 2., > 9 (e.g. A9E, A99E, > A9E9, A9E-A99E, A9E-A99E) > ShowMessage: Only alphabets are allowed. Please > re-enter the Name > again. > > END > > > > f) If Name at least 1 character = Foreign > Characters (non-English > characters) (e.g. °Ù¶È, aÁõbµÂ»ªc, ¥¤¥Ù¥ó¥È, > ¥¤a¥Ùb¥óc¥È) > ShowMessage: Our system currently only supports > English > characters. Only alphabets are allowed. Please > re-enter the Name > again. > END > > > --- > 2. Validation of Email Address > > a) If Email Address = Empty > > ShowMessage: Please enter your email address. > > END > > > > b) If Email Address Invalid format. > > OR > > c) If Email Address = ALL recurring characters > excluding punctuations > and case sensitivity. > (e.g. @.@@@, [EMAIL PROTECTED], [EMAIL PROTECTED]) > > ShowMessage: Please re-enter a valid email > address again. > > END > > > d) If Email Address at least 1 character = Foreign > Characters (non- > English characters) > (e.g. [EMAIL PROTECTED], [EMAIL PROTECTED], > [EMAIL PROTECTED], [EMAIL PROTECTED]) > > ShowMessage: Please re-enter a valid email > address again. > > > E) If Your Email and Friend's Email Address is the > same (e.g. Your > Email [EMAIL PROTECTED] and Friend's Email > [EMAIL PROTECTED]) > > ShowMessage: Email must not be the same. Please > re-enter a valid > email address again. > > END > A long homework question.Hope you good luck to get someone help you. -- http://home.earthlink.net/~pangj/ http://home.arcor.de/jeffpang/ Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ - Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out.
Re: FW: Html within code
Tom Phoenix wrote: On 7/25/07, Johnson, Reginald (GTI) <[EMAIL PROTECTED]> wrote: open (OMARFILE, " No matter what virtues your technique has or lacks, this particular line is surely broken; it will never die, even if the file can't be opened. Check the table of precedence in the perlop manpage. Cheers! Wow, lots of words; no help. Things that are not in the documentation: open my $omarfile, '<', "junk" or die "input file \"junk\" cannot be opened; $!"; Note the use of the lexical, 'my $omarfile', file handler. Note the use of the tri-argument open. Note the use of 'or die'. (Note the correct spelling.) Reading documentation is good; but it out of date with respect to best practices. Reading `perldoc perlop` will not correct the errors in the statement. Reading `perldoc -f open` will tell you what's possible but not what's the best practice. -- Just my 0.0002 million dollars worth, Shawn "For the things we have to learn before we can do them, we learn by doing them." Aristotle -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: FW: Html within code
On 7/25/07, Johnson, Reginald (GTI) <[EMAIL PROTECTED]> wrote: open (OMARFILE, " No matter what virtues your technique has or lacks, this particular line is surely broken; it will never die, even if the file can't be opened. Check the table of precedence in the perlop manpage. Cheers! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Module Madness (must I install all these modules and libraries to get a graph?)
On Thu, Jul 26, 2007 at 09:40:36AM -0700, Inventor wrote: > On Jul 26, 8:26 am, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote: > > > > Welcome to Dependency Hell. (You know you're in trouble when there is a > > derogatory nickname for what you're doing.) > > > > You know what, rather than deal with Dependency Hell in multiple > environments, this morning I wrote my own plotting routine that does > ASCII scatter plots. You just give it a data set and it makes a nice > cute little ascii plot for you, no dependencies, no Hell, and it's > good enough for me. You don't think the CPAN folks would want such a > module, do you? Of course they would. CPAN folks are just us, and if your module is somehow better than anything else out there then it belongs on CPAN. Your other option would have been to let either CPAN or CPANPLUS manage the dependencies. It's quite easy when you know how. $ perldoc CPAN -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Test if string does not exist in an array.
On Jul 26, 7:14 am, [EMAIL PROTECTED] (Snickwad) wrote: > Apologies if this is a bit noobie, As a newbie, you may not be aware that Perl comes with a built-in FAQ. You can see the whole thing by typing at your command window: perldoc perlfaq But the specific question you care about is: $ perldoc -q contain Found in /software/perl-5.8.5-0/pkg/lib/5.8.5/pod/perlfaq4.pod How can I tell whether a certain element is contained in a list or array? > but I have been left with a short > window to write a tool and I have had no experience with Perl. Very > familiar with Kornshell, and so far my Perl script is going okay. > However, I am struggling to get a test working correctly. Is there a > simple way to test if a string does not exist in an array? > > I am trying to test if some user input (a userid) is valid and error > if it does not exist. Currently have the contents of /etc/passwd in an > array, No you don't. > and can test for valid users, but all my efforts to test for > invalid have failed miserably. > > I am on AIX, not sure on the Perl version. > > Current test for valid is : > > return 1 if (grep(/$user/,$udata)); $udata is not an array. It is a scalar. Arrays start with @. Scalars start with $. Now, if $udata happened to have one big string that contains all of the usernames that are valid, this would still "work". But seeing as you're calling it an array, I'm wondering if perhaps $udata is actually an array reference, in which case you'd need to derference it. You should read: perldoc perlreftut In general, there's no real solid answer of how to "fix" your code without knowing what your code actually is. Please post a SHORT but COMPLETE script when requesting help. Paul Lalli -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Test if string does not exist in an array.
Hi, Perl has a built in function that do just that: if (my $username = getpwuid($input_uid)) { print "Founf the user $username\n"; } else { print "No user found\n"; } for help try perldoc -f getpwent perldoc -f getpwnam perldoc -f getpwuid BFN Yaron Kahanovitch - Original Message - From: "snickwad" <[EMAIL PROTECTED]> To: beginners@perl.org Sent: Thursday, July 26, 2007 1:14:49 PM (GMT+0200) Africa/Harare Subject: Test if string does not exist in an array. Apologies if this is a bit noobie, but I have been left with a short window to write a tool and I have had no experience with Perl. Very familiar with Kornshell, and so far my Perl script is going okay. However, I am struggling to get a test working correctly. Is there a simple way to test if a string does not exist in an array? I am trying to test if some user input (a userid) is valid and error if it does not exist. Currently have the contents of /etc/passwd in an array, and can test for valid users, but all my efforts to test for invalid have failed miserably. I am on AIX, not sure on the Perl version. Current test for valid is : return 1 if (grep(/$user/,$udata)); Any help would be much appreciated. Ashley -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Module Madness (must I install all these modules and libraries to get a graph?)
On Jul 26, 8:26 am, [EMAIL PROTECTED] (Mr. Shawn H. Corey) wrote: > > Welcome to Dependency Hell. (You know you're in trouble when there is a > derogatory nickname for what you're doing.) > You know what, rather than deal with Dependency Hell in multiple environments, this morning I wrote my own plotting routine that does ASCII scatter plots. You just give it a data set and it makes a nice cute little ascii plot for you, no dependencies, no Hell, and it's good enough for me. You don't think the CPAN folks would want such a module, do you? Inventor -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Test if string does not exist in an array.
On 7/26/07, snickwad <[EMAIL PROTECTED]> wrote: Apologies if this is a bit noobie, but I have been left with a short window to write a tool and I have had no experience with Perl. Very familiar with Kornshell, and so far my Perl script is going okay. However, I am struggling to get a test working correctly. Is there a simple way to test if a string does not exist in an array? I am trying to test if some user input (a userid) is valid and error if it does not exist. Currently have the contents of /etc/passwd in an array, and can test for valid users, but all my efforts to test for invalid have failed miserably. I am on AIX, not sure on the Perl version. Current test for valid is : return 1 if (grep(/$user/,$udata)); Any help would be much appreciated. Ashley You don't have any arrays in your example. Try this: [EMAIL PROTECTED]:~$ cat t.pl #!/usr/bin/perl use strict; use warnings; my $user = shift; open my $f, "<", "/etc/passwd" or die "could not open /etc/passwd:$!"; my @users = map { (split ':')[0] } <$f>; print "$user is "; if (grep { $user eq $_ } @users) { print "valid\n"; } else { print "invalid\n"; } [EMAIL PROTECTED]:~$ perl t.pl cowens cowens is valid [EMAIL PROTECTED]:~$ perl t.pl cowens1234 cowens1234 is invalid -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Response to the question of how do you build and install PadWalker
This information answers the question of how do you build and install PadWalker. I could not find a concise explanation of how do you build and install this module on any one group. I tried replying to a post asking this exact question but was only able to reply to the original author. I think this information will benifit others that are very new to perl so I am directly posting this information. (I have about 36 hours under my belt now) I am hoping this will be a benefit to others just trying to install this or any other perl package. Any corrections are comments about this matter will be appreciated. To Installing PadWalker 1.5 (Active Perl) First download package from http://search.cpan.org/dist/PadWalker/ (1). First you must generate the makefile by running the makefile.pl script perl makefile.pl (2) Secondly you must then build the PadWalker object file by invoking the C make file nmake makefile (3) Thirdly you must create the PadWalker DLL file by invoking the linker link -out:blib\arch\auto\PadWalker\PadWalker.dll -dll -nologo - nodefaultlib -debug -opt:ref,icf -libpath:"C:\perl\lib\CORE" - machine:x86 PadWalker.obj C:\perl\lib\CORE\perl58.lib oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib -def:PadWalker.def (4) Copies and changes the permissions using perl (I am fuzz here) C:\perl\bin\perl.exe -MExtUtils::Command -e chmod 644 PadWalker.bs C:\perl\bin\perl.exe -MExtUtils::Command -e chmod 755 blib\arch\auto \PadWalker\PadWalker.dll C:\perl\bin\perl.exe -MExtUtils::Command -e cp PadWalker.bs blib\arch \auto\PadWalker\PadWalker.bs C:\perl\bin\perl.exe -MExtUtils::Command -e chmod 644 blib\arch\auto \PadWalker\PadWalker.bs (5) Testing the newly compiled DLL (realy cool) C:\perl\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib\lib', 'blib\arch')" t/*.t (6) Mounting the new package (copy) >From \PadWalker-1.5 Copy PadWalker.PM to \perl\lib >From \PadWalker-1.5\blib\arch\auto Copy PadWalker to \Perl\lib\auto\PadWalker Dir \Perl\lib\auto\PadWalker . .. PadWalker.bs PadWalker.dll PadWalker.exp PadWalker.lib (7) Test under perl Run the following perl script #!/usr/bin/env perl BEGIN { require PadWalker } use PadWalker qw( peek_my ); my $x = 1; my $h = peek_my (0); ${$h->{'$x'}}++; print $x; # prints 2 ${$h->{'$x'}}++; print $x; # prints 3 (Some times I get to have more fun the one person should be allowed to have) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Test if string does not exist in an array.
Apologies if this is a bit noobie, but I have been left with a short window to write a tool and I have had no experience with Perl. Very familiar with Kornshell, and so far my Perl script is going okay. However, I am struggling to get a test working correctly. Is there a simple way to test if a string does not exist in an array? I am trying to test if some user input (a userid) is valid and error if it does not exist. Currently have the contents of /etc/passwd in an array, and can test for valid users, but all my efforts to test for invalid have failed miserably. I am on AIX, not sure on the Perl version. Current test for valid is : return 1 if (grep(/$user/,$udata)); Any help would be much appreciated. Ashley -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: perl script to modify LDAP.
For multiple users, you need to 1. Open the file with the users names/password 2. Read that file 3. loop through the above command So I will let you tidy this up open (my $USERS,"<", "/file/of/users-password") or die ..; while (<$USERS>){ chomp; my ($user, $password) = split; #(I guess) system("cpu usermod --password=$password $password"); } Pradeep is managing his users on Ldap Take a look on this article... http://www.linuxjournal.com/article/7086 You can mix Owen's script with the article examples and use $ldap->modify($dn, replace => instead the system() call... Good luck... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Module Madness (must I install all these modules and libraries to get a graph?)
Inventor wrote: Must I really install the 3 modules plus the libraries b, c, d, and f above just to draw a simple jpg scatter plot? I don't even know how to install a library, just a module. When they say "library" in the README, do they really mean "module"? Welcome to Dependency Hell. (You know you're in trouble when there is a derogatory nickname for what you're doing.) A library is a collection of binary objects, usually compiled from some high-level language. They are (usually) located in /usr/lib or /usr/local/lib . The same goes for most of the other tantalizing modules I've been reading about and wanting to install... It needs THIS, which needs THIS and THIS, one of which needs THESE... I am so confused. Did I mention its nickname? Worse yet, godaddy.com, where i plan to host the site, tells me that they only support the standard Perl modules that come with Perl these days, so I will have to install them locally and keep them in some sort of directory tree, I guess. If they support only standard Perl modules, chances are they won't support libraries. I suggest that you contact them and tell them you want to create scatter graphs on the fly. They may already have something in place to do it for you. -- Just my 0.0002 million dollars worth, Shawn "For the things we have to learn before we can do them, we learn by doing them." Aristotle -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: perl script to modify LDAP.
>> Hi >> >> I am a beginner in perl and have tough time in writing a script which >> i need urgently. I would like to know the perl script to >> 1)modify passswords in LDAP for multiple users taking input from >> another file(which contains usernames and new passwords ) >> Thank you in advance. > >> -- Oooops One to many passwords, try system("cpu usermod --password=$password $user"); instead Owen > > You need a statement something like this > > system("cpu usermod --password=$password $password"); > > For multiple users, you need to > > 1. Open the file with the users names/password > 2. Read that file > 3. loop through the above command > > > So I will let you tidy this up > > open (my $USERS,"<", "/file/of/users-password") or die ..; > while (<$USERS>){ > chomp; > my ($user, $password) = split; #(I guess) > system("cpu usermod --password=$password $password"); > } > > > > owen > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > http://learn.perl.org/ > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: perl script to modify LDAP.
> Hi > > I am a beginner in perl and have tough time in writing a script which > i need urgently. I would like to know the perl script to > 1)modify passswords in LDAP for multiple users taking input from > another file(which contains usernames and new passwords ) > Thank you in advance. > -- You need a statement something like this system("cpu usermod --password=$password $password"); For multiple users, you need to 1. Open the file with the users names/password 2. Read that file 3. loop through the above command So I will let you tidy this up open (my $USERS,"<", "/file/of/users-password") or die ..; while (<$USERS>){ chomp; my ($user, $password) = split; #(I guess) system("cpu usermod --password=$password $password"); } owen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
perl script to modify LDAP.
Hi I am a beginner in perl and have tough time in writing a script which i need urgently. I would like to know the perl script to 1)modify passswords in LDAP for multiple users taking input from another file(which contains usernames and new passwords ) Thank you in advance. Regards Pradeep -- Good Judgement comes from Experience and Experience comes from bad Judgement!! The more I know, the more I realize I don't know!? The easiest way to find out is to try it!!! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
RE: Html within code
I wouldn't say wrong no, but there are modules out there to make things easier such as the CGI module and multiple others. _ From: Johnson, Reginald (GTI) [mailto:[EMAIL PROTECTED] Sent: 25 July 2007 16:49 To: beginners@perl.org Subject: FW: Html within code Is coding this way wrong? By "this way" I mean where you don't use a module to write html, but instead do it within the code by using print "Content-type: text/html", "\n\n"; Example program #!/usr/bin/perl print "Content-type: text/html", "\n\n"; open (OMARFILE, " Omar Metrics TSM OMAR STATISTICS EOF ; while ( $line =) { chomp($line); if ($line ne "" ) { ($fdt,$tod,$cap,$util,$actnodes,$gb,$att,$comp,$comppct,$bdays,$restorecnt,$ req,$setups) = split(/ /,$line); print < OMAR Metrics for $fdt to $tod Backup Completion Percentage EOF ; if ($comppct >= 98) { print <$comppct EOF ; } #end if else { print <$comppct EOF ; } #end else print. By messaging with Merrill Lynch you consent to the foregoing. _ "Please consider the environment before printing this email." This e-mail is from the PA Group. For more information, see www.thepagroup.com. This e-mail may contain confidential information. Only the addressee is permitted to read, copy, distribute or otherwise use this email or any attachments. If you have received it in error, please contact the sender immediately. Any opinion expressed in this e-mail is personal to the sender and may not reflect the opinion of the PA Group. Any e-mail reply to this address may be subject to interception or monitoring for operational reasons or for lawful business practices. <>-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Help with Regex (UserName, Email)
--- [EMAIL PROTECTED] wrote: > Hello! > > Help with Regex, Thanks in avance! > > > 1. Validation of Name > > Enable ALL keys on keyboard EXCEPT 0, 1, 2., > 9 > Change to uppercase of 1st alphabet of every word > and lowercase for > the rest of the word. > Example: aDa AdA 12DDD 12ddd dd12dd ¨¤ Ada Ada 12Ddd > 12Ddd Dd12dd > > > a) If Name (0-2 characters) < 3 characters, > excluding spacing and > punctuations > > OR > > b) If Any Part of Name has 4 or more consecutive > A-Z/0-9 in ascending > or descending order, excluding case sensitivity. > (e.g. 6789, 9876, > wxYz, zyXw, Test2345ing, 122abcdZ444) > > OR > > c) If Name = 3 or more consecutive A-Z/0-9 in > ascending or descending > order, excluding case sensitivity. (e.g. 678, 987, > 6789, 9876, Wxy, > Yxw, wxYz, zyXw) > > OR > > d) If Name = ALL recurring characters, excluding > spacing, > punctuations and case sensitivity > (e.g. @@@, AaAaaA, 9, EE EEE , eE E;e'E > Ee#eE) > > OR > > e) If Any Part of Name has 3 or more repeat > sequence of 2 characters > excluding spacing and case sensitivity. (e.g. > sasasa, dfdfdf, > MunununT, MunZUnuNT, a12e12p12, aAbATaBt edab, EaA > GAa Raa) > ShowMessage: Please re-enter the Name again. > > END > > > > f) If Name at least 1 character = 0, 1, 2., > 9 (e.g. A9E, A99E, > A9E9, A9E-A99E, A9E-A99E) > ShowMessage: Only alphabets are allowed. Please > re-enter the Name > again. > > END > > > > f) If Name at least 1 character = Foreign > Characters (non-English > characters) (e.g. °Ù¶È, aÁõbµÂ»ªc, ¥¤¥Ù¥ó¥È, > ¥¤a¥Ùb¥óc¥È) > ShowMessage: Our system currently only supports > English > characters. Only alphabets are allowed. Please > re-enter the Name > again. > END > > > --- > 2. Validation of Email Address > > a) If Email Address = Empty > > ShowMessage: Please enter your email address. > > END > > > > b) If Email Address Invalid format. > > OR > > c) If Email Address = ALL recurring characters > excluding punctuations > and case sensitivity. > (e.g. @.@@@, [EMAIL PROTECTED], [EMAIL PROTECTED]) > > ShowMessage: Please re-enter a valid email > address again. > > END > > > d) If Email Address at least 1 character = Foreign > Characters (non- > English characters) > (e.g. [EMAIL PROTECTED], [EMAIL PROTECTED], > [EMAIL PROTECTED], [EMAIL PROTECTED]) > > ShowMessage: Please re-enter a valid email > address again. > > > E) If Your Email and Friend's Email Address is the > same (e.g. Your > Email [EMAIL PROTECTED] and Friend's Email > [EMAIL PROTECTED]) > > ShowMessage: Email must not be the same. Please > re-enter a valid > email address again. > > END > A long homework question.Hope you good luck to get someone help you. -- http://home.earthlink.net/~pangj/ http://home.arcor.de/jeffpang/ Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Parsing large XML file - Revisited
On Jul 25, 9:11 pm, [EMAIL PROTECTED] (Mike Blezien) wrote: > Rob, > > - Original Message - > From: "Rob Dixon" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Cc: "Mike Blezien" <[EMAIL PROTECTED]> > Sent: Wednesday, July 25, 2007 10:57 AM > Subject: Re: Parsing large XML file - Revisited > > > Mike Blezien wrote: > > >> Mirod wrote: > > >>> On Jul 22, 3:33 am, [EMAIL PROTECTED] (Dr.Ruud) wrote: > > "Mike Blezien" schreef: > > > my $article_number = $elt->first_child_text('article_number'); > > my $dist_number= $elt->first_child_text('distributor_number'); > > my $dist_name = $elt->first_child_text('distributor_name'); > > my $artist = $elt->first_child_text('artist'); > > my $ean_upc= $elt->first_child_text('ean_upc'); > > my $set_total = $elt->first_child_text('set_total'); > > That looks awful. Isn't there some way with the module to do it cleaner? > > Or do it more like: > > my @text_tags = qw(article_number distributor_number etc); > my %data; > > for my $tag (@text_tags) { > $data{_text}{$tag} = $elt->first_child_text($tag); > } > > >>> just a quick note, that first_child_text can also be written field, > >>> which often makes more sense in a data oriented context. > > >> that was an excellent idea :) Alot cleaner and alot less coding involved. > >> Still fairly new working with XML parsing. > > > Hi Mike > > > Using a shorter synonym for a method isn't a significant improvement. I > > prefer > > the 'first_child_text' name as it is more descriptive, and if I was using > > exactly the code above I would rewrite it as: > > > my ($article_number, $dist_number, $dist_name, $artist, $ean_upc, > > $set_total) > > = map { > >$elt->first_child_text($_) > > } qw/article_number distributor_number distributor_name artist ean_upc > > set_total/ > > > But I made no changes to your code apart from to correct the semantics as it > > wasn't > > at all obvious what you're doing. The code you posted just extracts XML > > field > > text > > values into a number of lexical variables and then discards them. If you > > give > > us an > > idea what your final intention is then I'm sure we can help, and it probably > > won't > > involve using 'field' instead of 'first_child_text'; but it is likely that a > > hash > > structure would be more appropriate. > > > As I mentioned in an earlier post, it's important to separate XML nodes from > > their > > textual content. XML::Twig methods return both types of data and it's best > > not > > to mix > > them up. More importantly, you can always extract the text data value from > > an > > XML node, > > but the reverse isn't true. > > Obviously there are several approaches to accomplish this task. With the help > of > yourself and others who posted, I have been able to put together a fairly > efficient script, as we need to process & parse approx., 5000+ XML files > averaging 9-1000KB's in size. So far it has been working smoothly :) > > Mike Hi, My requirement is to compare two xml(large[50MB] each) files and generate an xml file with differences(xmldelta). But here the problem is the modules(XML::Diff) which I installed are taking lot of memory(even 2 GB RAM is not sufficient) and time. I am thinking that those modules are using XML::Parser which in turn uses DOM Parser so that taking lot of memory. Is there any way in perl which will do that using SAX Parser? or which will take less memory? Please help in this regard. Thanks in advance. Regards, L.Srikanth Kumar -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Help with Regex (UserName, Email)
Hello! Help with Regex, Thanks in avance! 1. Validation of Name Enable ALL keys on keyboard EXCEPT 0, 1, 2., 9 Change to uppercase of 1st alphabet of every word and lowercase for the rest of the word. Example: aDa AdA 12DDD 12ddd dd12dd à Ada Ada 12Ddd 12Ddd Dd12dd a) If Name (0-2 characters) < 3 characters, excluding spacing and punctuations OR b) If Any Part of Name has 4 or more consecutive A-Z/0-9 in ascending or descending order, excluding case sensitivity. (e.g. 6789, 9876, wxYz, zyXw, Test2345ing, 122abcdZ444) OR c) If Name = 3 or more consecutive A-Z/0-9 in ascending or descending order, excluding case sensitivity. (e.g. 678, 987, 6789, 9876, Wxy, Yxw, wxYz, zyXw) OR d) If Name = ALL recurring characters, excluding spacing, punctuations and case sensitivity (e.g. @@@, AaAaaA, 9, EE EEE , eE E;e'E Ee#eE) OR e) If Any Part of Name has 3 or more repeat sequence of 2 characters excluding spacing and case sensitivity. (e.g. sasasa, dfdfdf, MunununT, MunZUnuNT, a12e12p12, aAbATaBt edab, EaA GAa Raa) ShowMessage: Please re-enter the Name again. END f) If Name at least 1 character = 0, 1, 2., 9 (e.g. A9E, A99E, A9E9, A9E-A99E, A9E-A99E) ShowMessage: Only alphabets are allowed. Please re-enter the Name again. END f) If Name at least 1 character = Foreign Characters (non-English characters) (e.g. 百度, a刘b德华c, イベント, イaベbンcト) ShowMessage: Our system currently only supports English characters. Only alphabets are allowed. Please re-enter the Name again. END --- 2. Validation of Email Address a) If Email Address = Empty ShowMessage: Please enter your email address. END b) If Email Address Invalid format. OR c) If Email Address = ALL recurring characters excluding punctuations and case sensitivity. (e.g. @.@@@, [EMAIL PROTECTED], [EMAIL PROTECTED]) ShowMessage: Please re-enter a valid email address again. END d) If Email Address at least 1 character = Foreign Characters (non- English characters) (e.g. [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]) ShowMessage: Please re-enter a valid email address again. E) If Your Email and Friend's Email Address is the same (e.g. Your Email [EMAIL PROTECTED] and Friend's Email [EMAIL PROTECTED]) ShowMessage: Email must not be the same. Please re-enter a valid email address again. END -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Module Madness (must I install all these modules and libraries to get a graph?)
Hi, and thanks for all your help so far. My program is running beautifully now, and I would like to add some data graphs. I read about GD::Graph, which tells me I need GD::Text::Align, which I learn is actually in GD::Text, plus the plain old GD. Then when I read the README in GD, it tells me that Mac OS X users must install some subset of seven additional items for GD to work, all from different web sites. Here is that list: 2. Make sure you have downloaded and installed the following packages: a. Perl 5.6.0 or higher: http://www.perl.com/ b. The gd graphics library: http://www.boutell.com/gd/ c. The PNG graphics library: http://www.libpng.org/pub/png/libpng.html d. The zlib compression library: http://www.gzip.org/zlib/ (OPTIONAL) e. The FreeType font rendering library for TrueType fonts: http://www.freetype.org/ f. The JPEG library, version 6b or later: ftp://ftp.uu.net/graphics/jpeg/ g. The XPM library, a standard part of modern X Windows distributions. If you don't have a modern version of X, don't try to get XPM working. Must I really install the 3 modules plus the libraries b, c, d, and f above just to draw a simple jpg scatter plot? I don't even know how to install a library, just a module. When they say "library" in the README, do they really mean "module"? The same goes for most of the other tantalizing modules I've been reading about and wanting to install... It needs THIS, which needs THIS and THIS, one of which needs THESE... I am so confused. Worse yet, godaddy.com, where i plan to host the site, tells me that they only support the standard Perl modules that come with Perl these days, so I will have to install them locally and keep them in some sort of directory tree, I guess. I wouldn't bother you with the question, but its been hounding me for some time now. Help, please. Thanks in advance. Inventor -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re:what is the relation bn Perl version , Perl byteloader & OS version
> Hi all, > > what is the relation between Perl version , Perl byteloader & OS > version?? > See 'perldoc perlhist' for perl history list. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/