what's the error?

2011-11-04 Thread Ken Peng
Hi, $ perl -le 'open HD,"/etc/passwd" or die $!; ; print $!' Bad file descriptor what does this error mean? why it happens? Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: what's the error?

2011-11-04 Thread Ken Peng
于 2011-11-5 11:16, Anneli Cuss 写道: $! is not guaranteed to be cleared if there was no error. This means you probably don't have a "Bad file descriptor" error, it's just the last value of $! (or 'errno'). That's confused. Since there is not such an error, I was thinking $! or $@ shouldn't inclu

Re: what's the error?

2011-11-05 Thread Ken Peng
于 2011-11-5 16:57, Uri Guttman 写道: it isn't confusing. when a system call error occurs, you get an undef return value which says that. then you check $! to see what was the error. clearing $! on all good calls is a waste of cpu since most calls succeed vs the number that fail. the same is true fo

Re: what's the error?

2011-11-05 Thread Ken Peng
于 2011-11-5 21:03, Shawn H Corey 写道: You're assuming that perl clears $! at the start of your script. Never assume a variable has a valid value unless you set it yourself. In other words, always initialize your variables. It did clear it, see this: $ perl -le 'print $!;open HD,"/etc/passwd" o

Re: what's the error?

2011-11-05 Thread Ken Peng
于 2011-11-5 21:03, Shawn H Corey 写道: You're assuming that perl clears $! at the start of your script. Never assume a variable has a valid value unless you set it yourself. In other words, always initialize your variables. It did clear it, see this: $ perl -le 'print $!;open HD,"/etc/passwd" o

Re: what's the error?

2011-11-05 Thread Ken Peng
于 2011-11-5 21:59, Shawn H Corey 写道: The open statement: perl -le 'print $!;open HD,"/etc/passwd" or die;print $!;;print $!' So why? Thanks. Ken. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: what's the error?

2011-11-05 Thread Ken Peng
于 2011-11-5 22:20, Dr.Ruud 写道: Who cares? You should only use $! *immediately* after an error. Faint, why no one care? I do care it. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: what's the error?

2011-11-05 Thread Ken Peng
ok if I said something rude I just say sorry now. I was just uncomfortable for that unwanted $!. 于 2011-11-5 22:39, Dr.Ruud 写道: On 2011-11-05 15:28, Ken Peng wrote: 于 2011-11-5 22:20, Dr.Ruud 写道: Who cares? You should only use $! *immediately* after an error. Faint, why no one care? I

Re: what's the error?

2011-11-05 Thread Ken Peng
于 2011-11-5 22:15, Shawn H Corey 写道: It's something the OS does. Ever OS sets a different value. $ perl -le 'print $!;open HD,"/etc/passwd" or die;print $!;;print $!' Inappropriate ioctl for device Inappropriate ioctl for device $ Thanks for your explanation. Maybe I should look into some o

Re: Words of Wisdom (WAS: what's the error?)

2011-11-06 Thread Ken Peng
于 2011-11-6 20:52, Shawn H Corey 写道: It's a little off: ... you can build a fire and keep a man warm for a night or put him on fire and keep him warm for the rest of his life! 授人以鱼不如授人以渔。 That's a well known Chinese proverb. Theres is another related one: 临渊羡鱼,不如退而织网。 Don't know how to tra

Re: $sth->errstr; and $sth->execute;

2011-11-07 Thread Ken Peng
于 2011-11-7 9:47, elodie 写道: I would appreciate if someone could explain what the following command does: $sth->execute; This run your SQL query. It is an object method. I would also like to know what the following command does: $sth->errstr; This is an instance variable of object, it incl

module for development

2011-12-15 Thread Ken Peng
Hello, Which module could show the order of loading modules? For example, use Foo; use Bar; BEGIN { require A; } I want to know in what order Perl loads these modules. Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.

Re: module for development

2011-12-15 Thread Ken Peng
2011/12/15 Brian Fraser : > > The second way is using an @INC hook, which is explained in perldoc -f > require. Here's a pretty simple form: > > BEGIN { unshift @INC, sub { say "@_[0..$#_]"; return } } > > But the real question here is, why do you need to know this? > Thanks Brian, your info is m

Re: module for development

2011-12-15 Thread Ken Peng
2011/12/15 shawn wilson : > > hence why i recommended strace so that you could see where perl looks > for modules and in what order. > > that said, if someone has a way inside perl to do the same thing, it > might be cool to know. Yup I did the strace as you suggested and got some useful stuff. T

Re: module for development

2011-12-15 Thread Ken Peng
> Hm, that's not quite right. It updates %INC as soon as it can open a filehandle and start reading, but I don't think it ever updates @INC unless you ask it to (e.g. by 'use lib' or -I on the command line, or mucking with it manually). > sorry my typo. it is %inc not @inc. if perl updates %inc a

Re: module for development

2011-12-15 Thread Ken Peng
2011/12/15 Shlomi Fish : > > See: > > http://search.cpan.org/dist/Devel-TraceUse/ > Great module, the result it prints is good. Thanks Shlomi. Ken. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Guidance for a New Programmer/Perl User

2011-12-16 Thread Ken Peng
2011/12/16 Shlomi Fish : > Regarding Perl 6 - you are right that it is taking a long time, and that some > people feel its implementations are not usable for them yet. But it doesn't > mean you can't use Perl 5 now, or that Perl 6 will never be ready, or that it > didn't have a positive influence

recognize input languages

2013-03-07 Thread Ken Peng
How can Perl recognize user's input languages? for example, if the message is in Chinese, the character encode will be GB2312. if it's in latin, the encode will be iso-8859-1, etc. Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...

daemon framework

2013-03-14 Thread Ken Peng
Hi Is there a suggested framework for running daemon program? like Net::Server for servers framework.I searched on cpan but got nothing suitable. Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: daemon framework

2013-03-14 Thread Ken Peng
于 2013-3-15 10:19, Jim Gibson 写道: Is there a suggested framework for running daemon program? like Net::Server for servers framework.I searched on cpan but got nothing suitable. > See 'perldoc -q daemon', which mentions Proc::Daemon (I have not used it). Thank you. I also currently happen to c

Re: daemon framework

2013-03-14 Thread Ken Peng
于 2013-3-15 10:19, Jim Gibson 写道: On Mar 14, 2013, at 7:18 PM, Ken Peng wrote: Hi Is there a suggested framework for running daemon program? like Net::Server for servers framework.I searched on cpan but got nothing suitable. See 'perldoc -q daemon', which mentions Proc::Daem

Re: Need to login/logout for Domain Users

2013-08-13 Thread Ken Peng
On 2013-8-14 13:38, Frank Vino wrote: Here is my requirement could you please help on this. I have Domain Controller for 100 users, and i have client PC (windows 7), i would like to login with multiple users for every 5 minutes in a same client PC. Do you mean you need to login into the re

raise an error

2013-09-25 Thread Ken Peng
Does perl have a way to raise a error in module/class then from caller use Try::Tiny etc to catch them? Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: raise an error

2013-09-25 Thread Ken Peng
On 2013-9-26 14:22, Shlomi Fish wrote: I'm not using Try::Tiny (though many people recommend it), but I use https://metacpan.org/release/Exception-Class and it works fine. It's not clear what exactly you're trying to do. what I asked is how to raise an error from a module/class correctly? usi

Perl cloud project

2013-12-16 Thread Ken Peng
Cloud is cool in these days. Is there a cloud project written by Perl? like python for openstack, ruby for cloudfoundry etc. Thanks for your answers. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Perl cloud project

2013-12-18 Thread Ken Peng
I am checking this one: http://www.activestate.com/blog/2011/05/stackato-platform-python-and-perl-cloud http://www.activestate.com/stackato Regards. 17.12.2013, 13:43, "Ken Peng" : > Cloud is cool in these days. > Is there a cloud project written by Perl? like python for ope

Re: References

2014-05-13 Thread Ken Peng
Hi, perldoc perlref has a good description for your questions. http://perldoc.perl.org/perlref.html On Wed, May 14, 2014 at 1:31 PM, Mike Dunaway wrote: > What's a good use of references? When is it ideal to use them? Why would > you want to use them? > > -- > To unsubscribe, e-mail: beginners

Re: Best way to distribute Perl utility packed with Fatpacker

2014-05-17 Thread Ken Peng
Package it using the tool like module-starter it will make you install the package as the standard process -- ./configure && make && make install http://search.cpan.org/~xsawyerx/Module-Starter-1.62/lib/Module/Starter.pm Regards. On Sat, May 17, 2014 at 3:17 AM, Mike Dunaway wrote: > So I'v

Re: Best way to distribute Perl utility packed with Fatpacker

2014-05-17 Thread Ken Peng
Greetings Shlomi, I am happy to see you have wrote a lot of articles for perl beginners. Thanks. On Sat, May 17, 2014 at 6:03 PM, Shlomi Fish wrote: > Hi Mike, > > On Fri, 16 May 2014 14:17:30 -0500 > Mike Dunaway wrote: > > > So I've written a Perl utility and packed it with Fatpacker that I

return the list content

2014-08-18 Thread Ken Peng
Hello, sub myfunc { my @x=(1,2,3); return \@x; } # or, sub myfunc { my @x=(1,2,3); return [@x]; } which one is the better way to return the list content? And if the method is an instance method? Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands

Re: Read email

2014-08-21 Thread Ken Peng
It depends. If going with pop3 protocal, http://search.cpan.org/~shay/libnet-1.27/Net/POP3.pm If going with IMAP protocal, then try search, http://search.cpan.org/search?query=imap&mode=all Also there are the modules for special providers, http://search.cpan.org/~dannyt/WWW-Gmail-1.0/lib/WWW/Gma

Re: return the list content

2014-09-08 Thread Ken Peng
Since this is a shadow copy, I don't think the first array will be deleted completely. Isn't it? The second option creates the same array and populates it, but then copies it to another anonymous array, deletes the first array, and returns a reference to the copy. -- To unsubscribe, e-mail:

Re: Books or links or knowledge base

2014-09-13 Thread Ken Peng
在 2014-09-13 15:54,Santosh Kumar 写道: Any good pointers or links on learning perl . Also any good pointer on OOPS concepts. http://learn.perl.org/ # and, http://learn.perl.org/books/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl

Re: Why to use a lib folder for a CPAN module

2014-10-09 Thread Ken Peng
Module-starter is cool. I always use that for my packages management. First of all, you should not use h2xs, but rather Dist-Zilla or Module-Starter (https://metacpan.org/release/Module-Starter ). -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beg

Two questions about perl resources

2014-12-04 Thread Ken Peng
Hello, #1. Is there a framework to send/receive the large binary data flow? I know thrift can do, but just don't like it. #2. Is there a native perl library to implement the features which 'iostat' command has? Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional

1994: How Perl Became the Foundation of Yahoo

2021-08-17 Thread Ken Peng
https://webdevelopmenthistory.com/1994-perl-yahoo/ A nice reading for perl developers. regards.

Re: Regex to detect natural language fragment

2021-09-13 Thread Ken Peng
Or use GPT-3 who has a free online API. https://openai.com/blog/openai-api/ regards On Mon, Sep 13, 2021 at 11:42 PM Chankey Pathak wrote: > You can look into NLP https://metacpan.org/search?q=nlp > > On Mon, 13 Sept 2021 at 21:04, Julius Hamilton < > juliushamilton...@gmail.com> wrote: > >> He

Re: Iterating over Arrays

2022-09-24 Thread Ken Peng
Hello Try with this code: use strict; use warnings; use Data::Dumper; my @words = ("this","that"); # With this code $words[5] = "bad idea"; print Dumper \@words; And it outputs: $VAR1 = [ 'this', 'that', undef, undef, undef, 'bad i

Re: Recommendations for setting up local Perl dev environment

2023-05-23 Thread Ken Peng
On 2023-05-24 09:21, Joe Sliva Jr. wrote: I've been on this list for years but haven't actually used Perl lately. That being said, I have an old Perl script that I would like to start working with again but would prefer to work on it within a local dev environment. Can anyone please recommend a