Re: Leopard, Apache and CGI Uploads
On Thu, Apr 24, 2008 at 4:59 PM, [EMAIL PROTECTED] wrote: I have a Perl file upload script I'd been using for years under Apache 1 in Tiger. I haven't modified it in ages. No mod_perl, just CGI.pm and the default Perl installation. It's always worked fine for files of any size (some as many as a gigabyte and taking more than an hour to upload), but since upgrading to Leopard, with its Apache2 nonsense, the script fails on large files -- anything over a megabyte -- with this being output to the browser: CGI.pm: Server closed socket during multipart read (client aborted?).. This is the only error message logged, too. I've tested this with multiple clients on different operating systems and it's the same every time, unless the file's smaller than 1MB, in which case the script executes as it should. I added a debugging line to the upload hook that runs when I first create my CGI query object, and it reports the bytes increasing up to a point, after which it keeps logging these messages but the number of bytes stays static. It's never the exact same number but the files always seem to fail above 1 megabyte, with about 1.4 being the upper limit I've seen so far. Any ideas? Thanks What makes you think that this is a Perl issue? CGI.pm reported that the client closed the connection. Why haven't you investigated that? Leopard made thousands of changes in addition to the Apache and CGI.pm versions, including changes to the firewall and networking in general; I'd take a good, hard look at your system preferences, first. and make sure you don't have any other old conf files lying around that may be cousing problems. If you are certain that the problem is in your Perl script somewhere, please include, in your next message a small sample script that replicates the problem. It's very difficult to troubleshoot a description. It's much easier to troubleshoot code. HTH, --jay -- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org values of β will give rise to dom!
Re: MacPerl Script on OS X
On Thu, Feb 28, 2008 at 7:13 PM, Ben Crane [EMAIL PROTECTED] wrote: Jay, Thanks for your response copied below. I really don't want to go to Perl 5.x and all that newfangled stuff. Here's my code ending with the offending line 7 according to my BBEdit error msg also copied below. I think the problem must be something simple. BBEdit says the syntax is OK, and it does run OK under Classic. I've tried different path name conventions, ( / instead of : ) but that doesn't seem to help. All files have 777 permissions. 1 #!/usr/bin/perl 2 3 # This script converts the file names of scans and images formed from the scans from consignor IDs 4 # to lot IDs. The file g5hd:newScansImages:trans is formed by exporting from the filemakerPro records that 5 # describe the lots and contain the images 6 7 open (trans, g5hd:newScansImages:trans) or die Error, can't open; 8 Hi Ben, First, you rinstinct to convert to OS X/unix-style filenames was correct. Second, you'll want to add $! to your die messages. That will tell you *why* the operation failed: open (trans, g5hd:newScansImages:trans) or die Error, can't open: $!; In this case, it's probably because the file doesn't exist, or your script doesn't have read permissions for it, but you won't know for sure until you see what $! returns on your system. If the file does exist, make sure the user your script runs as can read the file. If the file doesn't exist, make sure you are opening the file in read/write mode see perldoc open for more information, but something like open(TRANS, , path); # or open(TRANS, , path); should do what you need, depending on whether you need to read or write. Also, keep in mind that filehandles should be barewords or variables, not double-quoted strings. That can bite you later. By convention, they're also usually uppercase. That makes it easier to tell the difference between filehandles and other things. HTH, -- jay -- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org values of β will give rise to dom!
Re: MacPerl Script on OS X
On Thu, Feb 28, 2008 at 4:03 PM, Ben Crane [EMAIL PROTECTED] wrote: I have a Perl 4.X script that runs using MacPerl in Classic on my G5 Mac but I can't get it to run using Perl in 10.4.11. What do I need to do to make it run? Thanks for any suggestions. Upgrade it work with Perl 5.x ;) Seriously, though: what errors are you seeing? Does it rely on any modules? Perhaps more importantly: is it set to be executable on 10.x? Remember that the permissions scheme is different on X, and if it was set to run under MacPerl on Classic, it won't be executable by default. Unfortunately, a *lot* has changed in the last 15 years (the last perl4 release was in 1993), so I don't think anyone is going to be able to give you a list of all the things that could be going wrong off the tops of their heads. Post the errors, though, and if possible the problematic code, and we can help. HTH, -- jay -- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org values of β will give rise to dom!
Re: Strange problem with @INC
On 1/9/07, Jesse Engel [EMAIL PROTECTED] wrote: hmm, no, just the default /usr/bin/perl. i've thought about installing 5.8.8, but haven't yet. i changed my shell to bash (doesn't everyone?) in both xterm and apple_terminal and i did make a .bashrc in which i changed the default value of $PATH to this: PATH=$PATH:/sw/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/bin:/sw/share/doc/man i am getting different outputs for echo $PATH; xterm returns more search paths. also, printenv doesn't return a PERL5LIB under xterm. i guess a good way to modify $PERL5LIB would be cool, although i have read from several sources that it is better to use lib /foo/bar; than to modify $PERL5LIB. You've installed fink at some point, and you've either used it to install something Perl-related (maybe a utility that is written in Perl? Psync? SpamAssassin?) and as part of that process, you or the installer have updated your rc file to add directories under /sw to $PERL5LIB (or to source a config file that does that). This probably happened when you ran /sw/bin/pathsetup.sh as recommended by the Fink install quide. This has nothing to do with Terminal.app; the only thing that touches /sw is Fink. /sw doesn't even exist on the system until Fink creates it, and any reference to /sw that exists in any path or environment variable was set by either you or Fink. See if your .profile or .bash_profile or .login or other rc file (I'm sure there are a few I've forgotten) doesn't have a line similar to test -r sw/bin/init.sh . sw/bin/init.sh It won't be in .bashrc, though, unless you added it yourself. As I said before, you have two options here. Since reinstalling all your Finked software manually probably isn't appealing, what you need to do is use your .xinitrc file to setup the fink environment in X. Either setup your PATH and PERL5LIB manually in .xinitrc (it works just like any other rc file) or source /sw/bin/init.sh. Google xinitrc for the gory details; the Fink X FAQ with detailed directions is actually the first hit. HTH, -- jay -- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org values of β will give rise to dom!
perltidy and -w flag
I've recently started using TextMaker to edit my Perl scripts after many years of Emacs. On the whole I'm happy, but one thing really bugs me: styling. I've never really used perltidy before--Emacs perl-mode and cperl-mode have done everything I wanted. TextMate, though, uses perltidy internally. I've got my flags pretty well set in ~/.perltidy, but I can't for the life of me figure how to get it to stop putting the '-w' flag on the shebang line. It also seems to occasionally eat my 'use warnings;' when it does it. Any thoughts? Thanks, -- jay -- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org values of β will give rise to dom!
Re: perltidy and -w flag
On 10/5/06, Joseph Alotta [EMAIL PROTECTED] wrote: Some people like TextMate also. I think it costs $29. www.macromates.com/ Joe. The results of a long night coding and not enough coffee...I've meant TextMate all along. Tonight: sleep. --j -- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org values of β will give rise to dom!
Re: perltidy and -w flag
On 10/5/06, Paul McCann [EMAIL PROTECTED] wrote: Jay Savage wrote: I can't for the life of me figure how to get it to stop putting the '-w' flag on the shebang line. It also seems to occasionally eat my 'use warnings;' when it does it. I've just tried to replicate this in TextMate (selecting Tidy via the Perl bundle with a use warnings; line and no -w flag. A naked called to Tidy --that is, I have no .perltidy file-- didn't change anything except the indentation of some loops; do you still get the overriding of warnings if you move your .perltidy aside? Just for the record I have... % perltidy --v This is perltidy, v20060719 [...copyright stuff] You beat me to it. I was just getting ready to follow up. As it turns out, it's not perltidy; it's an insidious feature of TextMate. It turns out that TextMate runs its filters on the file being edited--not on the buffer. It then replaces the buffer with the output from the filter. In preparation for overhauling an inherited project, I was opening up copies of some old files, modifying the shebang, adding 'use warnings;' and running perltidy before I started editing in earnest. When the '-w' kept reappearing, I thought it was perltidy being didactic. I turns out, though, that was was really happening was TextMate silently throwing out my unsaved edits before passing the file off to perltidy. Or after it got the file back from perltidy, whichever way you want to look at it. I'm just glad I hadn't made any important changes. The bug report is in the mail. The correct behavior, IMO, would be to filter the buffer. I'd settle, though, for a you're about to clobber your unsaved changes diag. -- jay -- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org values of β will give rise to dom!
Fwd: DBD::mysql OS X
nd again with the reply-to. -- Forwarded message -- From: Jay Savage [EMAIL PROTECTED] Date: Aug 3, 2006 10:40 AM Subject: Re: DBD::mysql OS X To: Walter Copenhaver [EMAIL PROTECTED] On 8/3/06, Walter Copenhaver [EMAIL PROTECTED] wrote: Hello, Has someone manage to install DBD::mysql in Mac X Tiger. Can anyone point me to a tutorial or how to do this. Thanks Walter, Can you tell us specifically what problems you're having and what errors you're seeing? Installations usually go pretty smoothly. Just: perl -MCPAN -e 'install DBD::mysql' The only caveat I can think of is that the tests assume you're installing DBD::mysql against a fresh MySQL installation with the root password still unset. If you've already configured MySQL and set the root password, the tests will all fail. Since it's a pretty stable module, it's usually safe to just go ahead and force install, but you may want to unset to root password during the installation to run the tests. You'll also have to force install if the the server you're planning to use is on a different machine. You can read all about it at http://www.mysql.org/doc/refman/5.1/en/perl-installation.html, but here's the relevant part: The DBD::mysql installation runs a number of tests. These tests attempt to connect to the local MySQL server using the default username and password. (The default username is your login name on Unix, and ODBC on Windows. The default password is no password.) If you cannot connect to the server with those values (for example, if your account has a password), the tests fail. You can use force install DBD::mysql to ignore the failed tests. Some other common issues are at http://www.mysql.org/doc/refman/5.1/en/perl-support-problems.html, but they shouldn't apply to OS X. HTH, -- jay -- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org values of β will give rise to dom! -- -- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org values of β will give rise to dom!
Re: DBD::mysql OS X
On 8/3/06, Sherm Pendley [EMAIL PROTECTED] wrote: On Aug 3, 2006, at 10:41 AM, Jay Savage wrote: The only caveat I can think of is that the tests assume you're installing DBD::mysql against a fresh MySQL installation with the root password still unset. They assume no such thing. They don't even assume that the server against which you're going to run the tests is on the same machine. I believe you, but this clearly contradicts docs, and the information provided by MySQL themselves, see the MySQL reference manual at http://www.mysql.org/doc/refman/5.1/en/perl-installation.html. The relevant portion is The DBD::mysql installation runs a number of tests. These tests attempt to connect to the local MySQL server using the default username and password. (The default username is your login name on Unix, and ODBC on Windows. The default password is no password.) Assuming that you run cpan via sudo, that means the tests attempt to connect to the database as root, with no password. That's pretty clear from the docs and, in fact, matches observed behavior. Detailed instructions are provided with the module that detail how to provide the user name, password, host name, and other information with which to run the tests. Indeed there are some arcane libs options and command line switches buried in INSTALL. Ok, I'll turn off the sarcasm, they're not really that obscure. But few things in life bug me more than CPAN modules that can be installed via normal CPAN methods. If you've already configured MySQL and set the root password, the tests will all fail. No, the tests will fail if you haven't provided the necessary information for them to connect. The root password *IS NOT* necessary. You don't have to run the tests as root either - current CPAN.pm versions allow you to run the first few steps of module building and testing as an ordinary user, and run the final step as sudo make install. That's a very interesting point about recent CPAN.pm versions, I'll have to look into that, thanks! We're going to have to quibble over the definition of requires, though. fails by default unless I go in a change the source and/or makefile fits my working definition of requires. The only requirement for the tests is that the test database (which need not be named 'test') exists, and that the test user is fully authorized to perform any operation on that database. It will need to create and drop tables, perform queries, insert and delete rows, etc. I think we're quibbling over sematics here. But let me change that to By default the tests will be run as the current user with a password of ''. Under normal circumstances (i.e. sudo -MCPAN -e'install...) that means the tests will require that root be able to connect to a running MySQL server on the local machine with a null password. Since it's a pretty stable module, it's usually safe to just go ahead and force install Agreed - provided that the tests failed with failed to log in errors and not some other error. , but you may want to unset to root password during the installation to run the tests. Worst. Advice. Ever. You absolutely DO NOT want to open up a huge gaping security hole in your database. Obviously my assumption here is that installing DBD::mysql is one of the first steps in setting up a new mysql installation. In fact, default configuration will fail to install if the database is anything other than a clean installation. That may, of course, be a faulty assumption, and I certainly wouldn't advise anyone to unset the root password--or any other password--on a live database accepting connections from the network. In the CPAN shell, run the look DBD::mysql command. This will download the latest tarball and unpack it, then open up a subshell so that you can run the other commands manually. In the subshell, run open INSTALL.html to open the installation docs in your default web browser. Under the Source Installation section, there's a Configuration section, where a number of options are listed that you can pass to Makefile.PL. Determine what options you want to use, then run the commands. For example, if I wanted to connect to the 'testme' database on 'mydbserver.invalid', and log in as 'nobody_special' with password 'lemmein', I'd run this sequence of commands: perl Makefile.PL --testdb=testme --testhost=mydbserver.invalid -- testuser=nobody_special --testpassword=lemmein make make test sudo make install Depending on how you've configured your CPAN shell - i.e. whether you're already running as root or not - you may not need to use sudo with the last step. When you're done, use 'exit' or ctrl-d to leave the subshell and get back up to the CPAN shell. This is probably one of the best and most concise explanation I've ever seen of CPAN.pm's advanced features. Thanks again! -- j -- This email and attachment(s): [ ] blogable; [ x ] ask first
Re: PerlTK's -clipboardAppend in OSX...?
On 5/4/06, Michael [EMAIL PROTECTED] wrote: [snip] Correct. Quartz and X11 have different (actually, at least 3) clipboard systems that aren't shared. You can get around this by using copy in the X11.app munbar at the top of the screen. but in order to manage this clipboards entirely from within X11 (TK), you're going to need help. See the xcutsel application that's part of the standard X11 build, or autocutsel from Fink. Alternatively, you can use XDarwin instead of the Apple X11 port. Recent versions of XDarwin synchronize the clipboards...most of the time. Note that Quartz does a good job of reading the X11 clipboard. Items cut in X11 should be available to Quartz apps. It's just doesn't work the other way around. if it is possible to synchronize the clipboards... Yes, see the man pages for the programs I mentioned. perhaps this can be done when the PerlTK methods which add or retrieve data from the clipboard are called? No. This isn't a TK issue. This is a window manager issue. TK only knows about the clipboard for the window manager/server it is running under. No X11 application can see the OSX clipboard. It doesn't matter whether they are TK, Qt, or GTK applications. Perhaps the developers of PerlTK can address this issue...? Again, this has nothing to do with PerlTK, or even TK. Apple would need to add support for the the Quartz clipboard to it's X11 distribution. If this really bothers you, talk to Apple. Or use XDarwin instead of Apple's X11. xcutsel and autocutsel do provide workarounds, though. Just add the appropriate commands as callbacks on you cut and paste routines. Alternatively, since the Finder is scriptable, you could probably use Mac::Glue or a call to osascript to pass the values from the X11 clipboard to the quartz clipboard. There are lots of solutions here, but none of them are built into TK, nor can they be. If you want your program to interface with an environment other than the one TK is running ni, it's up to you to make the links. If interoperability is important to you and the less-than-elegant solutions available don't appeal to you, you could port the program to CamelBones, which is a framework for building Cocoa applications in Perl. HTH, -- jay -- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org values of β will give rise to dom!
Re: PerlTK's -clipboardAppend in OSX...?
On 5/3/06, Michael [EMAIL PROTECTED] wrote: Hello, Anyone have trouble copying things to the clipboard using PerlTK's -clipboardAppend...? When I use it to put things in the clipboard, I cannot paste the contents into other OSX apps like Textedit. The Paste option is available in the application, however no data appears when one pastes. Correct. Quartz and X11 have different (actually, at least 3) clipboard systems that aren't shared. You can get around this by using copy in the X11.app munbar at the top of the screen. but in order to manage this clipboards entirely from within X11 (TK), you're going to need help. See the xcutsel application that's part of the standard X11 build, or autocutsel from Fink. Alternatively, you can use XDarwin instead of the Apple X11 port. Recent versions of XDarwin synchronize the clipboards...most of the time. Note that Quartz does a good job of reading the X11 clipboard. Items cut in X11 should be available to Quartz apps. It's just doesn't work the other way around. HTH, -- jay -- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org values of β will give rise to dom!
Re: print 3 up labels
On 11/10/05, Joseph Alotta [EMAIL PROTECTED] wrote: Greetings, I want to print Avery 6140 labels with name and address from a mac. Is there a library. If not, does anyone know how to set a font and tab a certain number of inches to print 3 columns? Joe Alotta A CPAN search is your best friend here. Avery label turns up PostScript::MailLabels, labels, and Paper::Specs. Other search terms will undoubtedly turn up other results. Take a look and see what works for you. -- jay -- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.dpguru.com http://www.engatiki.org values of β will give rise to dom!
Re: BBEdit/Interarchy
On 6/2/05, Bill Stephenson [EMAIL PROTECTED] wrote: On Jun 1, 2005, at 4:40 PM, Jay Savage wrote: Bill, Just upload the file to something like my_script.cgi.new. It can take as long as it needs to transfer. Once it's transferred, rename it. HTH, -- jay daggerquill [at] gmail [dot] com http://www.engatiki.org Thanks for the reply Jay, I've done that too, but it's a rather laborious solution to what must be a rather common task and I'm thinking there could be a more automated way to deal with it. Since both BBEdit and Interarchy are already built to work together I was hoping that someone more familiar with their guts may have worked on it already. So I guess what I'm asking is if there a way to get either of these apps to upload a file with a new name and rename it after the upload is complete with one click. Obviously, this doesn't entirely solve the problem, but it does reduce the potential. Kindest Regards, The answer is probably no. At least not out of the box. It's not really all that common, at least not any more: most mission critical apps are maintained on reasonably high speed connections. In most cases if you're working on an application where a customer just absolutely can't get a 505 error, ever. The comapany pays for a cable or T1--or at least DSL--connection. And usually, if it's that important, especially if you're using renaming to aviod connection problems, you don't want the process to be automated. You want to do it by hand to make sure it works, and you want to verify the checksums on both the download and the upload, just to be sure you've got everything. So no, this probably isn't as common as it seems, although it was certainly more common 5 years ago. That said, interarchy is extremely AppleScriptable. You should be able to whip up something fairly quickly. If you poke around the Interarchy users group (it's linked from the website) there may even be something out there already. Anothe option would be to set up a cron job on the server to periodically rename files with a certain extension. HTH, -- jay daggerquill [at] gmail [dot] com http://www.engatiki.org
Re: ?Tk on mac- Question from a novice
On 4/15/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm trying to run a perl program my friend has written via komodo on his windows machine however it uses the tk module. Despite a few attempts I cant seem to install this on module on my mac. Any ideas? Am I missing something? Are there issues with Tk.pm on OSX? Thanks Anthony Well, what errors is it giving you? How are you trying to install it (cpan, make it yourself)? What version of perl do you have? Give us the error messages you're getting. What jumps immediately to mind is that the latest Tk.pm will only install under perl 5.8.0+, but Jaguar shipped with 5.6.0. So you'll need to update your perl, if you haven't already. But your problem could be something else entirely. More info. HTH, jay
Re: How to mount FTP as volume?
On Apr 1, 2005 12:35 PM, Joseph Alotta [EMAIL PROTECTED] wrote: Hi Everyone, I kind of remember trying this, it sort of worked, ie, it made the connection but it was slow and unusable and the little wheel would just keep spinning until I killed the job. And unless they changed things radically and I missed it, It doesn't mount the server -rw, which makes it basically useless. who mounts a volume for *downloads*? --jay