Re: Mac OS alias from Perl
For the traditional method if you can't find a module or common method just use the quote below the tilde, ie `ln -s /path/to/my/interest / path/to/my/alias`, note if this will run in a cron, you will have to give the full path ot ln, just do a whereis ln command (mine and yours should be in /bin. Dave On Dec 8, 2007, at 7:19 PM, Chris Devers wrote: On Dec 8, 2007, at 7:06 PM, Celeste Suliin Burris [EMAIL PROTECTED] wrote: Use a symbolic link instead. Perl handles those natively, and they can be accessed from the command line. The Finder just treats them the same as aliases. Not quite. I forget the details at the moment, but Finder aliases are kind of like firm links: while hardlinks point to inodes, and softlinks point to file pathnames, aliases point to the logical file in a more robust way than symlinks. For example, if the reverent file moves, symlinks break, but aliases shouldn't. If you really want aliases, I think the CPAN modules of Dan Kogai and Chris Nandor are the place to start. I forget who wrote what, but modules like (I think) MacOS::File and Mac::Glue can either make the right calls directly, or leverage Applescript / OSAscript to do this for you. Or if symlinks/softlinks are enough, just use the traditional Perl / Unix methods to make those. -- Chris Devers
Re: Getting outside the box
Albert, check out CPAN, you should find something like Device::Serialport , I've used a slightly modified version to talk to a keyspan device. dave On 3/7/05 12:13 PM, Albert Kaltenbaeck [EMAIL PROTECTED] wrote: I run a mac server and want to control an external DishNetworks Sat. receiver from my server. Then I can login to my streaming server to watch TV on the road. I can modify a IR remote control to get its commands via a USB port via a serial port adapter, (I believe). Does Perl support talking to an external port? Albert
Re: Perl Win32 vs. OS X
Bruce, depending on the platform of the originating text file, and in OSX that covers 2 bases really, the newline character is different. Moc OS9 below = \r Unix = \n Dos = \n\r OSX = \n but many text files are still \r from legacy So, to make you code good all around, try this instead if ($line =~ /^\n|\r\n?/) { # Do Something } Dave On 11/16/04 7:53 PM, Bruce Pascal [EMAIL PROTECTED] wrote: All, I am having a problem with a parser which works in DOS, but does not work in the OS X BSD shell. The problem is trying to find lines that begin with a newline character. I have tried exactly the same source files, but it doesn¹t work. Here¹s the code: if ($line =~ /^\n/) { # Do Something } Why would this happen? Any ideas? -Bruce
Re: Advice for enabling perl on OSX
The one I caught was that you couldn't run it from the command line with proper permissions. Do a whereis perl to ensure it's there, a perl -v to check it's info, and verify that you can run the script from the commandline. dave On Apr 22, 2004, at 6:59 AM, Eric Curts wrote: Greetings! I while back I wrote about assisting a neighboring school district with some perl scripts I had written to allow teachers to easily make web pages. Thanks very much to everyone who gave such good advice. That really helped. Now we are actually in the process of getting the scripts to work for them and have hit an early problem... I loaded a simple script to just test things out (one that just prints out environment variables) and it will not run. When I try to bring up the script I get: Forbidden You don't have permission to access /hck/cgi-bin/printev.cgi on this server. --- - Apache/1.3.26 Server at eagle Port 16080 I set the permissions to 755 for the script, and the folder is web accessible because html files open up fine from that location. When I make a terminal connection and try to run the script from the command line, it will not work either. I think it may be a more fundamental problem, such as needing to edit something in their httpd.conf file or needing to enable something else on the server so that perl scripts will be executed. They have never runs scripts before, so nothing has every been set up for this. I would appreciate any suggestions you have for this problem, especially an idea of what configurations are needed the first time to get an OSX server to execute perl scripts. As always, thanks so much! Eric * Eric Curts * Technology Specialist, North Canton City Schools * [EMAIL PROTECTED] * (330) 497-5600 x377 * FAX (330) 497-5618 * * Give a man a fish and you feed him for a day; * teach him to use the Net and he won't bother you for weeks.
Re: Web servers with cable DSL
I actually do this, I run a family web site and a club web site, but I have a couple of special things with my DSL. My provider, Speakeasy.org, explicitely states that it is ok to run your own web services, ie you paid for the bandwith (going both ways!!) so use it as you please. If you greatly abuse it, they may have an issue tho. I also have a particular package which provides reasonable upload capability (600 kB upstream/1.5 mB down w/2 static ip addresses), which makes it so a page doesn't take forever to load. btw, I chose this provider for those very reasons, as I didn't want to do it offline. Dave Gomez On Mar 16, 2004, at 11:13 AM, Bill Stephenson wrote: I was wondering if anyone here is using a MacOS X box with a fixed IP cable DSL account as a commercial grade web server? Is this a reasonable alternative to using a hosting company like Verio? I could sure save some cash by switching to this set-up but I have concerns about performance and reliability. Will DSL provide enough bandwidth to 2-5000 visitors a day for web sites that serve standard HTML and web graphics? (ie. no broadband media like video, mp3, or other streaming media formats) Any help and advice will be much appreciated. Bill Stephenson
Re: ***regular expression***
Paolo, try s:a href=$urlstring/a:idlink$val1: note by using : as the replacement delimiters, you don't have to escape the forward slashes. You will have to worry if the strings you have there contain colons tho, although your variable strings should be ok Dave On Nov 14, 2003, at 8:25 AM, xweb wrote: Can someone help me about a regular ? In which way i can substitute a href=$urlstring/a with idlink$val1. Thanks Paolo
Re: making Perl scripts run
Lou, try .\phonetic.pl and also make sure the first line contains #!/usr/bin/perl (or variants which enable strict etc). If the first thing works, all you need to do is add .\ into your paths within the .bashrc file. Dave Gomez On 8/27/03 4:56 PM, Charlie Root [EMAIL PROTECTED] wrote: mrsparkle ellem ~/code $ phonetic.pl bash: phonetic.pl: command not found mrsparkle ellem ~/code $ sudo chmod +x phonetic.pl Password: mrsparkle ellem ~/code $ phonetic.pl bash: phonetic.pl: command not found mrsparkle ellem ~/code $ perl phonetic.pl Enter some letters and numbers: ASF19 alpha sierra foxtrot one niner mrsparkle ellem ~/code $ What am I doing wrong? I'd like perl scripts to work without my typing perl first. -- Lou Moran [EMAIL PROTECTED] http://ellem.is-a-geek.org:5280/ http://homepage.mac.com/ellem52/
Re: Device::SerialPort
Rob, I got it to compile on 10.2, but I had to do some tweaks. I'm using it to talk to serial port on a keyspan usb-serial device, and also in a imac with a stealthport, works great. I used version 0.7 tho, and I'd have to get it down to do a diff. If your interested, I can send you the gzip of a compiled version ready for install, or look at it via a diff, but that'll take longer. Dave Gomez On 11/25/02 6:03 PM, Rob Barris [EMAIL PROTECTED] wrote: http://search.cpan.org/author/COOK/Device-SerialPort-0.12/SerialPort.pm This would be handy (for me) but it doesn't build on OSX, no doubt because IOKit's interface is different from POSIX/Linux style device control. I do have a couple pieces of sample source for talking to serial ports on OSX, but was wondering if anyone else had looked at this type of thing or ported similar code that needs to do ioctl's etc. Specific examples of serial port devices that do show up under OSX in the /dev directory would be the Keyspan USB-serial adaptors and (I believe) the Griffin Stealth Serial plugin card that goes in the modem slot. Rob
Re: -d
here is a code example using find:file, note it is recursive, and will work with where you are sitting, or a passed argument of start point including ~ Dave Gomez #!/usr/bin/perl -lw # fdirs - find all directories @ARGV = qw(.) unless @ARGV; use File::Find (); sub find(@) { File::Find::find } *name = *File::Find::name; find { print $name if -d } @ARGV; On 11/2/02 4:07 AM, John Delacour [EMAIL PROTECTED] wrote: If I do this... #!/usr/bin/perl $dir = $ENV{HOME}/; opendir DIR, $dir ; for (readdir DIR) { -d and print $dir$_$/ } I aim to get all the files in my home directory that are directories, but the result is a list of only a few of the existing directories: /Users/jd/. /Users/jd/.. /Users/jd/dev /Users/jd/Library How do I get a list of all directories in a directory and, more to the point, what is the best way to get a complete tree starting from a certain directory? JD
Re: DBD::mysql help
Not likely, as if you look at the ones that failed, dropping/adding a database, those are the ones that need some particular permissions. You can modify test scripts if you like, but if the access is working, you can probably install and get to work on it. dave gomez After make, I get some warnings. Are these something I should worry about? /System/Library/Perl/darwin/CORE/perl.h:498: warning: Precomp '/usr/include/unistd.p' version number is 24 instead of 25, ignoring precomp After make test, it gets most of the way through, but some fail. Note that it is trying to use 'root' with no password again. In mysql, I granted all privileges to user mysql for test.*. t/akmiscFAILED test 44 Failed 1/351 tests, 99.72% okay t/dbdadmin..ok 4/20Error while executing createdb: Can't create databaset/dbdadmin..NOK 5New DB not in DSN list t/dbdadmin..NOK 6Error while executing _DropDB: Access denied for user: t/dbdadmin..ok 8/20$drh-admin('createdb') failed: Access denied for user: 'rootlocalhost' (Using password: NO) t/dbdadmin..NOK 9DSN testab not in DSN list. t/dbdadmin..NOK 10$drh-admin('dropdb') failed: Access denied for user: 'rootlocalhost' (Using password: NO) t/dbdadmin..NOK 13$drh-admin('createdb') failed: Access denied for user: 'rootlocalhost' (Using password: NO) t/dbdadmin..NOK 14DSN testac not in DSN list. t/dbdadmin..NOK 15$drh-admin('dropdb') failed: Access denied for user: 'rootlocalhost' (Using password: NO) t/dbdadmin..FAILED tests 5-7, 9-11, 13-15 Failed 9/20 tests, 55.00% okay t/insertid..ok t/mysql.FAILED test 23 Failed 1/68 tests, 98.53% okay t/mysql2ok Failed Test Status Wstat Total Fail Failed List of Failed t/akmisc.t 3511 0.28% 44 t/dbdadmin.t 209 45.00% 5-7, 9-11, 13-15 t/mysql.t 681 1.47% 23 1 test and 14 subtests skipped. Failed 3/18 test scripts, 83.33% okay. 11/764 subtests failed, 98.56% okay. thanks, jon
Re: gd croaking
Puneet, Think I had same issues, and gave up and used gnuplot instead for some graph creation, as it does put out graphs like the ones I use on my site well (http://www.dkgomez.com/cgi-bin/housetemp.pl). Think I used fink to do the install of gnuplot Dave Gomez On 10/10/02 2:27 PM, Puneet Kishor [EMAIL PROTECTED] wrote: Ok, here's some more info that I was able to put together. I built gd and supporting libraries using gcc 3.1. To build another program (that actually eventually generates a perl module), I had to revert to gcc 2.x. I, then, reverted back to gcc 3.x and built the perl specific module. Running my perl scripts hence produces the errors below. The dyld: perl Undefined symbols: portion indicates there might be some binary incompatibility. Between what and what though? Is there a way I can test this? (I guess, in a manner of speaking, I did test it and learned it is incompatible :-( ) Puneet Kishor wrote: Folks, I haven't messed with the OS at all. I am using the Perl 5.6.0 that comes with OS X 10.2. I built gd 1.8.4 using Scott Anguish's directions on stepwise (as I have done before), and that worked just as expected. Then I built a specific perl module that helps makes maps (used to work fine on 10.1.whatever. I run my scripts unchanged, and I get the following in the apache error_log. Seems like gd is not happy. Without any further info to share (I really don't know what else to offer), can anyone shed some light on the following, or guide me to someplace I can find answers? Many thanks. Puneet. % tail -f /var/log/httpd/error_log dyld: perl Undefined symbols: _gdFontGiant _gdFontLarge _gdFontMediumBold _gdFontSmall _gdFontTiny _gdImageArc _gdImageColorAllocate _gdImageColorTransparent _gdImageCopy _gdImageCopyMerge _gdImageCopyResized _gdImageCreate _gdImageCreateFromJpeg _gdImageCreateFromPng _gdImageDestroy _gdImageFillToBorder _gdImageFilledPolygon _gdImageFilledRectangle _gdImageInterlace _gdImageJpeg _gdImageJpegPtr _gdImageLine _gdImagePng _gdImagePngPtr _gdImagePolygon _gdImageRectangle _gdImageSetBrush _gdImageSetPixel _gdImageSetStyle _gdImageSetTile _gdImageString _gdImageStringFT _gdImageWBMP _gdImageWBMPPtr [Thu Oct 10 11:00:46 2002] [error] [client 127.0.0.1] Premature end of script headers: /Users/pkishor/Sites/bims/index.pl
Re: Getting line endings
What do you want to do with the ending, change it, kill it, or just know it. To kill all of those types, you can use chop to remove the last character, or better yet chomp to only remove \r or \n. Dave gomez
Re: Need help with DBD::mysql install
I didn't have an issue, thought I just used the cpan command to make sure all dependencies were met. But, you can also used a precompiled binary from Fink see: http://fink.sourceforge.net/pdb/search.php?s=DBD they have a pre-built one for mysql and postgresql, or more exactly, they may have been modified to work correctly with OSX. Dave Gomez On 6/15/02 4:41 AM, Mark Lowe [EMAIL PROTECTED] wrote: I¹m able to install all other modules without a problem...but the for some reason Make fails at the end of DBD::mysql Bundle via CPAN. Has anyone else run into this? It¹s killing my Perl / mysql project. Thanks in advance, Mark