RE: Perl, MySQl and Airport
When you access MYSql from another machine, you need to set the access privilege for that account. You can search the net on how to do this. ted -Original Message- From: Joseph Alotta [mailto:[EMAIL PROTECTED] Sent: Monday, October 02, 2006 9:46 AM Cc: Mac OS X Perl Subject: Re: Perl, MySQl and Airport On Sep 26, 2006, at 12:23 PM, Sherm Pendley wrote: On Sep 26, 2006, at 12:45 PM, Joseph Alotta wrote: I have a application in Perl that prints reports from a MySQL database. I also have DSL that is accessed via Airport in my house. Recently I bought an iMac for my wife and I want her to help me print reports from this new computer. How do I get her computer to get data from the MySQL database that lives on my computer via Airport? MySQL client libraries use TCP/IP - they neither know nor care about the physical network layer. So you'd do this the same way you'd connect to any other remote server - just supply the host name (or IP address) as part of the dsn. my $dsn = DBI:mysql:database=foo;host=192.168.1.101; my $dbh = DBI-connect($dsn, $user, $password); If that's not working, some things to check: * Are the MySQL client libs and DBD::mysql installed on the client? * Is $user authorized to connect from another host? * Is MySQL itself configured to allow such connections in general? sherm-- Web Hosting by West Virginians, for West Virginians: http://wv-www.net Cocoa programming in Perl: http://camelbones.sourceforge.net Hi everyone, I am getting this error, having tried all the combinations. Is there a control panel somewhere that I need to set permissions? I already tried things in Sharing. Hosea:/Library/MySQL/bin jja$ /Library/MySQL/bin/mysql -u root -D names -h Yeshua.local ERROR 1130: Host '10.0.1.4' is not allowed to connect to this MySQL server Hosea:/Library/MySQL/bin jja$ Joe.
RE: Perl Module Installation
I always use Sudo To do the installation. In your case, I would use sudo perl -MCPAN -e shell' You wouldn't get those warnings if you do this. Ted zeng -Original Message- From: Moisés Chicharro [mailto:[EMAIL PROTECTED] Sent: Thursday, August 24, 2006 9:01 AM To: macosx@perl.org Subject: Re: Perl Module Installation Thanks to everyone for their suggestions. I ran the 'perl -MCPAN -e shell' and it told me to update the module which I did. So I now have v1.7601. However, when trying to run 'install DBI', it piled a whole load of stuff into the terminal window which ended with this below ( the NOT OK bit is worrying me )... --- test.pl done /usr/bin/make test -- OK Running make install Manifying blib/man1/dbiproxy.1 Warning: You do not have permissions to install into /usr/local/man/ man1 at /System/Library/Perl/5.8.6/ExtUtils/Install.pm line 114. mkdir /usr/local/man/man3: Permission denied at /System/Library/Perl/ 5.8.6/ExtUtils/Install.pm line 112 make: *** [pure_site_install] Error 255 /usr/bin/make install -- NOT OK Does that make sense to any of you guys? Thanks again for your help :) On 23 Aug 2006, at 17:45, Daniel T. Staal wrote: On Wed, August 23, 2006 12:27 pm, Moisés Chicharro said: Hi All, Can anyone point me to a decent tutorial for installing perl modules. The one I have downloaded is DBI-1.52.tar.gz I am running OS X 10.4.7 and have never installed a perl module before. I have found various pages on the net but I don't want to mess things up so would like to make sure that the tutorial I am reading has been recommended by some experts! :) I am also assuming that the right directory for my install is System/Library/Perl/5.8.6/ Thankyou in advance, Mo In general the best way to install Perl modules is to use CPAN. Use Terminal and run 'perl -MCPAN -e shell' (or just 'cpan') and answer the questions it asks. If you don't know the answer, use the default. Then, while in the CPAN shell, type 'install DBI'. It will get the latest version, unpack it, test it, and install it for you. You will of course need the devloper tools to do this, in case you haven't installed them already. Daniel T. Staal --- This email copyright the author. Unless otherwise noted, you are expressly allowed to retransmit, quote, or otherwise use the contents for non-commercial purposes. This copyright will expire 5 years after the author's death, or in 30 years, whichever is longer, unless such a period is in excess of local copyright law. ---
Re: Problems installing Net::SSH::Perl'
You just have to install those missing modules one by one. Some are software libraries. You just have to go to get those libs and install them by following the instruction. I have done this before. It took me quite a while to finish it. But it can be done. Since I have done this one year ago, I could not remember the details. But this module has worked on my machine since then. ted On 8/3/06 1:45 PM, Michael Barto [EMAIL PROTECTED] wrote: This modules fails to install from CPAN perl -MCPAN -e 'install Net::SSH::Perl' with error installation in installation of Math::GMP. Hence Net::SSH::Perl module cannot be installed. This problem needs to be corrected. Does anyone know how to get by this problem and how can it be reported to be fixed? This problem is also true for Sun Solaris (which I tried the same thing on). We develop on Mac's
Re: How to get a pid
Hi wren, Thanks. I know better now. I will try to fix the problem within my time limit. Best wishes, Ted zeng On 8/2/06 1:18 AM, wren ng thornton [EMAIL PROTECTED] wrote: --- quoth Ted Zeng [EMAIL PROTECTED]: Originally, my perl script launches Eggplant as a child process (use ``, not an independent process.) Actually ``, aka qx(), does spawn an independant process. Try running: perl -e'`sleep 6000`;' and then doing a `ps` to see. But the semantics of qx() mean that the forking, execing, and capturing of output are hidden from the programmer. Same goes for using system(). Because of the semantics of qx() and system(), there's no way to capture the pid of the spawned process-- that's all handled behind the scenes. If you don't trust the children to return properly, then you need to use fork() and exec() explicitly with something like the following: #!/usr/bin/env perl print $$: noone in here but us chickens\n; $pid = fork(); print $$: I got $pid\n; if ($pid == 0) { print $$: child is execing\n; exec 'sleep', 10; } else { print $$: parent is waiting\n; sleep 5; print $$: kids these days! (killing $pid)\n; kill 9, $pid; } __END__ You can watch this in another shell with a ps. You can also use elements of %SIG for the first argument to kill() but `sleep` so happens to ignore everything. Do note that the interleaving of the process scheduling after calling fork() is unpredictable, even if it appears reliable over a few runs. Even the order in which processes return from a call to fork() is unpredictable. Unfortunately with this approach, capturing the output of the child is harder. And of course you'll want to verify that the child is running too long before killing it in your version. Live well, ~wren __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
How a file gets copied remotely
Hi, I have one more question. My perl script on one Mac in my office by ssh connects to another Mac (let me name it M2) in a very far away place, With the network speed is only about 20k/s or even slower. Then, the perl script mounts another Mac(M3) to that Mac (M2). M2 and M3 are local to each other, that means the network speed between them is very fast. Then, the perl script copies some files from M2 to M3 through commands(cp) on the ssh shell. Lets say, it is 'cp /Volumes/M2/archive.txt /Volumes/M3/archive.txt '. My question is : does the file data goes through the network between M2 and my perl script's machine here? Or they just go through their (M2,M3) local network? I could test the timing myself, but I still won't understand how it work behind. Ted Zeng
Re: How to get a pid
Thanks. This is a pretty good lecture on OS's process. You are right. The problem is the Grandchild could not be trusted. And the child is stuck with the grandchild due to the way it launches The grandchild. But since the parent knows child's pid, it could use this information To find out the grandchild's pid (as Packy proposed). I think that solves The problem pretty well. Ted Zeng Adobe Systems Inc. On 7/31/06 6:06 PM, wren ng thornton [EMAIL PROTECTED] wrote: --- quoth Packy Anderson: --- quoth Ted Zeng: I don't know how the OS generate the pid for a process. That is why I don't feel comfortable with what I did. The way I understand it, the OS assigns the next highest available pid when creating a process. It' s never specifically documented because it's one of those implementation dependent things, but canonically speaking it's the next available pid which is either a first fit or next fit depending on which is easier to implement. Due to the nature of the lifecycles of processes this generally means that in practice child=ppid+1 but in actuality there is no guarantee that the two pids are related to one another. This general observation can be undone by wrapping of pids past the max pid, by some other process jumping in to spawn a child before your process' request is fulfilled, by other processes dying off and revealing a better next available pid, etc etc. Whenever a process makes a syscall to fork() an exact copy of the current process is made (including all open files and some other complexities), with the only difference being the pid. The other difference is that once the call to fork() returns the parent will receive the child's pid as a return value and the child will receive 0 (an invalid pid). If for for some reason the fork fails (e.g. no available pids), then the parent process will receive -1 (also an invalid pid). Generally it's up to the parent to keep track of their children and there's not much recourse to recovering them if you loose them. However the OS does keep track of such things (to deal with auto-reaping zombies and the like) and so there're often ways to recover that info. E.g. in C the waitpid() function has an option to wait for any child to die; I don't know of a Perl implementation if this call, but I wouldn't be surprised if it's out there, and if it isn't anyone with a bit of XS knowledge should be able to bang one out quickly. There may be other ways depending on the specific OS. I've only loosely been following this thread, but it sounds like the problem isn't the parent (the Perl script) keeping track of it's children, but rather keeping track of grandchildren. Since POSIX makes no province for keeping track of grandchildren, it's really something the child should keep track of and then report to the parent. That is, every process should clean up after themselves and so every parent can consider their child to be one process ignoring any other processes they may spin off. Of course it sounds like the child is an unknown (and not particularly trusted). Is there not any way for the Perl script to call the necessary grandchildren directly? Live well, ~wren __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Re: How to get a pid
I don't know how the OS generate the pid for a process. That is why I don't feel comfortable with what I did. I am not sure if there is a race situation here. Ted zeng On 7/28/06 4:21 PM, Joel Rees [EMAIL PROTECTED] wrote: On 2006/07/29, at 4:12, Ted Zeng wrote: ... I have used pid+1 for quite a few days now and it seems to work without any problem. But I still feel it is not the right thing to do. Have you ever heard of race?
RE: How to get a pid
It would have been helpful to see the contents of execEggplant. Is it really using exec? If so, the child's pid should be the same as the thing that exec'd it. Sorry. I should be more clear. My code uses ` ` (backward qoute?), which is the same as system(), I think. So it is not exec(), open(). execEggplant is a command that executes eggplant with a Eggplant script path as parameter. I also pipe the error to output. $execEggplant = runscript an_eggplant_script_path 2$1 ## just from my memory. I don't have the script on hand right now. The reason I doesn't use exec is because I want to catch the output from Eggplant (it write its log to err). If I use exec(), then I wouldn't be able to see the output from that process. I have no experience with open() and took a look at it, and it doesn't seem to work for my case. I have used pid+1 for quite a few days now and it seems to work without any problem. But I still feel it is not the right thing to do. ted If you use open(), the return value of open will be the pid of the pipe opened. If you use system(), you may be out of luck; I don't know. ...or is it the case that execEggplant exec's some script which then, itself runs Eggplant? In that case, you will have to roll your own IPC. -- rjbs
How to get a pid
Hi, I have the following problem. I run a perl script that set up an environment, then Run a tool and wait for its return. But the tool hangs from time to time. I have to kill it when it hangs. To do this, I use Fork. I fork a child process that will run the tool. In the parent process, I get the child process's pid and if it runs longer than a set time limit, the parent will kill the child. But I found out that while the child dies, it still hangs around with the tool. (it has (perl) when I do 'ps -xc' ). If I kill the tool process, then thing is ok. I could not figure out how to get the tool process's id. But by observing, I notice that its pid is 'always' equals to child process's pid+1. So, I let the parent process kills 'child pid+1. It seems to work so far. I have to admit I don't feel comfortable with doing this, though it works so far. Any suggestion on how I could figure out the tool's pid? Regards, Ted Zeng Adobe Systems Inc. Here is the part of the script that does fork: if(!defined( $kidpid = fork() )){ die Canot fork: $!; }elsif ($kidpid == 0) { ## Execute the Eggplant Scripts. execEggplant(); } else { my $count=0; my $tConstant = 120; ## 20 min. do { sleep 10; $count ++; $kid = waitpid(-1, WNOHANG); } until ($kid 0 or $count $tConstant); if($count $tConstant ){ { $kidpid = $kidpid + 1; ## get the Eggplant PID ## The child process is still running. Log and kill it. my $ret = `kill $kidpid`; LogBoth(...20 min. passed... We terminate the Eggplant process: $ret); exit(0); ## no need to archive now. The child process should do the archive } ## } }
How to solve module conflict?
Hi, I have been using Time::localtime Call. Now I want to use POSIX module. But There is also a Lcoaltime Call in this module. What can I do to still use Time::localtime And also the POSIX module? Ted zeng Adobe Systems
Re: How to solve module conflict?
Thanks. It works. Ted zeng
Re: How to find out if an application is running
I like these solution. Thanks. ted On 10/13/05 10:59 PM, Peter N Lewis [EMAIL PROTECTED] wrote: At 20:02 -0700 13/10/05, Ted Zeng wrote: Here is the fun part: I made a killapp.pl script and Call it to kill Bridge with `killapp.pl Bridge ` And it kills itself. As it turned out, the script finds itself from the list because the Command line includes Bridge(or Adobe Illustrator for Illustrator). The standard trick for this, if the search is a regular expression, is to surround one of the letters with [], ie: killapp.pl '[B]ridge' It works. But somebody probably laughs at it. It's hardly the first time, indeed the general find this application of ps auxw | grep inevitably finds the search command unless you use a trick like the above, or: ps auxw | grep | grep -v grep Enjoy, Peter.
Re: How to find out if an application is running
As it turns out, only Sherm's version works For all the situations. Here is what I did: I clicked the menu File:New and Illustrator presents An New document dialog. Now, I go to execute the commands to kill it. The AppleScript version could not kill it. kill does kill it.(Sherm's code) Killall doesn't seem to do anything even in the normal sitution (I use Adobe Illustrator instead of Illustrator, otherwise it will complaint there is no matching process) I haven't tried Chris's version yet. Ted zeng On 10/13/05 7:55 AM, Dominic Dunlop [EMAIL PROTECTED] wrote: On 20051013, at 12:40, David Cantrell wrote: On Thu, Oct 13, 2005 at 08:51:22AM +0200, Dominic Dunlop wrote: A late arrival which hasn't been mentioned so far: $ killall -0 Illustrator 2/dev/null echo Illustrator is running killall is a Really Bad Idea. While it does indeed do what you intend on OS X, on other commercial Unices like Solaris it really does kill all. That is, it sends your chosen signal to all processes. Not good. So don't get in to the habit of using it. Aw, cut me some slack. This was specifically a Mac OS X query (Illustrator not being available on Solaris); the Solaris command only does its dangerous stuff for root (according to the man page -- I don't have access to a Sun box); and Sun puts it in a place that shouldn't be on a normal user's PATH. Plus killall, BSD-style, is a neat command. Works on Linux too. But anyway. Here's Yet Another Way To Do It: #!/usr/bin/perl -wl use Proc::ProcessTable; my $t = new Proc::ProcessTable; for (@{$t-table}) { if ($_-cmndline =~ m%/Mail.app/%) { # *** Your app name here *** print $_-pid; last; } } Proc::ProcessTable is available from CPAN, and builds and runs without problem on Mac OS X. It also works in a lot of other environments (including Windows) (and Solaris). Sadly, this approach no good for use from an optionally installed package, as you can't rely on the module being present. (Unless you were to include it as part of the bundle and tell perl how to find it, which would probably be more trouble than it's worth.)
Re: How to find out if an application is running
You are right. After I got the info. On how to detect the process, I added the codes to kill them. Then I thought they all work. Didn't think what I had asked. Here is the fun part: I made a killapp.pl script and Call it to kill Bridge with `killapp.pl Bridge ` And it kills itself. As it turned out, the script finds itself from the list because the Command line includes Bridge(or Adobe Illustrator for Illustrator). Now, I put the app. Name in two part, `killapp.pl Brid ge` And merge them in the killapp.pl script. It works. But somebody probably laughs at it. Ted zeng On 10/13/05 4:05 PM, Jeff Lowrey [EMAIL PROTECTED] wrote: At 01:36 PM 10/13/2005, Ted Zeng wrote: As it turns out, only Sherm's version works For all the situations. Actually, merely for the situation that you didn't tell us you were aiming for. You asked How to find out if an application is running. You didn't ask How do I find out a PID so I can kill a process. -jeff
How to find out if an application is running
Hi, I would like to find out if an application like Illustrator is running On OS X or not from a perl script. How can I do it? ps doesn't list the processes like Illustrator. Ted Zeng Adobe Systems
Re: question on Perl's ssh
Thanks. I will look into this. ted On Jun 24, 2005, at 1:48 PM, Adam Wells wrote: On Jun 24, 2005, at 1:10 PM, Ted Zeng wrote: SSH has been a big headache to me. I wish OS X just has telnet. It is good enough for my purpose. I wish SSH has an option that says turn it into rlogin or telnet. Mac OS X does have a telnet daemon -- but it's disabled by default. On Tiger, you can issue this command as root to start it up: # launchctl load -w /System/Library/LaunchDaemons/telnet.plist adam
Re: question on Perl's ssh
On Jun 24, 2005, at 7:16 PM, Joel Rees wrote: [...] This doesn't really make sense. Are you sure that you didn't connect by hand in pather once, and answer the query about whether you would accept the certificate or not? Once the certificate was accepted, perl in Panther might have been accessing the user's .ssh? I reboot the machines and map the disk image to the drive every time. In Panther, the disk image doesn't have .ssh. Hmm. So maybe the ssh libraries on Panther and Tiger default to different behavior when the user's settings are missing? It seems they are. It seems to behave differently when interacting with Net::SSH::Perl. I do set up an account and password in the disk image. I use password authorization to access Panther. Meaning, the script takes the password (passphrase?) query and answers it? Yes. But I could not do the same with Tiger. The perl script always ask me to type in password by hand. Is it possibly sending the query on STDERR instead of STDOUT? I think perl would allow you to redirect STDERR, if that's the case. I don't know. Because it is done by the Net::SSH:Perl module. But my goal is automation. To avoid this, I have to put a public key to the target machine and use identity key authorization to access it. Yeah, keys certificates can be a pain to deal with in their current form. Would a self-certificate help? Openssl can do self-certificates as well as keys. (Maybe you've already tried that?) No, I don't. Thanks for this info. I will try to look it up. [...] Eventually, this kind of thing will get straightened out a bit. But we who write programs still need to be aware of when we need to identify and when we need to encrypt and when we can just spit data. (If we don't, who will?) The problem is I know I just need to spit data, but I couldn't. Well, you are the best person to know whether the project wil live long enough to escape its cage, etc. I'd suggest compiling and installing rsh or some such, but I really shouldn't. I think installing keys for ssh will work out simpler in the end. Thanks. I think so too. ted zeng -- Joel Rees If Microsoft is effectively taxing the internet, should we call it a sin tax?
question on Perl's ssh
Hi, Why the system behaves differently when I ssh to a machine from Terminal than when I ssh to the same machine by Perl's SSH module? Here is the problem: I added a tool to /usr/local/bin. I updated the profile file. Now if I ssh to the machine, I could use which tool to find it. But when I try to do the same in Perl, the reply is no tool in /usr/bin /bin /usr/sbin /sbin ted zeng Adobe Systems
Re: question on Perl's ssh
Thanks. You make it very clear. I have assumed they should be the same. I took a look at Net::SSH and it seems it is not what I want. It is much easier to install Net::SSH though. SSH has been a big headache to me. I wish OS X just has telnet. It is good enough for my purpose. I wish SSH has an option that says turn it into rlogin or telnet. ted On Jun 24, 2005, at 11:50 AM, Wiggins d'Anconia wrote: Ted Zeng wrote: Hi, Why the system behaves differently when I ssh to a machine from Terminal than when I ssh to the same machine by Perl's SSH module? Here is the problem: I added a tool to /usr/local/bin. I updated the profile file. Now if I ssh to the machine, I could use which tool to find it. But when I try to do the same in Perl, the reply is no tool in /usr/bin /bin /usr/sbin /sbin ted zeng Adobe Systems The difficult part is that the answer is really just because :-). When you use the 'ssh' from the terminal you are using the local ssh client. That client establishes a connection to a remote ssh server and tells that server that it wants to run a command, that command is to init a shell and then interact. So when you send your 'which' command you are interacting with the remote shell over the ssh tunnel. But when you use Net::SSH::Perl (which I am assuming is the module you are using) you are establishing a connection to a remote SSH session, but the command(s) you send are being exec'd directly (presumably by /bin/sh) which may or may not have loaded the same environment as the normal user shell (for instance, skipping any .bashrc/.bash_profile, etc.). I believe (though haven't tested) that the same would occur if you provided a command to the local ssh client instead of requesting an interactive shell. Net::SSH provides a wrapper around the local 'ssh' command but I have not used it. I tested it once quite a while ago and preferred Net::SSH::Perl *for my purposes*. HTH, http://danconia.org
Re: question on Perl's ssh
Chris, I know how to circumvent this. But I would like to know why they behave differently. I have assumed they should be the same. Thanks, ted zeng On Jun 24, 2005, at 11:41 AM, Chris Devers wrote: On Fri, 24 Jun 2005, Ted Zeng wrote: Why the system behaves differently when I ssh to a machine from Terminal than when I ssh to the same machine by Perl's SSH module? It sounds like the script is getting the default system $PATH variable, while the shell is getting the $PATH defined in your login scripts. Specifying the full path to the tool you want may circumvent this. Alternatively, your script can declare what $PATH to use, but without seeing the code, I'm not sure how best to do this. In any case though, if it's an option for you, using a full path would be easier than setting it manually. -- Chris Devers
Re: question on Perl's ssh
On Jun 24, 2005, at 5:47 PM, Joel Rees wrote: On 2005.6.25, at 08:35 AM, Ted Zeng wrote: My problem is it provides much more than I need. Are your sure? Of cause I am sure. I just need to log in to another Mac to execute commands there. I don't care securities, or anything. rlogin is good enough for me. Well, there is a company taking contracts from the credit card companies that just needed some real world data to test something with and wasn't going to have that data where it could be accessed improperly. And how many hundreds of thousands of credit card numbers worldwide have been stolen? I know that. I know ssh is very useful in many cases. But I don't need it. The network is internal. And there is nothing in the machines that are worth protecting. In fact, I use telnet on PCs to deal with the same problem. I have a solution that try to protect some credit card data from stolen to solve my problem that has nothing to protect. I don't want to copy a public key over to that machine ( I don't have to in Panther. But have to in Tiger) This doesn't really make sense. Are you sure that you didn't connect by hand in pather once, and answer the query about whether you would accept the certificate or not? Once the certificate was accepted, perl in Panther might have been accessing the user's .ssh? I reboot the machines and map the disk image to the drive every time. In Panther, the disk image doesn't have .ssh. I do set up an account and password in the disk image. I use password authorization to access Panther. But I could not do the same with Tiger. The perl script always ask me to type in password by hand. But my goal is automation. To avoid this, I have to put a public key to the target machine and use identity key authorization to access it. I keep thinking there should be an option that would solve my problem. I have compared sshd_config files from Tiger and Panther today and just could not see how. Are there any environment files that didn't get transferred or rebuilt, or, if you just upgraded, were there some settings files that got erased? I have looked at the sshd_config files. It seems to me that is the only possible difference in settings. before I could talk to that machine. This is a nightmare to me. Eventually, this kind of thing will get straightened out a bit. But we who write programs still need to be aware of when we need to identify and when we need to encrypt and when we can just spit data. (If we don't, who will?) The problem is I know I just need to spit data, but I couldn't. ted zeng
Re: question on Net::SSH::Perl
Thanks. I found out the machines I have the problem with have OS X 10.4.1 installed. 10.3.8 doesn't have the problem. I generated a public key and copied it to a target machine. Then it is ok. Not a good solution to me. But I can deal with it. I have looked at ssh_config and sshd_config and still could not figure out why these two OS behave differently. SSH has been a big pain. I wish it has a switch that would turn it into telnet. I don't care about security in our situation. ted On Jun 2, 2005, at 4:42 PM, Sherm Pendley wrote: On Jun 2, 2005, at 2:20 PM, Ted Zeng wrote: Anyone has seen this problem before? I searched the net and found a couple of people had this problem. But there were no answers to their questions. Here is the script that I used: $user='name'; $pass = 'password'; $host = '111.22.33.444'; $params{debug} = 1; $params{interactive} = 0; my $ssh = Net::SSH::Perl-new($host,%params,options =[BatchMode yes]); Googling for 'No compat match:' turned up some likely-looking candidates, including this one: http://forums.devshed.com/t191670/s.html Based on that page, you might try using the 'protocol' option for force Net::SSH::Perl to try an SSH2 connection first: $params{protocol} = '2,1'; sherm-- Cocoa programming in Perl: http://camelbones.sourceforge.net Hire me! My resume: http://www.dot-app.org
question on Net::SSH::Perl
Hi, I use Net::SSH::Perl to connect to a few Macs from a Mac. To 2 of them, it works fine. But for others, the shell would have password prompt and I have to type the password at the shell to make the script goes through. I have tried to turn off any options that would ask for authentication. Even set the interactive option to 0 (The default is already false.) But the problem doesn't go away. I turn the debug on and the log is in the end of this message. For the two Macs that works, it has No challenge presented. Trying password authentication. at the end instead of the password prompt. Anyone has seen this problem before? I searched the net and found a couple of people had this problem. But there were no answers to their questions. Here is the script that I used: $user='name'; $pass = 'password'; $host = '111.22.33.444'; $params{debug} = 1; $params{interactive} = 0; my $ssh = Net::SSH::Perl-new($host,%params,options =[BatchMode yes]); $ssh-login($user, $pass); ($stdout, $stderr, $exit) = $ssh-cmd(ls); ted zeng Adobe Systems ==The debug log Reading configuration data /Users/z/.ssh/config Reading configuration data /etc/ssh_config Connecting to ip, port 22. Remote protocol version 1.99, remote software version OpenSSH_3.8.1p1 Net::SSH::Perl Version 1.27, protocol version 1.5. No compat match: OpenSSH_3.8.1p1. Connection established. Waiting for server public key. Received server public key (768 bits) and host key (1024 bits). Host 'ip' is known and matches the host key. Encryption type: DES3 Sent encrypted session key. Received encryption confirmation. RSA authentication failed: Can't load public key. Doing challenge response authentication. Password: No challenge presented. Trying password authentication.
RE: Mac::Glue script
Someone might have a better solution. What I did was go to each downloaded module folders and Do sudo make install and it will install. I have another Mac which doesn't have this problem at all. It sounds like a permission problem. Ted zeng Adobe system. Writing Makefile for Mac::AppleEvents Writing Makefile for Mac::Components Writing Makefile for Mac::Files Writing Makefile for Mac::Gestalt Writing Makefile for Mac::InternetConfig Writing Makefile for MacPerl Writing Makefile for Mac::Memory Writing Makefile for Mac::MoreFiles Writing Makefile for Mac::Notification Writing Makefile for Mac::OSA Writing Makefile for Mac::Processes Writing Makefile for Mac::Resources Writing Makefile for Mac::Sound Writing Makefile for Mac::Speech Writing Makefile for Mac::Types Writing Makefile for Mac::Carbon -- NOT OK
Re: SSH for Perl
Sherm, Thanks. It is Net::SSH::Perl module. When I saw the example in this module, I jumped into air. It is so simple and exactly what I need. But the install process is long. I had to install many many modules, and some libraries I think. CPAN seems to stop working last night and this morning. I had to download each module and install them. It took me a few hours to do it. When it is done, it works great. Though it still has this error message: Argument ssh-rsa isn't numeric in numeric eq (==) at /Library/Perl/5.8.1/Net/SSH/Perl/Key/RSA1.pm line 94, FH line 2. As long as it works, I won't pay attention to it, not yet. ted On Mar 28, 2005, at 7:36 PM, Sherm Pendley wrote: On Mar 28, 2005, at 10:29 PM, Ted Zeng wrote: I am trying to user perl connect to another Mac through ssh and execute a few perl scripts. Have a look at Net::SSH on CPAN. It installed without complaint on my Panther system, although I haven't used it beyond that. sherm-- Cocoa programming in Perl: http://camelbones.sourceforge.net Hire me! My resume: http://www.dot-app.org
SSH for Perl
Hi, I am trying to user perl connect to another Mac through ssh and execute a few perl scripts. But I could not figure out how to do this. I thought it would be simple. I used telnet module to connect to a Widnows PC before. Ted Zeng Adobe Systems Inc.
Re: problem with installing DBD::mysql
On Mar 16, 2005, at 12:55 AM, Mark Wheeler wrote: So I guess my question, after following this, is to NOT follow the directions in the link I posted, but simply make the change in the .conf first, then download the source from CPAN, then install it. Is that the correct order of things? I'm pretty much ready to do this, as I have MySQL installed and working (with PHP). I just need to get the Perl access side of things going. Thanks, Mark No. After you fixed the Config.pm file, you should read that web page you posted. There are a few steps there you should follow. Then you should be ok. ted
problem with installing DBD::mysql
Hi, I tried to install DBD::mysql after I installed DBI. I run sudo perl -MCPAN -e install DBD::mysql It got the source , but always failed like any other perl module. I cd to the source directory and do sudo make and got the following error: LD_RUN_PATH=/Library/MySQL/lib/mysql:/usr/lib /usr/bin/perl myld MACOSX_DEPLOYMENT_TARGET=10.3 cc -bundle -undefined dynamic_lookup -L/usr/local/lib dbdimp.o mysql.o -o blib/arch/auto/DBD/mysql/mysql.bundle -L/Library/MySQL/lib/mysql -lmysqlclient -lz -lm -L/usr/lib -lssl -lcrypto make: *** [blib/arch/auto/DBD/mysql/mysql.bundle] Error 255 Anybody has the same problem? ted zeng
Re: problem with installing DBD::mysql
Thanks all. I followed both advices, and still got the following error: t/mysqlFAILED tests 46-48 Failed 3/68 tests, 95.59% okay t/mysql2...ok Failed Test Stat Wstat Total Fail Failed List of Failed --- t/mysql.t 683 4.41% 46-48 1 test skipped. Failed 1/18 test scripts, 94.44% okay. 3/767 subtests failed, 99.61% okay. make: *** [test_dynamic] Error 2 It looks mainly ok. Thanks a million. I spent quite a bit time search in apple.com and google and came up nothing. The Config.pm is almost 1.5 year old. ted On Mar 15, 2005, at 5:15 PM, Chris Devers wrote: On Tue, 15 Mar 2005, Mark Wheeler wrote: I don't know if this will help, but here is a link that I found to a problem with installing DBD::mysql on Panther. Let me know if it works/is helpful, as I need to install it, too. I did the research for installing it (that's how I found the link) but haven't got around to it yet. Here's the link: http://www.truerwords.net/articles/osx/install_dbd_mysql.html Let me know if this is the fix. No. No. No. It's close, but it's not the right fix. But that page actually *links* to the right fix! As Edward Moy (of Apple) wrote, you have to do the following: We recently discovered the DBD::mysql problem as well. The patch is to edit /System/Library/Perl/5.8.1/darwin-thread-multi-2level/Config.pm, replacing: ld='MACOSX_DEPLOYMENT_TARGET=10.3 cc' with ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc' Do that, and DBD::Mysql (and anything else that trips over this bug) will work just fine. -- Chris Devers
Re: problem with installing DBD::mysql
I have given root user and its password for testing. So I assume this is not the cause for the problem. ted On Mar 15, 2005, at 7:39 PM, Sherm Pendley wrote: On Mar 15, 2005, at 8:46 PM, Ted Zeng wrote: I followed both advices, and still got the following error: t/mysqlFAILED tests 46-48 Failed 3/68 tests, 95.59% okay Sigh. This comes up about every three months or so. I guess no one reads the archives. :-( The answer, as always, is to read the instructions that come with the module. The self-tests need to know what database to use for testing purposes, and what username/password to use when connecting to it. The instructions that come with the module detail how to configure it properly to give it that information. sherm-- Cocoa programming in Perl: http://camelbones.sourceforge.net Hire me! My resume: http://www.dot-app.org
Re: problem with installing DBD::mysql
It used to say that it take 3 months if any code is touched in the OS for testing. But no, their internal build system's problem never override anything in OS releases, at least not before Steve Jobs came back. It is true that there is lots of consideration whether changes should be made. But Apple at least should put a note on their web site stating the problem. That would save people lots of trouble. I did search their web site and found nothing. ted On Mar 15, 2005, at 7:46 PM, Sherm Pendley wrote: On Mar 15, 2005, at 10:01 PM, Chris Devers wrote: Apparently, for whatever reason, it was never considered necessary to patch it in a following OS upgrade, or even in the XCode update that came out a few months ago. I don't know why, but there it is. Can you imagine the QA nightmare that would be? A change in Perl - even a small change - would mean that everything Perl touches would have to be re-tested and passed by QA. I'm told that Apple uses Perl in their internal build system - so that essentially would mean *everything*, full stop. They'd be fools to go to that sort of effort for anything less than a major OS revision. sherm-- Cocoa programming in Perl: http://camelbones.sourceforge.net Hire me! My resume: http://www.dot-app.org
Install module problem with CPAN
Hi, I tried to install a module with CPAN. I use the command perl -MCPAN -e 'install Mail::Sender' But I got the error: Writing Makefile for Mail::Sender -- NOT OK But when I cd to the folder and do make install And the module was isntalled. I don't know why I had the failure. When I tried to install Bundles::LWP, the same problem exists and I would like to find out what is wrong, because it is hard to go to each module and do a make install for each one. The bottom is the log from the Mail:Sender install. ted zeng Adobe Systems == Running install for module Mail::Sender Running make for J/JE/JENDA/Mail-Sender-0.8.10.tar.gz LWP not available Fetching with Net::FTP: ftp://ftp.perl.org/pub/CPAN/authors/id/J/JE/JENDA/Mail-Sender -0.8.10.tar.gz CPAN: Digest::MD5 loaded ok LWP not available Fetching with Net::FTP: ftp://ftp.perl.org/pub/CPAN/authors/id/J/JE/JENDA/CHECKSUMS Checksum for /Users/zeng/.cpan/sources/authors/id/J/JE/JENDA/Mail-Sender -0.8.10.tar.gz ok Scanning cache /Users/zeng/.cpan/build for sizes Mail-Sender-0.8.10/ Mail-Sender-0.8.10/Changes Mail-Sender-0.8.10/Config.PL Mail-Sender-0.8.10/Makefile.PL Mail-Sender-0.8.10/MANIFEST Mail-Sender-0.8.10/README Mail-Sender-0.8.10/Sender/ Mail-Sender-0.8.10/Sender/CType/ Mail-Sender-0.8.10/Sender/CType/Ext.pm Mail-Sender-0.8.10/Sender/CType/Win32.pm Mail-Sender-0.8.10/Sender.pm Mail-Sender-0.8.10/test.pl CPAN.pm: Going to build J/JE/JENDA/Mail-Sender-0.8.10.tar.gz Checking if your kit is complete... Looks good Writing Makefile for Mail::Sender -- NOT OK Running make test Can't test without successful make Running make install make had returned bad status, install seems impossible
Re: sendmail question
Thanks for all the replies. It looks like I should go with a Perl module. I installed Mail:Sender and it works fine now. I tried a few Mail modules a few years back on Windows and Mail:Sender is the one that I found easy to use and the attachment works. ted
Re: Install module problem with CPAN
I did. Sorry to forget to copy that. That is why it puzzled me. When I cd to the folder and did make install I don't need to use sudo and it worked. ted On Mar 9, 2005, at 1:32 PM, Sherm Pendley wrote: On Mar 9, 2005, at 3:29 PM, Ted Zeng wrote: I tried to install a module with CPAN. I use the command perl -MCPAN -e 'install Mail::Sender' Looks like you forgot to 'sudo': sudo perl -MCPAN -e 'install Mail::Sender' sherm-- Cocoa programming in Perl: http://camelbones.sourceforge.net Hire me! My resume: http://www.dot-app.org
Re: First CGI Setup
I thought by default OS X has the cgi setup automatically. I didn't have to do anything, just turned on the web server. And put the perl script in the CGI-EXECUTABLES folder and it works. ted On Mar 9, 2005, at 2:03 PM, Mike Lesser wrote: Hi all. I'm busy setting up to run (okay, play with) CGIs. So for, not so great. According to the Apache error logs, I'm connecting okay, but something seems to be off.i've been reading up on the config issues, and I've worked thru some of them, but frankly I'm out of my element, and concerned about munging up httpd.conf so badly I'll be sent away. The script.. #!/usr/bin/perl -w print Content-type: text/html\n\n; print h2Hello, World!/h2\n; ...shows up in safari with the script text, but with Hello World in the header font style! !/usr/bin/perl -w print Content-type: text/html\n\n; print Hello, World! \n; These are (AFAIK) the relevant httpd parts. Note that I was following a tutorial on the O'reilly site, and one here http://www.cgi101.com/learn/connect/mac.html and made the most progress with using my own home directory (as opposed to /Lib/./CGI-Exe). (I'm not sure what makes the most sense, just for at-home development. I'd imagine the more real-world setup is better) Directory /Users/mike/Sites AllowOverride FileInfo AuthConfig Limit Options MultiViews Indexes SymLinksIfOwnerMatch Includes ExecCGI DirectoryIndex index.html index.cgi Limit GET POST OPTIONS PROPFIND Order allow,deny Allow from all /Limit LimitExcept GET POST OPTIONS PROPFIND Order deny,allow Deny from all /LimitExcept /Directory and... # To use CGI scripts: # #AddHandler cgi-script .cgi # # To use server-parsed HTML files # #AddType text/html .shtml #AddHandler server-parsed .html The log says this (which to my eyes looks better than what I've seen before [Wed Mar 9 16:51:37 2005] [notice] Apache/1.3.33 (Darwin) PHP/4.3.2 configured -- resuming normal operations [Wed Mar 9 16:51:37 2005] [notice] Accept mutex: flock (Default: flock) Yikes! This is long! Mike
What Perl editor do you recommend?
Hi, Thanks for the help here. I am almost finishing my first tool on OS X. I am using TextEdit as the editor. I sometime use Pico, but I am still not comfortable with Unix editor. I know there must be some good editors for Perl. Do you have any recommendation? ted zeng Adobe Systems
RE: could not build a module
Joel, Thanks. I did find it and install Xcode. I managed to install module RTF::Text::Converter. But it doesn't work on Eggplant's script files. I even Opened the script file in Windows XP's Word and then Saved it. It still hangs. ( I used the example script Tests.pl that comes with the module.) Anyone has a good suggestion on a good RTF to Text converter That works well on Mac? Ted -Original Message- From: Joel Rees [mailto:[EMAIL PROTECTED] Sent: Saturday, February 26, 2005 2:41 AM To: macosx@perl.org Subject: Re: could not build a module I will install the Xcode and see how it goes. You know where to find it?
Re: could not build a module
I need to do batch processing. In fact, I need to grap the text content of each file and process it using Perl. I just did a search and found the link http://daringfireball.net/2003/04/rtf_to_plain_text_translator which tells me to use inside the FileMerge folder convertRichTextToAscii to do the conversion. It works. I will need to hook it up with perl to do my job. ted n Feb 26, 2005, at 6:23 PM, Sherm Pendley wrote: On Feb 26, 2005, at 8:40 PM, Ted Zeng wrote: Anyone has a good suggestion on a good RTF to Text converter That works well on Mac? Have you tried TextEdit? It comes with the OS, so it doesn't cost anything to give it a shot. Or, were you looking for a batch processing thing, to convert a bunch of files? sherm--
RE: could not build a module
Thanks. I will install the Xcode and see how it goes. ted -Original Message- From: Sherm Pendley [mailto:[EMAIL PROTECTED] Sent: Thursday, February 24, 2005 11:51 AM To: Ted Zeng Cc: macosx@perl.org Subject: Re: could not build a module On Feb 24, 2005, at 2:46 PM, Ted Zeng wrote: Error: Unable to locate installed Perl libraries or Perl source code. Install Xcode. sherm-- Cocoa programming in Perl: http://camelbones.sourceforge.net Hire me! My resume: http://www.dot-app.org
could not build a module
Hi, I am new to perl on Max OS X.I used to use perl on Windows. I just got a new Dual G5 last week. I just tried to install the RTF::TEXT::Converter module using the following command: perl -MCPAN -e 'install RTF::TEXT::Converter' I got the following error, the file perl.h is not there. The only file in the directory is libperl.dylib. What can I do? I don't want to do please build and install your perl from a fresh perl distribution. if possible. ted zeng == error message CPAN.pm: Going to build P/PV/PVERD/RTF-Parser-1.07.tar.gz Error: Unable to locate installed Perl libraries or Perl source code. It is recommended that you install perl in a standard location before building extensions. Some precompiled versions of perl do not contain these header files, so you cannot build extensions. In such a case, please build and install your perl from a fresh perl distribution. It usually solves this kind of problem. (You get this message, because MakeMaker could not find /System/Library/Perl/5.8.1/darwin-thread-multi-2level/CORE/perl.h) Running make test Make had some problems, maybe interrupted? Won't test Running make install Make had some problems, maybe interrupted? Won't install