Can't not install Inline::Ruby module
Hi all, I try to install a perl module called Inline::Ruby but it fails. Here is the error information: C:\Perl\local\Inline-Ruby-0.02perl Makefile.PL Could not find the ruby interpreter on your PATH. Stopping... Any idea how to fix it? Thanks, Li __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Can't not install Inline::Ruby module
On 12/20/2006 02:34 AM, chen li wrote: Hi all, I try to install a perl module called Inline::Ruby but it fails. Here is the error information: C:\Perl\local\Inline-Ruby-0.02perl Makefile.PL Could not find the ruby interpreter on your PATH. Stopping... Any idea how to fix it? Thanks, Li Do you have a Ruby interpreter installed? Is is available on the system PATH ? If either of the answers is no, that would explain the problem. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
About MVC framework
I'm looking for a MVC framework that fast in develop and run. and I don't want to build it myself, please recommend someome. Thanks for any help! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: About MVC framework
On Wed, Dec 20, 2006 at 04:54:15PM +0800, Wan wrote: I'm looking for a MVC framework that fast in develop and run. and I don't want to build it myself, please recommend someome. http://search.cpan.org/search?query=MVC (Catalyst is probably the most popular option these days. It gets a lot of buzz, at least.) -- David Dorward http://dorward.me.uk -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: About MVC framework
On Wed, Dec 20, 2006 at 04:54:15PM +0800, Wan wrote: I'm looking for a MVC framework that fast in develop and run. and I don't want to build it myself, please recommend someome. http://search.cpan.org/search?query=MVC (Catalyst is probably the most popular option these days. It gets a lot of buzz, at least.) Catalyst is not fast enough in run -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Can't not install Inline::Ruby module
--- Mumia W. [EMAIL PROTECTED] C:\Perl\local\Inline-Ruby-0.02perl Makefile.PL Could not find the ruby interpreter on your PATH. Stopping... Do you have a Ruby interpreter installed? Is is available on the system PATH ? If either of the answers is no, that would explain the problem. Yes. I have a Ruby interpreter installed and it works fine for running Ruby scripts. But I am not sure why it is not available on the system PATH. Thanks, Li __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: About MVC framework
On Dec 20, 2006, at 2:54 AM, Wan wrote: I'm looking for a MVC framework that fast in develop and run. and I don't want to build it myself, please recommend someome. Thanks for any help! Take a look at CGI::Application too: http://search.cpan.org/~markstos/CGI-Application-4.06/ I think it fits what you describe quite well. Kindest Regards, -- Bill Stephenson 417-546-8390 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Can't not install Inline::Ruby module
On 12/20/2006 07:48 AM, chen li wrote: C:\Perl\local\Inline-Ruby-0.02perl Makefile.PL Could not find the ruby interpreter on your PATH. Stopping... Yes. I have a Ruby interpreter installed and it works fine for running Ruby scripts. But I am not sure why it is not available on the system PATH. Thanks, Li I can't tell you how to get the Ruby interpreter onto the system PATH in Windows. Any Windows users out there? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Can't not install Inline::Ruby module
chen li wrote: Yes. I have a Ruby interpreter installed and it works fine for running Ruby scripts. But I am not sure why it is not available on the system PATH. Do you run Ruby scripts from any directory on your Windows system? -- David Moreno Garza [EMAIL PROTECTED] | http://www.damog.net/ Si tienes quién te quiera, entonces eres millonario. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Cannot install Inline::Ruby module
--- David Moreno Garza [EMAIL PROTECTED] wrote: Do you run Ruby scripts from any directory on your Windows system? I think so. And here are some tests: C:\Ruby\selfa1.rb 1 2 3 4 5 6 7 8 9 10 C:\c:\ruby\self\a1.rb 1 2 3 4 5 6 7 8 9 10 C:\ruby c:\ruby\self\a1.rb 1 2 3 4 5 6 7 8 9 10 C:\ Li __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Can't not install Inline::Ruby module
Mumia W. wrote: I can't tell you how to get the Ruby interpreter onto the system PATH in Windows. Any Windows users out there? If he can launch the Ruby interpreter from any location of the Windows filesystem tree, then it's probably a bug of the module itself, when stating that it can't find it. -- David Moreno Garza [EMAIL PROTECTED] | http://www.damog.net/ Lo poco que yo tengo lo gané con mi sudor. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: foolprof regex
On Wed, Dec 20, 2006 at 02:56:28PM +0700, beast wrote: Hi All, Basically I want these input : name= name= name= name = But I did not want these input: my name = name is = my name is = -- if ( /\s*name\s*=/) { print Match: $_; } did not works as i expected. At a wild guess, I'd say that you're probably getting the matches you want, plus getting the my name = as a match. The reason is that you didn't specify that the leading spaces before the word name must be at the beginning of the line. For that, use ^. Use perldoc perlre to learn more about it. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] It's just incredible that a trillion-synapse computer could actually spend Saturday afternoon watching a football game. - Marvin Minsky -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: foolprof regex
beast wrote: Hi All, Hello, Basically I want these input : name= name= name= name = But I did not want these input: my name = name is = my name is = -- if ( /\s*name\s*=/) { print Match: $_; } did not works as i expected. You need to anchor the pattern to the beginning of the line: if ( /^\s*name\s*=/ ) { John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: foolprof regex
Chad Perrin wrote: At a wild guess, I'd say that you're probably getting the matches you want, plus getting the my name = as a match. The reason is that you didn't specify that the leading spaces before the word name must be at the beginning of the line. For that, use ^. Use perldoc perlre to learn more about it. Oh, no =( Thanks! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: HTML::TokeParser question
On 12/19/2006 10:58 PM, Mathew Snyder wrote: I have a script which runs WWW::Mechanize to obtain a page so it can be parsed for email addresses. However, I can't recall how I'm supposed to use HTML::TokeParser to get what I need. This is the pertinent part of the script: ... my $data = $agent-content(); my $parse= new HTML::TokeParser($data); my @emails; my $token; while ($data) { $token = $parse-get_trimmed_text(/small); push @emails, $token; } foreach my $email (@emails){ print $email; }; This gives me the error Can't call method get_trimmed_text on an undefined value at ./check_delete_users.pl line 40. I had this working at one point but lost the file. What am I missing? Mathew It looks like the invokation of HTML::TokeParser-new() failed. Read the documentation HTML::TokeParser to find out why. Hint: the new method expects a simple scalar to be a file name. Also, you get the content of the request not directly from the user-agent object, but from the response object returned by the get method. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
constructing a http request using LWP..
Hi there, is it possible to automate the login and log out say from yahoo mail using LWP/HTTP module. cause i have application which is similar to this and i have to send my login request alongwith few query parameters . after i login i will be logged in to my applications mail box. how can i do this..i know which query parameters to send but not able to construct the url. the query parameters are site=xyz.abc.com lang=en locale=us and few more..which are static. but there is something called random number which is hidden one and which is generated randomly. if i do view source on the login page then i can get the value of this random number. my query is how do i get this random number from my perl script and pass it as query param. any idea will be helpful. thanks in advance, pm
Re: Module for printing file with CUPS
Toddy Prawiraharjo [EMAIL PROTECTED] wrote: Hello all, I am starting to learn how to print via perl in linux. I have setup a network printer (using CUPS), which support TCP/IP and socket (9100). What module do i need, if necessary, to print a file using that printer? Thanks in advance Toddy I haven't used it, but there's a module on CPAN called Net::CUPS. Glancing at the methods it provides it looks to me like it may by what you need. http://search.cpan.org/~dhageman/Net-CUPS-0.41/Printer/Printer.pm Larry
RE: constructing a http request using LWP..
Hi pm I had the same requirement, just with a press of a button, I need my inbox(all the login etc should be automated) I wrote the following script. (You may have to install the Win32::GuiTest module from cpan. (also change YOURLOGIN and YOURPASSWORD appropriately). With this you don't have to worry about constructing the query string. use Win32::GuiTest qw(:ALL); system(start iexplore.exe); sleep(3); # this delay for the window # to comeup - try to increase #if it is not sufficient SendKeys('^(l)'); SendKeys('http://mail.yahoo.com{ENTER}'); sleep(15); # This delay is to load the #page - try to increase if it is not sufficient SendKeys('YOURLOGIN{TAB}'); SendKeys('YOURPASSWORD{ENTER}'); Thanks Prasanna -Original Message- From: positive mind [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 20, 2006 5:24 PM To: beginners@perl.org Subject: constructing a http request using LWP.. Hi there, is it possible to automate the login and log out say from yahoo mail using LWP/HTTP module. cause i have application which is similar to this and i have to send my login request alongwith few query parameters . after i login i will be logged in to my applications mail box. how can i do this..i know which query parameters to send but not able to construct the url. the query parameters are site=xyz.abc.com lang=en locale=us and few more..which are static. but there is something called random number which is hidden one and which is generated randomly. if i do view source on the login page then i can get the value of this random number. my query is how do i get this random number from my perl script and pass it as query param. any idea will be helpful. thanks in advance, pm -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Module for printing file with CUPS
also be aware that in previous versions of CUPS there was a native ability to print directly to a file; per the cups users group it was removed at some point because too many people were complaining about how difficult/unintuitive it was (seems like if i could figure it out at the time, anybody could, but oh well. also seems rather anal and bass-ackwards to remove a perfectly good function instead of improving it, but again - oh well). i discovered that when i needed to migrate that particular program to a newer version of linux - and couldn't because that functionality no longer existed and any help was reluctant at best. you might check to see if anyone on the CUPS side knows if that functionality has been revived. On 12/20/06, Larry Johnson [EMAIL PROTECTED] wrote: Toddy Prawiraharjo [EMAIL PROTECTED] wrote: Hello all, I am starting to learn how to print via perl in linux. I have setup a network printer (using CUPS), which support TCP/IP and socket (9100). What module do i need, if necessary, to print a file using that printer? Thanks in advance Toddy I haven't used it, but there's a module on CPAN called Net::CUPS. Glancing at the methods it provides it looks to me like it may by what you need. http://search.cpan.org/~dhageman/Net-CUPS-0.41/Printer/Printer.pm Larry -- since this is a gmail account, please verify the mailing list is included in the reply to addresses -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: HTML::TokeParser question
Mumia W. wrote: On 12/19/2006 10:58 PM, Mathew Snyder wrote: I have a script which runs WWW::Mechanize to obtain a page so it can be parsed for email addresses. However, I can't recall how I'm supposed to use HTML::TokeParser to get what I need. This is the pertinent part of the script: ... my $data = $agent-content(); my $parse= new HTML::TokeParser($data); my @emails; my $token; while ($data) { $token = $parse-get_trimmed_text(/small); push @emails, $token; } foreach my $email (@emails){ print $email; }; This gives me the error Can't call method get_trimmed_text on an undefined value at ./check_delete_users.pl line 40. I had this working at one point but lost the file. What am I missing? Mathew It looks like the invokation of HTML::TokeParser-new() failed. Read the documentation HTML::TokeParser to find out why. Hint: the new method expects a simple scalar to be a file name. Also, you get the content of the request not directly from the user-agent object, but from the response object returned by the get method. No. A call to $agent-content is valid and does what is expected. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: HTML::TokeParser question
Mathew Snyder wrote: I have a script which runs WWW::Mechanize to obtain a page so it can be parsed for email addresses. However, I can't recall how I'm supposed to use HTML::TokeParser to get what I need. This is the pertinent part of the script: ... my $data = $agent-content(); my $parse= new HTML::TokeParser($data); If you are supplying an HTML string directly then the 'new' method expects a scalar reference. A simple scalar is assumed to be a filename, and checking the return value from the constructor would have shown your problem. my $parse = new HTML::TokeParser(\$data) or die $!; my @emails; my $token; while ($data) { $data remains unchanged and will always be true. You need to fetch all the small tags in the HTML and exit the loop when there are no more. while ($parse-get_tag('small')) { $token = $parse-get_trimmed_text(/small); push @emails, $token; } foreach my $email (@emails){ print $email; }; This gives me the error Can't call method get_trimmed_text on an undefined value at ./check_delete_users.pl line 40. I had this working at one point but lost the file. What am I missing? The rest should work. HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: constructing a http request using LWP..
positive mind wrote: Hi there, is it possible to automate the login and log out say from yahoo mail using LWP/HTTP module. cause i have application which is similar to this and i have to send my login request alongwith few query parameters . after i login i will be logged in to my applications mail box. how can i do this..i know which query parameters to send but not able to construct the url. the query parameters are site=xyz.abc.com lang=en locale=us and few more..which are static. but there is something called random number which is hidden one and which is generated randomly. if i do view source on the login page then i can get the value of this random number. my query is how do i get this random number from my perl script and pass it as query param. any idea will be helpful. You probably want the WWW::Mechanize module which will let you emulate form filling and submission on a Web browser, including any hidden fields. If you can give us the URL for the login page we will be able to help you better. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: constructing a http request using LWP..
Hi Prasanna, Thanks for your reply, but i have to do this on linux. does Win32 or any equivalent module is available on Linux? thanks, pm On 12/20/06, Nagasamudram, Prasanna Kumar [EMAIL PROTECTED] wrote: Hi pm I had the same requirement, just with a press of a button, I need my inbox(all the login etc should be automated) I wrote the following script. (You may have to install the Win32::GuiTest module from cpan. (also change YOURLOGIN and YOURPASSWORD appropriately). With this you don't have to worry about constructing the query string. use Win32::GuiTest qw(:ALL); system(start iexplore.exe); sleep(3); # this delay for the window # to comeup - try to increase #if it is not sufficient SendKeys('^(l)'); SendKeys('http://mail.yahoo.com{ENTER}'); sleep(15); # This delay is to load the #page - try to increase if it is not sufficient SendKeys('YOURLOGIN{TAB}'); SendKeys('YOURPASSWORD{ENTER}'); Thanks Prasanna -Original Message- From: positive mind [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 20, 2006 5:24 PM To: beginners@perl.org Subject: constructing a http request using LWP.. Hi there, is it possible to automate the login and log out say from yahoo mail using LWP/HTTP module. cause i have application which is similar to this and i have to send my login request alongwith few query parameters . after i login i will be logged in to my applications mail box. how can i do this..i know which query parameters to send but not able to construct the url. the query parameters are site=xyz.abc.com lang=en locale=us and few more..which are static. but there is something called random number which is hidden one and which is generated randomly. if i do view source on the login page then i can get the value of this random number. my query is how do i get this random number from my perl script and pass it as query param. any idea will be helpful. thanks in advance, pm
'unknown column' error
Hi, I'm trying to insert a record in a MySQL database using Perl. I already wrote a (working) Perl script to make queries, but now I get this problem. This is the relevant part of the code: $plaats = Oostvoorne; $straat = Middellandweg; $teller = 3; $complex = 5; $opdracht = insert into woningen (complex,plaats,straat,huisnr) values ($complex,$plaats,$straat,$teller); $sth = $dbh-prepare($opdracht); $sth-execute or die Connection Error: $DBI::errstr\n; This is the errormessage: DBD::mysql::st execute failed: Unknown column 'Oostvoorne' in 'field list' at /home/Huub/workspace/VulWoningen/VulWoningen.pl line 31. Connection Error: Unknown column 'Oostvoorne' in 'field list' It says 'Unknown column'. That is right: It's no column, it's data to be inserted into the column. When I use the query directly in MySQL, there's no problem. So what is going wrong here? Thanks for helping. Huub -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: 'unknown column' error
$opdracht = insert into woningen (complex,plaats,straat,huisnr) values ($complex,$plaats,$straat,$teller); Above is wrong.You maybe want the statement of: $opdracht = insert into woningen (complex,plaats,straat,huisnr) values ('$complex','$plaats',$straat,$teller); When your column type isn't int style,then you need to use '$value' for insert.(Note for the single quotes pair). -- Books below translated by me to Chinese. Practical mod_perl: http://home.earthlink.net/~pangj/mod_perl/ Squid the Definitive Guide: http://home.earthlink.net/~pangj/squid/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
File:: Copy
I can't get use File::Copy to work. I declare it at the beginning of script but when I try to use it latter nothing happens. There are no errors and nothing is copied. I'm using the command! copy($variable, $variable2); I've also tried cp rather then copy. Don Dukelow smime.p7s Description: S/MIME cryptographic signature
Re: File:: Copy
I can't get use File::Copy to work. I declare it at the beginning of script but when I try to use it latter nothing happens. There are no errors and nothing is copied. Did you also add use strict and use warnings at the begin of the script and still saw nothing? -- Books below translated by me to Chinese. Practical mod_perl: http://home.earthlink.net/~pangj/mod_perl/ Squid the Definitive Guide: http://home.earthlink.net/~pangj/squid/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: File:: Copy
On 20 Dec 2006 at 8:00, Dukelow, Don wrote: I can't get use File::Copy to work. I declare it at the beginning of script but when I try to use it latter nothing happens. There are no errors and nothing is copied. I'm using the command! copy($variable, $variable2); I've also tried cp rather then copy. Just a guess but try copy($variable, $variable2) or warn Can't copy: $!\n; you might get something meaningful back. Dp.
Re: 'unknown column' error
Huub am Mittwoch, 20. Dezember 2006 14:47: Hi, Hello I'm trying to insert a record in a MySQL database using Perl. I already wrote a (working) Perl script to make queries, but now I get this problem. This is the relevant part of the code: $plaats = Oostvoorne; $straat = Middellandweg; $teller = 3; $complex = 5; $opdracht = insert into woningen (complex,plaats,straat,huisnr) values ($complex,$plaats,$straat,$teller); warn $opdracht; would show what is going wrong :-) $sth = $dbh-prepare($opdracht); $sth-execute or die Connection Error: $DBI::errstr\n; This is the errormessage: DBD::mysql::st execute failed: Unknown column 'Oostvoorne' in 'field list' at /home/Huub/workspace/VulWoningen/VulWoningen.pl line 31. Connection Error: Unknown column 'Oostvoorne' in 'field list' It says 'Unknown column'. That is right: It's no column, it's data to be inserted into the column. When I use the query directly in MySQL, there's no problem. So what is going wrong here? That's because the (string) values do not appear quoted in the insert statement and thus are interpreted as field names; the quotes in Oostvoorne are on the perl level. You would have to write it like 'Oostvoorne' or better q('Oostvoorne'). The better way is imho to use the quote() method for values, and the best to use ? placeholders and give the values to the execute() method - which prevents sql injections on a basic level. See perldoc DBI Hope this helps! Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: File:: Copy
Jeff Pang am Mittwoch, 20. Dezember 2006 15:09: Dukelow, Don [EMAIL PROTECTED] I can't get use File::Copy to work. I declare it at the beginning of script but when I try to use it latter nothing happens. There are no errors and nothing is copied. Did you also add use strict and use warnings at the begin of the script and still saw nothing? ...and it would also be a good idea to check if the copy operation succeeded - see the the SYNOPSIS example in perldoc File::Copy :-) Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: 'unknown column' error
On Wed, 2006-12-20 at 14:47 +0100, Huub wrote: $opdracht = insert into woningen (complex,plaats,straat,huisnr) values ($complex,$plaats,$straat,$teller); $sth = $dbh-prepare($opdracht); $sth-execute or die Connection Error: $DBI::errstr\n; ... It says 'Unknown column'. That is right: It's no column, it's data to be inserted into the column. When I use the query directly in MySQL, there's no problem. So what is going wrong here? Non-numeric values need to be quoted properly for the database to understand what you are trying to do. DBI provides an excellent way to do the quoting automatically by using placeholders. Your queries are better written as: $opdracht = INSERT INTO wonigen (complex,plaats,straat,huisnr) VALUES (?,?,?,?); $sth = $dbh-prepare($opdracht); $sth-execute($complex,$plaats,$straat,$teller) or die Connection Error: $DBI::errstr\n; Not only will this free you from worrying about how to quote the variables, but it allows you to re-use the same statement with different variables by passing different arguments to execute again. -- Greg Sabino Mullane [EMAIL PROTECTED] End Point Corporation signature.asc Description: This is a digitally signed message part
doubt on time structures
Hello, I used the follwoing code: struct rusage startusage, stopusage; getrusage(RUSAGE_SELF, startusage); getrusage(RUSAGE_SELF, stopusage); cpu_delta_user=((stopusage.ru_utime.tv_sec*100) + stopusage.ru_utime.tv_usec) -(startUsage.ru_utime.tv_sec*100) + startUsage.ru_utime.tv_usec); cpu_delta_sys=((stopusage.ru_stime.tv_sec*100) + stopusage.ru_stime.tv_usec) -((startUsage.ru_stime.tv_sec*100) + startUsage.ru_stime.tv_usec); And the options I used in makefile to compile my code: CFLAGS = -c -Wall -DUNIX -DLINUX -D_GNU_SOURCE -DFLOATING_POINT_SUPPORT=1 - DTHREAD_SAFE -D_REENTRANT -DLINK_AMS -DLINK_DPC -DLINK_DMS -DRW_MUL TI_THREAD -DMMII -include /usr/include/features.h -O2 -I. -I/hap/active/include LFLAGS = -L/hap/active/lib -L/hap/active/goahead/lib/LINUX -L/usr/app/ha/lib -lHapComponent -lGoAhead -llog -lcevm -levl -lha -O0 -lplatformServices But stopusage.ru_utime.tv_sec stopusage.ru_utime.tv_usec...all are giving NULL values. I know this is perl group.But Iam giving my last trial , if I get any help.. -reddy. Send free SMS to your Friends on Mobile from your Yahoo! Messenger. Download Now! http://messenger.yahoo.com/download.php
pdf to excel
I have a scanned PDF file and I want to convert its data so I can store it in an xls file. What module(s) do you recommened? I saw File::Extract::PDF ?? __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Capture remsh output
I'm going into a while loop with a list of servers and need to execute a remote command and bring back the output. Doing a qx/remsh server name my script/; doesn't bring back the output. I'm sure this can be done but how? Don Dukelow smime.p7s Description: S/MIME cryptographic signature
Re: Capture remsh output
2006/12/20, Dukelow, Don [EMAIL PROTECTED]: I'm going into a while loop with a list of servers and need to execute a remote command and bring back the output. Doing a qx/remsh server name my script/; doesn't bring back the output. I'm sure this can be done but how? Don Dukelow What about pipe'ing the output of your program to Perl? Check the (untested) code below. code foreach my $host (@hosts) { open my $remsh, remsh $host script | or die $!; my $output; { local $/; $output = $remsh; } print $output; close $remsh or warn $!; } /code You also has the option to use a secure shell instead, and then Net::SSH::Perl[1] comes to rescue you. [1] http://search.cpan.org/~dbrobins/Net-SSH-Perl-1.30/lib/Net/SSH/Perl.pm Hope this helps! -- Igor Sutton Lopes [EMAIL PROTECTED]
Re: Error output from a fork
On Mon, 2006-12-18 at 12:15 -0600, Dukelow, Don wrote: I'm making two executable file that is just one lines of ping commands like. remsh system name ping -I port IP router IP This file could have a couple hundred line it like this. Each of the two files will be put off in different forks at the same time. For trouble shooting purposes I would like to see the out put of the two forked ping files to the screen. The perl line I'm using to execute these files is qx/$OUT_FILE1/; and qx/$OUT_FILE2/;. everything is happened in back ground so I don't see any of the system is alive output. I don't quite understand what you want. From the subject line I read system2 might be what you need, grabs stdout and stderr separately into a variable. From you description you want a two part screen and there is a curses modules that does that for you. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: 'unknown column' error
Huub schreef: DBD::mysql::st execute failed: Unknown column 'Oostvoorne' in 'field list' at /home/Huub/workspace/VulWoningen/VulWoningen.pl line 31. Connection Error: Unknown column 'Oostvoorne' in 'field list' It says 'Unknown column'. That is right: It's no column, it's data to be inserted into the column. When I use the query directly in MySQL, there's no problem. So what is going wrong here? Look into 'prepare'. -- Affijn, Ruud Gewoon is een tijger. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Displaying a user's group memberships
Chad Perrin wrote: On Mon, Dec 18, 2006 at 04:50:57PM -0700, Tom Smith wrote: I need to capture a user's group memberships for further processing in a Perl script. The user's username is passed to the script via the command line and captured with ARGV. From there, I want to determine the group memberships (much like executing `groups` from the command line) and run those through a loop for processing. I seem to be having a problem locating a function that will do this. I've looked at several and tried a couple, but either I'm doing something wrong or I'm using the wrong functions. All of the ones I've tried are part of getgr*. I'm very new to Perl so maybe I'm just looking for the wrong terms or something. I've googled and searched perldoc.perl.org. Can anyone offer any suggestions or point me in the right direction? Thanks, in advance, for your help! A simple solution that comes immediately to mind is to iteratively check for the user's name in lines of the /etc/group file, and grab the first field (before the first colon) of each line that matches. This'll give you a list of groups. There are likely other, more elegant solutions to the problem, but that's the first that springs to mind. It'd require some regex use for matching, and either a regex or split() to separate the first field. It should be extremely simple to write with only basic understanding of the language and very simple understanding of Perl regex syntax, but I'm not providing code so that I don't just do your work for you. Let us know if you have any problems with the concepts. relevant perldocs: perldoc perlre perldoc -f split perldoc perlintro Thank Chad (and John) for your input on this. I thought I'd post the portion of the script that I was trying to work out to see if there's room for improvement. This should work on any *nix system. The format of the command is simple: `test.pl username`, where username is a real username on the system in question. Here's the script: test.pl: #!/usr/bin/env perl use strict; use warnings; # Determine which Linux groups the user belongs to. open(FILE,'/etc/group') or die Can't open /etc/group.; my @memberof; while ($_ = FILE) { if($_ =~ /$ARGV[0]/) { my @groups = split(/:/,$_); push(@memberof,$groups[0]); } } close FILE; print [EMAIL PROTECTED]; So is there a better way to do this, or perhaps a cleaner way? Thanks again for your help! ~ Tom
Re: Displaying a user's group memberships
On Wed, Dec 20, 2006 at 03:14:18PM -0700, Tom Smith wrote: Thank Chad (and John) for your input on this. I thought I'd post the portion of the script that I was trying to work out to see if there's room for improvement. This should work on any *nix system. The format of the command is simple: `test.pl username`, where username is a real username on the system in question. Here's the script: You're welcome. test.pl: #!/usr/bin/env perl use strict; use warnings; # Determine which Linux groups the user belongs to. open(FILE,'/etc/group') or die Can't open /etc/group.; You probably want to use the $! variable to provide more information when your script dies on an error. Thus, the above code might be modified to look like this: open(FILE, '/etc/group') or die Can't open /etc/group: $!; my @memberof; while ($_ = FILE) { if($_ =~ /$ARGV[0]/) { my @groups = split(/:/,$_); push(@memberof,$groups[0]); } } close FILE; print [EMAIL PROTECTED]; So is there a better way to do this, or perhaps a cleaner way? The way you did it seems to work just fine. There are other ways to do it, of course (TIMTOWTDI and all that), but which you choose might depend more on context than one being necessarily better than others. If for some reason a functional approach (no side-effects) is desirable, for instance, you might iterate through the file's contents inside a subroutine, and use perhaps a foreach loop to push() return values into the array when you call the subroutine. Depending on what else your program is going to do, this might yield greater reusability of code, but if that's not a concern for this script it really doesn't matter. For something as quick as looking up a single user's group memberships, resource footprint and processor time aren't really a concern. I guess this is a long-winded way of saying It depends, but what you did looks okay to me. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] It's just incredible that a trillion-synapse computer could actually spend Saturday afternoon watching a football game. - Marvin Minsky -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Displaying a user's group memberships
Tom Smith wrote: Thank Chad (and John) for your input on this. I thought I'd post the portion of the script that I was trying to work out to see if there's room for improvement. This should work on any *nix system. The format of the command is simple: `test.pl username`, where username is a real username on the system in question. Here's the script: test.pl: #!/usr/bin/env perl use strict; use warnings; # Determine which Linux groups the user belongs to. open(FILE,'/etc/group') or die Can't open /etc/group.; my @memberof; while ($_ = FILE) { if($_ =~ /$ARGV[0]/) { Say that you have two users 'ron' and 'ronald'. If $ARGV[0] contains 'ron' then this will get you the group names for *both* 'ron' *and* 'ronald' (and any other group names where the string 'ron' is found.) my @groups = split(/:/,$_); push(@memberof,$groups[0]); } } close FILE; print [EMAIL PROTECTED]; So is there a better way to do this, or perhaps a cleaner way? Since you are only reading from /etc/group you are not picking up the primary group stored in /etc/passwd. John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: beginner on the windows platform
I suggest getting gvim on your PC. gvim can be difficult to learn at first but is definitely needed when needing to replace some snippet of code in multiple locations. While notepad does allow you to do this, you can't enter pattern matching expressions to replace on a command line with notepad. gvim allows you to do this and i have found it to be very convenient. if neither of these float your boat, maybe you could try emacs. On 19/12/06, Larry Johnson [EMAIL PROTECTED] wrote: isaac vanderpuije [EMAIL PROTECTED] wrote: i just installed the activeperl and dont know where to edit my source code (is it notepad? ) and where to run it.Can any one help me because i want to learn it bad. You can use any editor which produces plain text, including notepad. I don't program in a Windows environment, but my copy of ActivePerl has a document which has a section entitled Getting Started. It has a few examples of how to run perl scripts. You may want to look at that. Larry -- Erik
Re: Displaying a user's group memberships
On 12/20/2006 04:14 PM, Tom Smith wrote: [...] So is there a better way to do this, or perhaps a cleaner way? Thanks again for your help! ~ Tom use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=// print @{[ /\((\w+)\)/g ]}\n; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Displaying a user's group memberships
Mumia W. wrote: On 12/20/2006 04:14 PM, Tom Smith wrote: [...] So is there a better way to do this, or perhaps a cleaner way? Thanks again for your help! ~ Tom use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=// print @{[ /\((\w+)\)/g ]}\n; I'm not trying to be argumentative or say that this is wrong... But does anyone else agree with this? If so, why is this way better than the pure Perl way? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Displaying a user's group memberships
Mumia W. wrote: On 12/20/2006 04:14 PM, Tom Smith wrote: [...] So is there a better way to do this, or perhaps a cleaner way? use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=// print @{[ /\((\w+)\)/g ]}\n; print $1 if `groups $ARGV[0] 2/dev/null` =~ /$ARGV[0]\s*:\s*(.+)/; John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response