url_encode for LWP POST
Hi Would LWP::UserAgent call the url_encode() method from URL::Encode automatically for the posted content? use LWP::UserAgent; $ua = LWP::UserAgent-new; my $req = HTTP::Request-new( POST = 'http://rt.cpan.org/Public/Dist/Display.html'); $req-content_type('application/x-www-form-urlencoded'); $req-content('Status=ActiveName=libwww-perl'); my $res = $ua-request($req); print $res-as_string; Thank you. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: url_encode for LWP POST
Do you mean HTTP::Request::Common will do the url_encode stuff automatically? Thanks Charles. On 2013-7-25 18:30, Charles DeRykus wrote: On 7/25/2013 12:57 AM, Feng He wrote: Would LWP::UserAgent call the url_encode() method from URL::Encode automatically for the posted content? use LWP::UserAgent; $ua = LWP::UserAgent-new; my $req = HTTP::Request-new( POST = 'http://rt.cpan.org/Public/Dist/Display.html'); $req-content_type('application/x-www-form-urlencoded'); $req-content('Status=ActiveName=libwww-perl'); my $res = $ua-request($req); print $res-as_string; If I recall correctly, no it won't. And, you can confirm that by examining: $req-as_string; Probably the easiest way to do this is with HTTP::Request::Common which will handle escaping the form parameters for you, eg, use HTTP::Request::Common; use LWP::UserAgent; $ua-request( POST 'http://rt.cpan.org/Public/Dist/Display.html' [ Status = ..., Name=... ] ); -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: url_encode for LWP POST
Now I got it, from lwpcook it's this way: Lazy people use the HTTP::Request::Common module to set up a suitable POST request message (it handles all the escaping issues) and has a suitable default for the content_type: use HTTP::Request::Common qw(POST); use LWP::UserAgent; $ua = LWP::UserAgent-new; my $req = POST 'http://rt.cpan.org/Public/Dist/Display.html', [ Status = 'Active', Name = 'libwww-perl' ]; print $ua-request($req)-as_string; Thanks. On 2013-7-25 18:30, Charles DeRykus wrote: If I recall correctly, no it won't. And, you can confirm that by examining: $req-as_string; Probably the easiest way to do this is with HTTP::Request::Common which will handle escaping the form parameters for you, eg, use HTTP::Request::Common; use LWP::UserAgent; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Social network map
On 2013-7-15 19:30, htchd...@live.com wrote: How to draw a social network map in Perl? what's a social network map? I have been using RRDtool for graphing you may take a look: http://oss.oetiker.ch/rrdtool/ Regards. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: SSH connection to different network devices
On 2013-7-15 18:42, Dr.Ruud wrote: I need some advice which library or module to use for multiple connection to network devices. For example change status of ports on the hundred switches. Also check out 'ansible'. ansible is python's. I suggest this perl one which is quite nice: http://rexify.org/ Regards. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Hi
于 2013-1-11 7:57, Shawn H Corey 写道: On Thu, 10 Jan 2013 18:36:07 -0500 Lou Pereira louis.pere...@ptalc.com wrote: I beg to differ regarding your comment. I have been trying to be removed from this list for over a year to no avail. So, all knowledge one, how do we remove ourselves from this mail list? Send a email to: beginners-unsubscr...@perl.org You will get a confirmation reply. Press Reply and Send. You will get a final message saying good-bye. every replying messages have the foot info which includes the unsubscribing way: To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: What is the difference between () and [] syntax for array?
于 2013-1-8 9:33, Neo Anderson 写道: I think there are two ways to declare an array: my @a1 = (1, 2, 3);my @a2 = [1, 2, 3]; What is the difference? The first is an array. The second is a reference to the array. And you should define the second with: my $a2 = [1,2,3]; $a2 is a scalar not an array now. HTH. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: about ORM
Thanks for letting me know these, Shlomi. 30.12.2012, 15:05, Shlomi Fish shlo...@shlomifish.org: Hi Feng, On Sun, 30 Dec 2012 10:14:03 +0800 Feng He fen...@nsbeta.info wrote: Hello, I have a question that, what's the advantage of using an ORM instead of the traditional DBI? And what's better for DBIx::Class and Class::DBI? Avoid Class::DBI - it is old and lame. DBIx::Class is its more modern and much better alternative/re-implementation. Regarding the advantage of using an Object Relational Mapper ( ORM - http://en.wikipedia.org/wiki/Object-relational_mapping ) instead of traditional DBI - I suppose it is the same as any other abstraction: once you learn it, it may be easier to write code using it, require less programming effort and less code. The possible downside is that, as abstractions go, it may be leaky - http://www.joelonsoftware.com/articles/LeakyAbstractions.html - and/or quirky - http://shlomif-tech.livejournal.com/49510.html , or just plain buggy. Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ First stop for Perl beginners - http://perl-begin.org/ Trying to block Internet pornography is like climbing a waterfall and trying to stay dry. (— one of Shlomi Fish’s Internet Friends) Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
about ORM
Hello, I have a question that, what's the advantage of using an ORM instead of the traditional DBI? And what's better for DBIx::Class and Class::DBI? Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Help with a regex
You probably had $string double quoted instead of single quoted which later results in the \ being eaten. Thank you. The people who said the problem of double quoted string are correct, I didn't know this item before. This is what I really want: use strict; my $email1 = restore_email_from_soa('support.dnsbed.com.'); my $email2 = restore_email_from_soa('dns\.support.dnsbed.com.'); my $email3 = restore_email_from_soa('dns\.tech\.support.dnsbed.com.'); print $email1,\n; print $email2,\n; print $email3,\n; sub restore_email_from_soa { my $email = shift; $email =~ s/\.$//; if ($email =~ /^(.*?)(?!\\)\.(.*)$/) { my $user = $1; my $tld = $2; $user =~ s/\\//g; return $user . '@'. $tld; } } The output: supp...@dnsbed.com dns.supp...@dnsbed.com dns.tech.supp...@dnsbed.com Thanks a lot! -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Help with a regex
Hello, I have a string like: dns\.support.dnsbed.com I want to translate it to a regular email address: dns.supp...@dnsbed.com if ($string =~ /^(.*?)(?!\\)\.(.*)$/) { my $user = $1; my $tld = $2; return $user . '@'. $tld; } But this won't work correctly. I got: d...@support.dnsbed.com Where do I get wrong? Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Problem of general running of simple perl program.
You have lost the module named as Email::MIME. 于 2012-11-5 11:01, hong zeng 写道: Hi, When I run the send_email example on the website, I got some warning like this...I am really a beginner so I don't know where to find the answer so I post here. Thank you guys. ece% perl ./perl_test/send_email.pl Can't locate Email/MIME.pm in @INC (@INC contains: /afs/bp.ncsu.edu/contrib/perl561/lib/5.6.1/linux /afs/bp.ncsu.edu/contrib/perl561/lib/5.6.1 /afs/bp.ncsu.edu/contrib/perl561/lib/site_perl/5.6.1/linux /afs/bp.ncsu.edu/contrib/perl561/lib/site_perl/5.6.1 /afs/bp.ncsu.edu/contrib/perl561/lib/site_perl .) at ./perl_test/send_email.pl line 5. BEGIN failed--compilation aborted at ./perl_test/send_email.pl line 5. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Problem of general running of simple perl program.
Seems this one: http://search.cpan.org/~rjbs/Email-MIME-1.911/lib/Email/MIME.pm 于 2012-11-5 11:22, hong zeng 写道: Where should I write this module and how? On Sun, Nov 4, 2012 at 10:10 PM, Feng Hefen...@nsbeta.info wrote: You have lost the module named as Email::MIME. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Can't call method error
You will always be able to check the return status of a method call, something like: my $obj = Some::Module-new or die can't create object from Some::Module; Regards. On Sat, Aug 13, 2011 at 7:58 AM, Jeffrey Joh johjeff...@hotmail.com wrote: I'd like to include code so that if I get the following error, the script will just ignore it and keep running: Can't call method attr on an undefined value at abcde.pl line 2 Does anyone know of such a code? Jeff -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: how to use jks encrypt in perl webservice
Have you tried SOAP::Lite? 2011/8/8 王璟 wangj...@300.cn: My service is published by J2EE , it's use SOAP and RSA jks encrypt (serverStore.jks and clientStore.jks). I need to use PERL to invoke the webservice . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: install the prerequisite module automatically
On Fri, Aug 5, 2011 at 4:36 PM, Dermot paik...@googlemail.com wrote: If the Makefile.PL for you module has requires MIME::Lite in then the end user will get a warning about the lack of a dependency. You can not force the required modules to install on an end user's machine. That will be down to how the end user configured their CPAN. Their cpan config will have a line for 'prerequisites_policy'. Possible values include ask or follow. If it follow, then the prerequisites are downloaded and installed. Otherwise it will ask the user if they want to install the required modules. Thanks. Do you mean this section in Makefile.PL? PREREQ_PM = { 'Test::More' = 0, }, Regards. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
install the prerequisite module automatically
Hi, I have wrote a module and released it with module-starter. (http://search.cpan.org/~xsawyerx/Module-Starter-1.58/lib/Module/Starter.pm) When I install it from the CPAN shell, how can I make the shell install the prerequisite modules automatically? for example, my module: package ABC; use MIME::Lite; ... 1; When I install ABC from CPAN shell, I want to make it install MIME::Lite automatically. Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: is there //= operator?
Ubuntu 10.04 is Perl 5.10, which has this operator avaiable. On Wed, Aug 3, 2011 at 1:59 PM, shawn wilson ag4ve...@gmail.com wrote: On Aug 3, 2011 12:40 AM, Brian Fraser frase...@gmail.com wrote: On Wed, Aug 3, 2011 at 2:32 AM, terry peng terry.p...@mail.ru wrote: I have forgot that, is there a //= operator in Perl? which should do the same stuff as: unless (defined($foo) ) { $foo = ...; } Thanks. Yes. Now wasn't that simple? : ) It's the defined-or, and you can read more about it on perlop[0]. Do be mindful that in ancient versions of Perl it's not available; If for whatever reason you are on one of those.. Please update? [0] http://perldoc.perl.org/perlop.html#C-style-Logical-Defined-Or Debian stable ( 6 ) was 5.8, so if you're in a shop that uses debian and likes to test that still might not be available to you. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
perl's -M
What's the meaning of Perl's -M operator? which perldoc document is it get descripted in? Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: perl's -M
Thank you all for the kind info. On Fri, Jul 22, 2011 at 4:57 PM, Shlomi Fish shlo...@shlomifish.org wrote: Hi Feng, On Fri, 22 Jul 2011 16:47:09 +0800 Feng He short...@gmail.com wrote: What's the meaning of Perl's -M operator? which perldoc document is it get descripted in? If you mean the -M operator inside Perl code see: http://perldoc.perl.org/functions/-X.html (Accessible as perldoc -f -X - -f for function.). If you mean the command-line flag, see: http://perldoc.perl.org/perlrun.html (perldoc perlrun). Hope it helps. Regards, Shlomi Fish -- - Shlomi Fish http://www.shlomifish.org/ Chuck Norris/etc. Facts - http://www.shlomifish.org/humour/bits/facts/ An original philosopher knows the right combination of ideas to steal. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: XML suggestions
2011/7/13 Doug Bradbury dbradb...@8thlight.com: Does anyone have suggestions for an active and easy to use XML building parsing module? For a simple XML parsing I have used the module XML::Simple which just run well. Regards. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: hiii
2011/7/9 Narasimha Madineedi simha...@gmail.com: hi all, any net::ftp commands to get latest file from the directory. won't ls -ltr sort the files by date? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/