Re: perl cookbook?
On Wed, 29 Feb 2012 16:16:30 +0200, Brent Clark brentgclarkl...@gmail.com wrote: Hiya Im looking to buy perl cookbook. I see the second edition was released 2003. Before I go off and buy it, does anyone know if perl cookbook 3rd edition, is ever going to be published? IIRC the book Perl by examples has the 5th edition now. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Rsync doesnot work
于 2012-2-14 13:14, Punit Jain 写道: This works manually if I run this script however under crontab it doesnot. Any clue what could be the issue ? How about the environment variables? For example, you maybe have setup the value of RSYNC_PASSWORD in the shell, but the value becomes not effective in the crontab. HTH. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Perl Module to parse any other Perl script/module to fetch stats about data-structures
于 2012-2-9 10:15, Steve Bertrand 写道: I would suspect that this would be something that would have to run against the file itself, even prior to compile. Curious task. Might I ask what the purpose of your desire is? I am also not sure what's the special purpuse of the OP. Some modules on CPAN under the namespace of Devel::* may help him. Jeff. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: unexpected results
于 2012-2-9 12:44, lina 写道: $string =~ m/(\S+)(and|or)(\S+)/; $string =~ m/(\S+)\s+(and|or)\s+(\S+)/; HTH. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: unexpected results
于 2012-2-9 14:10, lina 写道: On Thu, Feb 9, 2012 at 1:44 PM, Jeff Pengp...@staff.dnsbed.com wrote: 于 2012-2-9 12:44, lina 写道: $string =~ m/(\S+)(and|or)(\S+)/; $string =~ m/(\S+)\s+(and|or)\s+(\S+)/; Wow, thanks how does that one not work as expected, I am reading brian d foy Mastering Perl, http://www.amazon.com/Mastering-Perl-brian-d-foy/dp/0596527241 You may then ask brian :P You have lost matching the spaces in the original post. Jeff. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Perl Module to parse any other Perl script/module to fetch stats about data-structures
于 2012-2-9 15:21, Parag Kalra 写道: By data-structures being used, I mean the data structures that are actually *declared* in the script. And is it possible to find at least the data-structures stats of the current script that is getting executed if no parser is available. For example if I have a big script or module and if I want to find total arrays, hashes and variables declared in that script. Is there any special variable where this info is stored. I'm not sure, but you may take a look at this module: http://search.cpan.org/~flora/perl-5.14.2/ext/Devel-Peek/Peek.pm http://search.cpan.org/%7Eflora/perl-5.14.2/ext/Devel-Peek/Peek.pm HTH.
Re: how to understand shift?
于 2012-2-7 15:45, lina 写道: I am sorry, still don't get. $year = shift part Try with this code: use strict; my $month = December; my $year = 2007 ; header($month,$year); sub header { print '@_ is: ' . @_\n; my $month = shift ; print '@_ is: ' . @_\n; my $year = shift ; print '@_ is: ' . @_\n; } The output: @_ is: December 2007 @_ is: 2007 @_ is: shift means shift @_ in Perl. So the first shift, $month get the value shifted from @_, and the first element in @_ get removed. the second shift, $year get the value shifted from @_, the second element in @_ get removed. Since @_ has only two elements, so after two shift, it becomes null. That's all. HTH. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: how to understand shift?
于 2012-2-7 15:07, lina 写道: my $month = shift ; my $year = shift ; here after shift the $year becomes null? http://perldoc.perl.org/functions/shift.html after shift the @_ becomes null. $year is 2007. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: The Perl Programming Language
On Sun, 22 Jan 2012 13:47:26 +, Lívio Cipriano livio.cipri...@gmail.com wrote: Hi, I'm new to Perl but old in other programming languages. Is there a equivalent book in Perl as to the The C Programming Language? Regards Lívio Cipriano http://backpan.perl.org/authors/id/Q/QU/QUONG/perlin20.html A guide to Perl 5 for C/C++, awk, and shell programmers -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Schwartzian Transform
于 2012-1-18 11:31, Chris Stinemetz 写道: Would someone kindly advise me in sorting this array: my @array = qw(c r v vr tr re c.p[1] c.p[3] c.p[2] c.p[4] c.p[7] c.p[6] c.p[5] c.p[8] c.t[1] c.t[3] c.t[2]); I only want to sort the elements that have a numeric value inside the braces so that all the other elements have their original index preserved. I guess this is what you wanted. my @new = map { $_-[0] } sort { $a-[1]-[0] cmp $b-[1]-[0] or $a-[1]-[1] = $b-[1]-[1] } map {[$_,[ $_=~/\.(.+)\[(\d+)\]/ ]]} @array; The output: c r v vr tr re c.p[1] c.p[2] c.p[3] c.p[4] c.p[5] c.p[6] c.p[7] c.p[8] c.t[1] c.t[2] c.t[3] HTH. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: How to merge multiple array elements
于 2012-1-16 1:18, Pradeep Patra 写道: It works and displays 1-12. But I need something different because i dont know the value of n beforehand. So I decided to use a for loop. I tried push but it did not work. I would appreciate any help to merge multiple array elements preferably not using any library function like push etc. push is the built-in function of Perl, not an external library function, so why not using it? Consider the code below, though eval a string is considered bad way generally. use strict; my @a1 = (1,2,3); my @a2 = (4,5,6); my @a3 = (7,8,9); my @array; for (1..3) { push @array, eval('@a' . $_); } print @array,\n; HTH. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Inserting a new data structure in a bless reference
于 2012-1-14 11:25, Parag Kalra 写道: use FooBar; my $obj = FooBar-new; Do something ... $obj-{'new_key'} = 'some_value' Now I am not sure if that is the correct way of inserting a new data structure into an already bless reference I don't think you should modify the blessed object's attribute directly. You could setup the get/set methods for the instance variables in the class, for example, Foo.pm: package Foo; use strict; sub new { my $class = shift; bless { bar=1 }, $class; } sub bar { my $self = shift; my $new_v = shift; if (defined $new_v) { $self-{bar} = $new_v; } else { $self-{bar}; } } 1; foo.pl: use Foo; use strict; my $foo = Foo-new; print $foo-bar,\n; $foo-bar(2); print $foo-bar,\n; The result after running: $ perl foo.pl 1 2 HTH. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: comparing arrays
Just from the subject, for comparing arrays, I have been using Array::Diff which works always fine for me. I have a script where I have captured the value on the left side of the = as the header for my table. Now I want to take the value on the right side of the = sign and populate a new row in table format where the header value I stored in the @header array matches the value on the left side of the = sign. Each dataset begins with a new line. If there is no match I would like to return null or just as the value. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: perl process forking tutorial recommendation
And the book Network programming with Perl is a good book for Perl client/server development including the fork stuff. -Original Message- From: dery...@gmail.com Sent: Wed, 15 Jun 2011 13:11:38 -0700 (PDT) To: beginners@perl.org Subject: Re: perl process forking tutorial recommendation On Jun 15, 11:21 am, noah-l...@enabled.com (Noah) wrote: Hi there, can somebody recommend a good tutorial web link and/or URL for learning perl forking please? Presumably, you've already seen these docs: perldoc perlipc perldoc perlfork # fork emulation for non-Unix Not the best tutorial but good for later reference so I'd recommend googling for more basic info. For instance, using search string perl fork tutorial, the first hit was an actual tutorial. Then you may want to try some simple examples and see how it goes. -- Charles DeRykus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks orcas on your desktop! Check it out at http://www.inbox.com/marineaquarium -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Real life usage
Original-Nachricht Datum: Sat, 18 Dec 2010 17:30:38 +0100 Von: Francesco Di Lorenzo fradilorenz...@gmail.com An: beginners@perl.org beginners@perl.org Betreff: Real life usage What role do Perl have in your work? In which particular projects you use it? Do you use it for particular piece of your softwares' source code or you use it as your main programming language? My use with Perl: * system admin * web development with CGI/mod_perl * DBA * some socket programming Besides perl you may also want to master other languages for the real life, like C/Ruby/Javascript etc. Jeff. -- GRATIS! Movie-FLAT mit über 300 Videos. Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: remove duplicate elements from an array
Original-Nachricht Datum: Fri, 17 Dec 2010 20:07:33 -0800 Von: David Christensen dpchr...@holgerdanske.com You should buy the Perl Cookbook: http://oreilly.com/catalog/9781565922433 does the cookbook have a new edition? I remember I have read it several years ago. Jeff. -- Neu: GMX De-Mail - Einfach wie E-Mail, sicher wie ein Brief! Jetzt De-Mail-Adresse reservieren: http://portal.gmx.net/de/go/demail -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Linux Uptime
于 2010-12-17 9:32, Matt 写道: I have a perl script but I want to exit it if the uptime on the server is less then say an hour. Any idea how I would get uptime with perl? $ cat /proc/uptime 4205976.64 4017280.59 The first column is the host's uptime seconds. Jeff. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Linux Uptime
于 2010-12-17 11:29, Shawn H Corey 写道: Every file in it is a pipe that can be read using regular file handles. And I believe only Linux does this. Yep.Also the OP is asking exactly about linux. -- Jeff Peng jeffp...@gmx.net -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Array Question
于 2010-12-15 1:38, Jim Gibson 写道: or the File::Find module to find files without resorting to the use of separate processes and shell commands. Me second. File::Find is your friend. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
install a package on windows
Hi, I have intalled activeperl 5.10 on windows and try to install a perl package. But I can't find the package in activeperl's perl package manager though this package does exist in CPAN. Also my windows doesn't have gcc/gmake installed. So how to install this kind of package? Thanks. Regards. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: install a package on windows
于 2010-12-16 7:06, Sisyphus 写道: ppm install MinGW I think that gives you both the MinGW port of the gcc compiler and dmake (which is the make utility you'll be using ... not gmake). If you find that dmake is not installed by running 'ppm install MinGW', then run: ppm install dmake Once MinGW and dmake have been 'ppm installed', nothing else needs to be configured - ActivePerl detects their presence and uses them automatically to build modules. Thanks for all the helps. I have resolved it using MinGW utils. Regards. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: how to remove (^M ^G ) characters
于 2010-10-28 21:58, perl_haxor 123 写道: Hi All, I'm a beginner in perl and i try to read a file, but these files contains characters like (^M ^G)..I wanted to know what are these characters and how can remove them using perl?.and also please let me if there is any link form where i can find what these characters are and their ascii values?..any sugges would be really helpful You get the files from windows to un*x? try the command 'dos2unix'. -- Jeff Peng http://nsbeta.info -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Time Subroutine
于 2010-10-26 22:53, Jyoti 写道: Hello Everyone, Can anyone tell me about the subroutine that returns current time please. perldoc -f localtime Is there much difference if we output current time or uptime ? I'm not sure what's an uptime by your meanings. If it's for the operation system's uptime then it's much difference from the current time. -- Jeff Peng http://nsbeta.info -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Object introspection + adding method
On Sat, Oct 23, 2010 at 07:52:50PM +0200, Shlomi Fish wrote: Just be sure you know what you are doing. Adding a method to somone else's class can be considered rude. See the NOTE in perldoc perlmodlib. He/she is maybe coming from other language like Ruby. In ruby it's free to add methods to any class including the built-in ones. irb(main):001:0 class String irb(main):002:1 def greeting irb(main):003:2 puts hello I'm in string irb(main):004:2 end irb(main):005:1 end = nil irb(main):006:0 s=String.new = irb(main):007:0 s.greeting hello I'm in string = nil -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Please suggest a good book on perl
Hey All, Just finished reading 'intermediate perl' Enjoyed it as much as I enjoyed the book 'learning perl' Thanks Randal, Tom All Please now suggest another must read nook on perl. why not network programming with Perl? This book will give you much more knowledge than perl itself. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: MySQL database entry delta report
于 2010-10-18 11:42, Jason Feng 写道: Hello, I am using Perl and MySQL to maintain a database of mobile network configuration about 30 tables and millions of rows. Every day, I’ll be importing new configuration data to the database. I’d like to create a delta report on which row and which column are modified, which row is deleted, which row is added. It will be time-consuming if just comparing each row and column one by one of today's data and yesterday's data. This is most likely a mysql question You may enable the binary log (AKA mysql-bin log) for mysqld then get the statistics from it. -- Jeff Peng http://nsbeta.info -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: perl real life exercise
于 2010-10-15 15:02, Agnello George 写道: HI Is there any site or any book other than learning perl where i would get real life exercises on perl scripting. Thanks perl cookbook. -- Jeff Peng http://nsbeta.info -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: help on perlform
于 2010-10-7 16:13, Shlomi Fish 写道: In case you haven't read the book Perl Best Practices (which you should), you should know that http://search.cpan.org/dist/Perl6-Form/ would be preferable over the built-in perlform which has horrible behaviour. Ah OK, in fact I used neither of them in my past experience. Will take a look at it. Regards. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: help on perlform
Hi folks, Can anyone please explain what is perlform and its usage.I used google but i was not able to crack. Try perldoc perlform. Cheers! -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: perl module to search for misspellings
Hi there List members, I have millions of SQL records that I searching with lots of poorly entered data and I am trying to match these records based on matching text. A database with well designed tables should be processing the data much faster than perl IMO. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: perl
On Mon, Oct 4, 2010 at 9:49 AM, sheikh numan iqbal numan1...@gmail.com wrote: hi, i want to login and need help on perl... In some nations login means step into the door. So for learning perl you may go: http://learn.perl.org/ Good luck. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: perl vs Python
( i did'nt know where to post this; perl forum or python forum ) I am a bit confused, i have been learning perl last 1.5 yrs .. then suddenly in my new company they use python to do all their scripting work , so i would have to follow protocol :) and learn python So now just wanted to know if i can do all that i could do in perl .. would i be able to do in python .. the documentation of python doesn't seem as crisp as the one in perl has . so if one has to write a script ... how does one choose between python or perl It depends. For system admin, Perl is better than Python IMO. For web development, maybe python is somewhat more convenient due to its wide-used frameworks? Python is more OO than Perl, it's more suitable for the project which has invoked multi-workers. But Perl's OO, well, maybe it's not that strong, but I just like it. Overall, if you have been mastering perl well, learning python is quick and easy, as well as learning ruby. Regards, Jeff. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: perl or python
Hi Is it better to learn Perl or Python since i can manage only writing simple bash shell scripts. Please suggest/guide. Since you are coming from shell, Perl is better for the beginning. from wikipedia (http://en.wikipedia.org/wiki/Perl): Perl borrows features from other programming languages including C, shell scripting (sh), AWK, and sed.[3] The language provides powerful text processing facilities without the arbitrary data length limits of many contemporary Unix tools,[4] facilitating easy manipulation of text files. It is also used for graphics programming, system administration, network programming, applications that require database access and CGI programming on the Web. Perl is nicknamed the Swiss Army chainsaw of programming languages due to its flexibility and adaptability. So go with Perl ... -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Urgent Request
Hello, Can anyone please tell me how to save output (what we get after running a perl script) as an external file? run it under a unix shell? try: perl a.pl a.txt 21 save all the output of a.pl to a.txt. 21 means to capture the script's error output also. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Urgent Request
Sorry doesnt work. Error is : Can't locate object method perl in 'filename'... what's the content of the script? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Urgent Request
You could use filehandle to save the output outcome. use strict; open OUT, outfile.txt; ## at the beggining and for instance: print OUT $seq-id(),\n; or use Perl's select. but that requires the OP to modify the source code, which is maybe not what he/she want. Regards. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Urgent Request
The method mentioned is to get the output while u are running the perl files at the shell prompt not in the code.. if u want to save the log details after the perl files are processed then use this function sub file_write { $_file = shift; $_data = shift; open FILE,$_file; three improvement for this open: 1) use three arguments version of open. 2) use my variable for filehandle instead of a global symbol. 3) remember to capture error when open fails. So it is better to write: open my $fd, , $file or die $!; Also I think you mean the (append) mode instead of the mode since you are talking about logging. Regards. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: update bind via net::dns
2010/8/31 Andreas Moroder andreas.moro...@sb-brixen.it: Hello, I would like to update the bind nameserver via a perl script. Named is running on the same machine I start the script. I copied the key from named.conf key DHCP_UPDATER { algorithm HMAC-MD5.SIG-ALG.REG.INT; secret mykeyishere; }; inserted it into my script and run it. I always get Update error code: REFUSED This is most likely a DNS updating problem rather than the perl problem. Please send the question to Bind's mailing list. https://lists.isc.org/mailman/listinfo -- Jeff Peng Web: http://home.arcor.de/pangj/ Blog: http://squidcn.spaces.live.com/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Perl modules
2010/8/19 Kuba snmp...@gmail.com: Hi All, How can I install additional perl modules on the linux if I don't have root privileges on the box? Can I install any modules to the $HOME directory and use them at my scripts? see this article: http://sial.org/howto/perl/life-with-cpan/non-root/ local::lib is maybe what you want. -- Jeff Peng Web: http://home.arcor.de/pangj/ Blog: http://squidcn.spaces.live.com/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Opposite benchmark results between Linux and Windows
2010/8/11 Chas. Owens chas.ow...@gmail.com: On Wed, Aug 11, 2010 at 08:39, r...@i.frys.com wrote: My theory is that 5.10.x implemented some optimizations that improved the speed of strftime. snip Unlikely, I don't remember any big changes to strftime (it is implemented by Perl_my_strftime in [util.c][0] if you want to check). I ran your code against 5.12.1, 5.10.0, and 5.8.9 on OS X and got Me also. Didn't get big difference among the three versions for that function. -- Jeff Peng Web: http://home.arcor.de/pangj/ Blog: http://squidcn.spaces.live.com/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Connecting to a socket
On Wed, Mar 31, 2010 at 9:39 PM, walt w...@helvatron.co.uk wrote: Hi, I am new to Perl and want to connect to an smtp server on port 25 and then send it the helo, mail from:, rcpt to:, data, commands but I would also like to evaluate the response from the smtp server. Has anyone got a script or can point me in the right direction? Hi, Could you use Net::SMTP and enable the debug option to trace the process? -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
help on a soap client
Hello, I want to post some data to a webservice which is .NET powered. The webservice's developer tell me the request should be: POST /Service/IndicatorsService.asmx HTTP/1.1 Host: 192.168.1.100 Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: http://tempuri.org/DataUpLoad; ?xml version=1.0 encoding=utf-8? soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema; xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; soap:Body DataUpLoad xmlns=http://tempuri.org/; input Userstring/User UserIPstring/UserIP NetTypestring/NetType OSstring/OS Data DataUpLoadInputData INDICATORSNUMBERdecimal/INDICATORSNUMBER RECORDINGTIMEdateTime/RECORDINGTIME FVALUEdecimal/FVALUE Validstring/Valid Infostring/Info /DataUpLoadInputData DataUpLoadInputData INDICATORSNUMBERdecimal/INDICATORSNUMBER RECORDINGTIMEdateTime/RECORDINGTIME FVALUEdecimal/FVALUE Validstring/Valid Infostring/Info /DataUpLoadInputData /Data /input /DataUpLoad /soap:Body /soap:Envelope I wrote this script for requesting it: use SOAP::Lite +trace = 'all'; my $soap = SOAP::Lite-new( proxy = 'http://192.168.1.100/Service/IndicatorsService.asmx'); $soap-default_ns('http://tempuri.org/'); $soap-on_action(sub { join '', @_ }); my $method = SOAP::Data-name('DataUpLoad') -attr({xmlns = 'http://tempuri.org/'}); my @param = ( SOAP::Data-name('INDICATORSNUMBER')-value('1010101010101210'), SOAP::Data-name('FVALUE')-value(50), ); my $run = $soap-call($method = @param); But it run failed. Can you help on this? Thanks. Jeff. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: help on a soap client
Thanks Rob. I have enabled trace = all when new the object, so I have been able to look what was happened. I think what I don't know is that how to built-up that a XML request package with the format they required for posting. Jeff. On Mon, Mar 29, 2010 at 5:49 PM, Rob Coops rco...@gmail.com wrote: On Mon, Mar 29, 2010 at 11:36 AM, Jeff Peng jeffp...@netzero.net wrote: -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: help on a soap client
On Mon, Mar 29, 2010 at 5:56 PM, Shlomi Fish shlo...@iglu.org.il wrote: 1. SOAP::Lite is no longer recommended. You should use SOAP::WSDL or XML::Compile::SOAP instead. (According to the perlbot factoid on irc.freenode.org ) Thanks Shlomi, let me check them. -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: help on a soap client
Thanks Rob so much for the sample code. I will try it following your direction, thanks. On Mon, Mar 29, 2010 at 6:42 PM, Rob Coops rco...@gmail.com wrote: Got it, I for got to indicate the arrays there. The code below will produce the following output. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: help on a soap client
Hello, Now I'm using the code below: use strict; use SOAP::Lite +trace = 'all'; my $soap = SOAP::Lite-new( proxy = 'http://192.168.1.100/Service/IndicatorsService.asmx'); $soap-default_ns('http://tempuri.org/'); $soap-on_action(sub { join '', @_ }); my $method = SOAP::Data-name('DataUpLoad') -attr({xmlns = 'http://tempuri.org/'}); my @param = ( SOAP::Data-name('input')-value( [ SOAP::Data-name('User')-value('demo'), SOAP::Data-name('UserIP')-value('0.0.0.0'), SOAP::Data-name('NetType')-value(0), SOAP::Data-name('OS')-value('Linux'), SOAP::Data-name('Data')-value( [ SOAP::Data-name('DataUpLoadInputData')-value( [ SOAP::Data-name('INDICATORSNUMBER')-value('1010101010101210'), SOAP::Data-name('RECORDINGTIME')-value('2010-03-29 17:00:00'), SOAP::Data-name('FVALUE')-value(50), SOAP::Data-name('Valid')-value(''), SOAP::Data-name('Info')-value(''), ]), ]), ])); my $run = $soap-call($method = @param); But sorry it can't run correctly yet. The error shows: ?xml version=1.0 encoding=utf-8?soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:xsd=http://www.w3.org/2001/XMLSchema;soap:Bodysoap:Faultfaultcodesoap:Client/faultcodefaultstringSystem.Web.Services.Protocols.SoapException: 服务器无法读取请求。 ---gt; System.InvalidOperationException: XML 文档(1, 381)中有错误。 ---gt; System.InvalidOperationException: 未识别指定的类型: name='Array',namespace='http://schemas.xmlsoap.org/soap/encoding/',位于 lt;input xmlns='http://tempuri.org/'gt;。 在 Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read3_DataUpLoadInput(Boolean isNullable, Boolean checkType) 在 Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read7_DataUpLoad() 在 Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer.Deserialize(XmlSerializationReader reader) 在 System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) --- 内部异常堆栈跟踪的结尾 --- 在 System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) 在 System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) 在 System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() --- 内部异常堆栈跟踪的结尾 --- 在 System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() 在 System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()/faultstringdetail //soap:Fault/soap:Body/soap:Envelope Any future helps? Thanks. -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Ternary operator: Am I missing something?
On Mon, Mar 29, 2010 at 10:02 PM, Jeff Soules sou...@gmail.com wrote: Hi all, Am I missing something? I have the following chunks of code: EX 1: if ($foo == 1){ $bar = 0; }else{ $bar = 1; } EX 2: ($foo == 1) ? $bar = 0 : $bar = 1; These are logically equivalent, right? No. ($foo == 1) is a list which always has a value of either 1 or 0 so it really return a true value in both cases. -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Ternary operator: Am I missing something?
On Mon, Mar 29, 2010 at 10:27 PM, Shlomi Fish shlo...@iglu.org.il wrote: No. ($foo == 1) is a list which always has a value of either 1 or 0 so it really return a true value in both cases. Not true: {{{ shlomi:~$ perl -le '$foo = 0; print +($foo == 1) ? Foo is 1 : Foo is not 1' Foo is not 1 shlomi:~$ perl -le '$foo = 1; print +($foo == 1) ? Foo is 1 : Foo is not 1' Foo is 1 shlomi:~$ }}} Ah sorry for my sloppy answer without the pratical code-test. Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: reutun undef
Thanks all. for return (), does it mean return an empty list, or return with no argument? -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
reutun undef
return statement with explicit undef at line 185, column 9. See page 199 of PBP. (Severity: 5) I got the cpan test report, it pointed out the one above. Is return undef not to be encouraged in current Perl? Thanks. -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: IOScalar with threads dose not work
2010/3/23 Shlomi Fish shlo...@iglu.org.il: 2. Don't use threads in Perl. They cause too many problems. Does it still have many problems until now? I ask it just because I wrote many code with Perl threads in my work, they seem work nice. -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: why on while?
On Fri, Mar 12, 2010 at 2:21 AM, Uri Guttman u...@stemsystems.com wrote: empty lines (a single newline) is always true. the defined case only handles the odd trailing partial line with just '0' in it. it is the only way a without defined would lose some data as it is false. No. Even having just 0 in a line won't make the line lost without defined. $ perl -e 'print 1\n2\n3\n0' a.txt $ perl -e 'open FD,a.txt; while(my $line=FD) { print $line }' 1 2 3 0 -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: why on while?
On Tue, Mar 9, 2010 at 12:41 PM, Bryan R Harris bryan_r_har...@raytheon.com wrote: Much to my chagrin I realized this morning that this notation: while(FILE) { evaluates as: while(defined($_ = FILE)) { ... and NOT as: while(defined(local $_ = FILE)) { so how about while (my $line = FILE) instead of using $_? -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Copy files from one machine to another machine
On Wed, Mar 3, 2010 at 8:40 PM, Irfan Sayed irfan_sayed2...@yahoo.com wrote: Hi all, I need to copy files from one machine to another machine. I need to use Net::SCP module . Can you please give/help me small Perl snippet which will copy the files I was thinking this module's document has already given the examples. http://search.cpan.org/~ivan/Net-SCP-0.08/SCP.pm -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: PayPal API
On Tue, Feb 16, 2010 at 8:45 AM, Mike Blezien mick...@frontiernet.net wrote: Hello, we are in the process of setting up an API for Paypal's Masspay and was looking at the module: Business::PayPal::API::MassPay Has anyone had any experience using this module? Any bugs in it? Hi MIke, I never used this module by myself. But the module's author was active on mod_perl's mailing list IIRC. You may repost the question to that list to expect an answer. -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
make an alias to function
Hi, I have a module, and I wanted to make an alias with a function in that module. package abc; { # make an alias to another function no strict 'refs'; *{__PACKAGE__::init_squid_for_reverseproxy} = \init_reverseproxy; } But this won't work when calling it: my $obj = abc-new; $obj-init_squid_for_reverseproxy; The error says: Can't locate object method init_squid_for_reverseproxy via package abc . Why? OK I simply updated the alias definition to: *init_squid_for_reverseproxy = \init_reverseproxy; This works as I want. Is this the suitable one? Thanks. -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: make an alias to function
On Tue, Feb 16, 2010 at 3:40 PM, Uri Guttman u...@stemsystems.com wrote: *{__PACKAGE__::init_squid_for_reverseproxy} = \init_reverseproxy; *{ __PACKAGE__ . '::init_squid_for_reverseproxy' } = \init_reverseproxy; Thanks Uri. I really by mistake thought those two are the same stuff. Now I got it. :) -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: How to keep script alive if my shell closes
On Thu, Feb 11, 2010 at 6:39 AM, Shawn H Corey shawnhco...@gmail.com wrote: You can do the same thing inside Perl with %SIG: $SIG{HUP} = 'IGNORE'; Also nohup redirect all stdout and stderr to a file nohup.out. So you have also to reopen STDOUT and STDERR to a file handle if doing it in the script. btw, Cheers Chinese New Year for all Chinese Perl users. -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: XML to RDF using O O Perl
On Thu, Feb 11, 2010 at 6:00 AM, Aravind Venkatesan venka...@nt.ntnu.no wrote: Hello, I am new to perl. I am trying write a Perl module to convert KGML (XML file) to RDF format . Could anybody suggest as to how to go about this (just to give me a start). Hi, You may pick a book for learning some base knowledge about Perl's object stuff. The commercial book from OReilly: http://oreilly.com/catalog/9780596004781 The free book: http://www.greenteapress.com/perl/ HTH. Jeff. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: How to keep script alive if my shell closes
On Wed, Feb 10, 2010 at 2:40 AM, Ariel Casas ariel.ca...@gmail.com wrote: My question is; how do I keep my perl script from dying if my shell window accidentally closes while my perl script is paused at the system function portion of my script? Hi, Make a daemon process for running in the script, or use nohup: nohup perl a.pl HTH. Jeff. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: prepare(SELECT ... FROM TABLE) error
On Thu, Feb 11, 2010 at 2:03 AM, Jay Savage daggerqu...@gmail.com wrote: $@ is also *guaranteed*--in the words of perlfunc--to be set correctly. I believe that historically this may not have been the case: $@ may have only been set on failure and not flushed on success, but in recent Perls it should be reliable. I also agree. I'm also curious under what circumstances you believe the eval could fail but $@ not be true (i.e., when would you expect your code to print unknown?). I think Ruud didn't mean eval fail but $@ not be true. If I understand for that correctly, what he tried to explain is, under some cases the $@ is set by other eval {} call, not the current eval {} you followed. Though I don't know if there is the case it will happen... Jeff. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Perl CGI advise/feedback please ...
On Thu, Feb 11, 2010 at 10:18 AM, newbie01 perl newbie01.p...@gmail.com wrote: I need some guidance if someone know of any existing set of CGI-BIN scripts that I can just plug it and used for this purpose. Will you run the scripts under the share hosting environment? If so you are very hard to get the application secure. -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Perl Hiding Username/Password
On Thu, Feb 11, 2010 at 7:04 AM, newbie01 perl newbie01.p...@gmail.com wrote: The worry is someone getting access to the script and then putting in some print commands to expose the username and password information. Could take a look at: perldoc -q 'hide the source' -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: variable scope
在 2010-02-05五的 06:27 -0800,Eric写道: I have a program that requests many config values from an ini file using Config::IniFiles. I import all of these values into my main:: script but it's pretty ugly. Is there a way to import my value definitions int variables in a sub or another module and have them visible in the main:: scope as local variables. I once wrote a simple document for it, see: http://home.arcor.de/pangj/share_variables_between_perl_scripts.txt HTH. -- Jeff Peng Email: jeffp...@netzero.net Skype: compuperson -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Archive::Zip library on Solaris
I have a Perl Script that uses some of the Archive::Zip's methods for reading zip entries. Works fine on Linux, BUT on Solaris, this lib is not available in Solaris and I'm not allowed to install any lib in it. Is there a way to load the archive::zip lib dinamically, without installing it on the OS? You could download the module and install it by hand under your home directory. Then use lib '/path/to/module_dir' to include the directory in the scripts. HTH. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Win32 version 0.27 required
Hi, I'm running Perl on Windows XP, and have a script which I've run for ages with no problems. However, I now have a message per below: Win32 version 0.27 required--this is only version 0.24 at D:/Perl/lib/ Cwd.pm line 663. .. .and the script quits on me. You may want to upgrade Win32 module to the latest one: http://search.cpan.org/~jdb/Win32-0.39/Win32.pm HTH. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: how to convert perl file into binary
在 2010-01-21四的 10:51 +0530,V U Maheswara rao k写道: Hi All, can I convert perl file into binary file? So that my code will be secure/. perldoc -q 'hide the source' -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Data file with records that span two lines
在 2010-01-19二的 00:09 -0500,Perl Noob写道: I have a data file with thousands of records. The problem is that the records in the data file span two lines for each record. I want to write a perl script that makes each record a single line. The file looks like this: HI, If you are using a regex, then may want to try the /m option. see perldoc perlre for details. I give the code below, it could work for me. use strict; local $/=RECORD1FIELD5\n; while(DATA) { my @fields = /\w+/gm; print @fields\n; } __DATA__ RECORD1FIELD1 RECORD1FIELD2 RECORD1FIELD3 RECORD1FIELD3 RECORD1FIELD4 RECORD1FIELD5 RECORD2FIELD1 RECORD2FIELD2 RECORD2FIELD3 RECORD2FIELD3 RECORD2FIELD4 RECORD2FIELD5 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Basic Domain and IP Info
在 2010-01-17日的 11:16 -0600,Mike Blezien写道: Hello, I've been looking for some basic domain/IP info that we can generate for domain/IP addresses entered from a form. I've been searching CPAN without much luck, but maybe looking in the wrong places. What I like to do is obtain the following information for the domain/IP address: Name Servers for the domain name IPs associated with the domain What/How many sites are using the IP Reverse IP Lookup HTTP Status Code Are there any Perl modules, toolkits, available that do these type of task? Hi, What you want is an integrative Perl program, not just a perl module. The 1st,2nd and 4th could be done by Net::DNS module. For the 3rd item, do you mean how many virtual hosts are located in an IP? That is not easy to gather, unless you are the hostmaster of those IPs. For the 5th item, you may look at HTTP::Status following with LWP::UserAgent module if I understand for you correctly. HTH. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Geeky way to wish Happy Birthday through Perl
在 2010-01-17日的 23:34 +0530,Parag Kalra写道: Hello All, I am looking for a geeky way to wish someone on his Birthday with the help of Perl. Condition is - It should be one liner which I can directly execute from the command line. EG: perl -e print 'Happy Birthday Larry!!!' Google it with just another perl hacker. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Regarding module Mail-Box, and accessing subject field of a MBOX message
On, 2010-01-07 at 11:24 -0800, Shankar wrote: Hello, I'm using CPAN module, Mail-Box-2.093, to parse and process my MBOX file on Unix. I have a message as follows. I have an email, when I open in PINE on Unix, it shows the header as: [utf-8] Recommendation Letter... When I try to access this field using the Mail-Box module, I get a string which looks encoded. Something like: =?utf-8?b? umvjb21tzw5kyxrpb24gbgv0dgvyigzvcibeci4grc4grgfz?= That looks like an utf8 string with base64 encoded. You may reference to: perldoc Encode perldoc MIME::Base64 for details. Regards, Jeff. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: perl to flash
On 五, 2010-01-08 at 14:36 -0500, Uri Guttman wrote: i hate to be the police on questions here but recently we seem to have been getting a fair number of them that are not beginner level. Before stopping anyone from posting this NON-Begin questions, you must be able to define what's a begin question for perl. You may write that a FAQ on PerlFAQ or wiki then tell everybody about the urls, :) Jeff. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
regex optimization
Hello, Can the code (specially the regex) below be optimized to run faster? #!/usr/bin/perl for ($i=0; $i1000; $i+=1) { open HD,index.html or die $!; while(HD) { print $1,\n if /href=http:\/\/(.*?)\/.* target=_blank/; } close HD; } The index.html is got from: wget http://www.265.com/Kexue_Jishu/ I ask this because someone posted a question on ruby-talk list, shows perl's regex is much faster than ruby's. [Quote] #!/usr/bin/ruby 1000.times do File.open(index.html).each do |c| puts $1 if /href=http:\/\/(.*?)\/.* target=_blank/ =~ c end end time ./test.rb /tmp/t elap 6.511 user 6.336 syst 0.136 CPU 99.40% #!/usr/bin/perl for ($i=0; $i1000; $i+=1) { open HD,index.html or die $!; while(HD) { print $1,\n if /href=http:\/\/(.*?)\/.* target=_blank/; } close HD; } time ./test.pl /tmp/t elap 0.864 user 0.844 syst 0.020 CPU 100.04% So perl is 7 or 8 times faster here. [/Quote] But someone another optimized the ruby code and used ruby's built-in scan method, which makes the regex run a lot faster. [Quote] I get best results in Ruby with: regexp = %r{href=http://([^/]*)/[^]*\s+target=_blank} 1000.times do puts File.read('index.html').scan(regexp) end ~/ruby/bench time ruby19 regex.rb /dev/null real 0m1.428s user 0m1.359s sys 0m0.056s ~/ruby/bench time perl5.10.0 regex.pl /dev/null real 0m1.189s user 0m1.095s sys 0m0.084s It's still slower. Perl has regular expression magic beyond my imagination, though. I heard they take the most rare character in the literal part of the regex (let's say, the colon) and search for it using machine code, and then work their way backwards to the beginning of the regexp... Say what you want, but Perl rocks when it comes to text processing speed. [/Quote] So I'm asking what's Perl's optimization for that regex. I hope this doesn't disturb everyone, thanks. Regards, Jeff. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Script to create huge sample files
Parag Kalra: I am curious to know more on UTF and understand related issues that may creep in my algorithm. Could someone please shed some light on it. Can I use following: use Encode; while($sample_file_fh){ # Encoding into utf data $utf_data = encode(utf8, $_); For the line above, I may think it's not right. What you got from $sample_file_fh is maybe different encoding chunk, for example,iso-8859-1,gb2312 or UTF-8 etc. You want to translate them to Perl's internal utf8 format firstly,which includes a utf8 flag and the data part.After translation,utf8 flag should be on and the data part is the chunk with utf8 encoding.You do it with the decode() function from Encode module: my $internal_utf8 = decode(gb2312,$_); # given the data was gb2312 encoding originally After that,you could translate the $internal_utf8 to any encoding string you want, use the encode() function from Encode module as well: my $output = encode(utf8,$internal_utf8); # output with UTF-8 encoding HTH. $data_string = $data_string.$utf_data; } -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Script to create huge sample files
Parag Kalra: Hmmm - http://search.cpan.org/~dankogai/Encode-2.39/lib/Encode/Guess.pm It says right at the bottom that below method won't work to guess the encoding. :( Encode::Guess maybe work, but not so exactly. Because some Code Bits of an encoding are overlapped (for example,gb2312 and gbk),so you can't get the encoding style of a small string just by guess. But for large text,it maybe work rightly. Here is another guess way (not by me) you may reference to: use Encode; use LWP::Simple qw(get); use strict; my $str = get http://www.sina.com.cn;; eval {my $str2 = $str; Encode::decode(gbk, $str2, 1)}; print not gbk: $...@\n if $@; eval {my $str2 = $str; Encode::decode(utf8, $str2, 1)}; print not utf8: $...@\n if $@; eval {my $str2 = $str; Encode::decode(big5, $str2, 1)}; print not big5: $...@\n if $@; HTH. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Clone an object
Uri Guttman: and i bet you really don't need this but you just think you do. why not? I did have used object clone, like a ruby one: class Myclass end = nil x=Myclass.new = #Myclass:0xb7c4bca8 y=x.clone = #Myclass:0xb7c47194 x.object_id = -605921708 y.object_id = -605931318 The object was cloned, they both got different object IDs. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
force using the version of a module
Hello, The latest version of LWP::UserAgent (v5.834) has a method of local_address, which is needed by my software. The lower version of this module (for example, v5.824) doesn't have that method. So how to force to use the latest version of LWP::UserAgent in the perl script? Thanks. Merry Holidays! Jeff. Love Spell Click here to light up your life with a love spell! http://thirdpartyoffers.netzero.net/TGL2241/c?cp=WY6rCVc8u7r0rhlGINenTgAAJ1F5p0Q5uwV0jfKaKm9vU9yEAAYAAADNRwA= -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: force using the version of a module
Peter Scott : % perldoc -f use use Module VERSION LIST use Module VERSION [...] If the VERSION argument is present between Module and LIST, then the use will call the VERSION method in class Module with the given version as an argument. The default VERSION method, inherited from the UNIVERSAL class, croaks if the given version is larger than the value of the variable $Module::VERSION. Thanks. That's right for me. Regards, Jeff. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Hash of Hashes
2009/9/29 Shawn H Corey shawnhco...@gmail.com: Soham Das wrote: How can I create a Hash of Hashes from two lists. Is it possible? I want the effective functionality to be served like this $ChildHash[Joe][21A]=Sally i.e Joe at 21A has a child called Sally. List1 here will be the name of Parents, List2 here will contain the house number. Hashes use {}, arrays use [] That's in Python? :-) Perl's both hash and array use (). But anonymous hash and array use {} and []. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: get list of files sorted by date
2009/9/29 Andreas Moroder andreas.moro...@sb-brixen.it: Hello, according to the man glob can only sort by name. Is there a way to get a list of files sorted by date ? sure. first I will use unix's ls command like ls -ltr. in perl one of the ways: my @sorted = map { $_-[0] } sort { $a-[1] = $b-[1] } map { [$_,(stat $_)[9]] } glob *; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Wants to migrate from one machine to another.
Since you know the scripts' names you may find what modules they are using: http://search.cpan.org/~elliotjs/Module-Used-v1.2.0/lib/Module/Used.pm 2009/9/29 Raheel Hassan raheel.has...@gmail.com: Hello, We have one software which is installed at one machine. The software was developed by many developers(students) as it was used in multiple projects in the lab, all the code is written in perl. Now we want to do the backup of that software for that we want to make one copy running on a new machine. The problem we are facing is that we installed many CPAN modules and different developers used different CPAN modules and non of them did the documentation. I need your guidance that how we know that the software is using which modules plus on a new system we wants to preinstalled all the modules before moving the software. Regards, Raheel. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: HI
2009/9/30 Jyoti jcutiep...@gmail.com: Thanks for reply Rajiv. Will go through.Also can you explain me what this error means: Odd number of elements in anonymous hash at /usr/lib/cgi-bin/websubroutine.pl line 18. That may mean, you passed wrong arguments to the method in a class. The method expects a hash, should have even number of elements. line 18 is as follows: print $q-header(text/html), Maybe you got wrong in other location. This statement has no problem for me: # perl -MCGI -e '$q=CGI-new;print $q-header(text/html)' Content-Type: text/html; charset=ISO-8859-1 Jeff. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Help With Filtering Messages
2009/2/9 jimston...@aol.com: I know there is probably a simple solution for this, but can anyone help me with code to filter out messages with extended characters like these: àïåëüñèí êàïèëêà òàáëåòêè ïåðåêèñü òåëåôîí òåòðàäè êàðàíäàøè îá¸ðòêè îò êàíôåò êîðîáêà îò òåëåôîíà âàòà âàçà äèñêè êíèãè è òåòðàäè È åùå êó÷à áóìàæåê è âñÿêîãî õëàìà Just something to dump any messages with these characters. Is there a simple way? Just by guess to decode them to utf8 since you didn't know which way they are encoded. :-) use Encode; my @list = Encode-encodings(:all); # get all encoding ways for my $encoding (@list) { print decoded with $encoding:\n; print encode(utf8,decode($encoding,$your_string) ); } -- Jeff Peng Office: +86-20-38350822 AIM: jeffpang www.dtonenetworks.com
Re: how to print % when using printf
2009/2/7 itshardtogetone itshardtoget...@hotmail.com: Hi, How do I print the % sign when using printf. use another % to escape it. -- Jeff Peng Office: +86-20-38350822 AIM: jeffpang www.dtonenetworks.com -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: about print
2008/12/30 xie ningde n.d.ningde...@gmail.com: I'm a new perl user. I was trying to print an array by using print @array and print @array. Is it supposed to output the same thing? I got the different output. EX: @array=qw/v1 v2 v3/, the output for print @array will be v1v2v3 while it will be v1 v2 v3 in the other case. The difference is one is seperated by whitespace while the other is not. Welcome to the list. For your question, see: perldoc -q 'print an array' try to use perldoc, that's a good tool for learning Perl. -- Jeff Peng http://home.arcor.de/pangj/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Is there some IDE dedicated to perl?
2008/12/29 mobile.parmenides mobile.parmeni...@gmail.com: Hi, I am new to perl. Experience from the C programming tell my we can do something well with an IDE. But, is there some IDE of perl, in which we can do coding, debugging, etc? for general scripts programming, VI/VIM is enough,:) -- Jeff Peng http://home.arcor.de/pangj/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: How to read email from Inbox
2008/12/23 sanket vaidya sanket.vai...@patni.com: Hi all, How can we read mail from inbox without using mail client like outlook? Using perl. i.e. Is it possible to read Inbox of your gmail account using perl? I think it's possible. Search Gmail on CPAN and you will get something. -- Jeff Peng http://home.arcor.de/pangj/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: how do you do this in one step instead of two
On Fri, Jul 18, 2008 at 12:00 AM, Richard Lee [EMAIL PROTECTED] wrote: is there way to do this in one step? push @array, ($direction, $source); push @hh, [EMAIL PROTECTED] push @hh \($direction,$source) doesn't seem to work.. or not the samething push @hh, [$direction, $source]; -- Regards, Jeff. - [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: how do you do this in one step instead of two
On Fri, Jul 18, 2008 at 12:00 AM, Richard Lee [EMAIL PROTECTED] wrote: is there way to do this in one step? push @array, ($direction, $source); push @hh, [EMAIL PROTECTED] push @hh \($direction,$source) doesn't seem to work.. or not the samething push @hh, [$direction, $source]; -- Regards, Jeff. - [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: how do you do this in one step instead of two
On Fri, Jul 18, 2008 at 12:26 AM, Stewart Anderson [EMAIL PROTECTED] wrote: push @hh, [$direction, $source]; Is that creating an anonymous reference ? I think it's an anonymous array, not an anonymous reference. -- Regards, Jeff. - [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: uninstalling perl
On Mon, Jul 14, 2008 at 5:12 PM, Anirban Adhikary [EMAIL PROTECTED] wrote: Dear list If I want to remove perl from my linux/unix machine then what is the procedure for this? Why do it? Without Perl many system functions can't run. -- Regards, Jeff. - [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: fetching encrypted passwords for oracle username in Perl !
On Mon, Jul 14, 2008 at 4:40 PM, Amit Saxena [EMAIL PROTECTED] wrote: Hi Instead of hard-coded passwords in my source code or an input file, I would like to enable some sort of encryption through some keys for all the usernames in Oracle 10g. Please let me know how to do that with Perl DBI ? You focus on how to store datas into database, not on how to encrypt datas, is it? DBI can do that, see `perldoc DBI`. -- Regards, Jeff. - [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Um, do this for me, please...
Please read the FAQ item carefully below, thank you. (http://learn.perl.org/faq/beginners.html) 1.2 - How do I unsubscribe? Now, why would you want to do that? Send mail to [EMAIL PROTECTED], and wait for a response. Once you reply to the response, you'll be unsubscribed. If that doesn't work, find the email address which you are subscribed from and send an email like the following (let's assume your email is [EMAIL PROTECTED]): [EMAIL PROTECTED] On Sat, Jul 12, 2008 at 7:52 PM, ennui [EMAIL PROTECTED] wrote: I have attempted to unsubscribe from this list appx 20 times over the past year. I would appreciate it if the owner or mods of this list would unsubscribe me, please. -- Regards, Jeff. - [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: about Zlib
On Wed, Jul 2, 2008 at 12:50 PM, Rajnikant [EMAIL PROTECTED] wrote: I want to uncompress *.gz and *.tar on linux box. So is there any package which will do it for me? Can we use Zlib to do same? Search and use a module from CPAN, that will make things fast. like: http://search.cpan.org/~kane/Archive-Tar-1.38/lib/Archive/Tar.pm -- Regards, Jeff. - [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: simplify a path
On Wed, Jul 2, 2008 at 9:33 PM, Chen Yue [EMAIL PROTECTED] wrote: Hi I have a file containing UNIX-styled Path in each line. But the path is simplified enough. Some of them has .. and . in the middle, such as /a/b/./c/../d. Now I want to simplify each Path according to Unix tradition. /a/b/./c/../d-/a/b/d simple way: first go into /a/b/./c/../d, then execute getcwd or something like that to get the full path. -- Regards, Jeff. - [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: mailing list
On Tue, Jul 1, 2008 at 8:36 PM, Harry Bennett [EMAIL PROTECTED] wrote: I have not received a digest since 22 may. If I try to subscribe (again) I get no reply either to confirm or inform me that I am already on the list. Try to check your system's antispam policy to see if you have filtered/rejected the messages from this list. -- Regards, Jeff. - [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: DBI install
On Tue, Jul 1, 2008 at 8:39 PM, [EMAIL PROTECTED] wrote: Can any one help me out in Installing DBI in a standalone box. There is no internet connetion. I tried downloading DBI-1.48 module and tried using ppm and makefile.PL its not working. I am doing it correct or missing something? Posting the error messages here is helpful. Otherwise the people on the list don't know what happened to you. -- Regards, Jeff. - [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: looping
On Mon, Jun 30, 2008 at 3:24 PM, dakin999 [EMAIL PROTECTED] wrote: While I am reading each row data that is fetched by select query from oracle databae, I need to read some other values from a text file. This is where I am having issues. Can some one help me in formalising the write syntax (code) for doing these two thengs. DBI has fetchrow_arrayref and fetchrow_hashref methods, you may check those. The code logic could be: while(my $ref = $sth-fetchrow_hashref) { my $cond = get_another_condition($ref); handle_it($ref,$cond); } sub get_another_condition { my $r = shift; open FD,original.txt or die $!; # read from FD and do something with $r; close FD; # return something; } -- Regards, Jeff. - [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Automation
On Mon, Jun 30, 2008 at 3:26 PM, Ram [EMAIL PROTECTED] wrote: I want it run without any GUI. it shoud run automatically at defined time ? Perl script is running without GUI normally unless you use TK. crontab or at commands under unix can do what you wanted. please man them for details. -- Regards, Jeff. - [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: looping
On Tue, Jul 1, 2008 at 11:04 AM, Akhil Srivastava [EMAIL PROTECTED] wrote: Still I am not able to make it work. The problem is to read a file loop from inside a top loop and exit the file loop when the top loop finishes. You maybe should post the code piece to the list, we may have the chance to help you. -- Regards, Jeff. - [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/