Re: Breaking up a long string...
On Dec 28, 2003, at 10:10 PM, Kim Helliwell wrote: I have a long string of characters ( 40,000 chars) that I need to break up into strings of 6 chars each. Is there a simple way to do this in Perl? unpack() doesn't seem to be the right solution; there are no terminations for the strings I'm after. Maybe that works for you? my $string = 'string_of_40k_chars'; my @strings = $string =~ /.{6,6}/g; my $remainder = substr($string, -1, length($string)%6); Have I actually found something that is easier in C than in Perl? I couldn't tell. /h
Re: Breaking up a long string...
On Dec 29, 2003, at 12:47 PM, Andy Lester wrote: On Mon, Dec 29, 2003 at 09:03:27AM -0800, R. Hannes Niedner ([EMAIL PROTECTED]) wrote: my $string = 'string_of_40k_chars'; my @strings = $string =~ /.{6,6}/g; my $remainder = substr($string, -1, length($string)%6); You mean /.{6}/ instead of /.{6,6}/, I think. The latter will indeed work, though. I forgot that RE are greedy, thus /.{6}/ make the remainder line superfluous, thanks. If you really wanna use that regex thing, use: my $alphabet = join( , A..Z ); my @chunks = ( $alphabet =~ /.{1,6}/g ); #my @chunks = unpack( (A6)*, $alphabet ); print join( , , @chunks ), \n; But really, that unpack() trick is the way to go. xoa learning new stuff all the time, thanks again. Is unpack the more efficient (faster, or less memory requiring) way to do this? cheers/h
CPAN broken in Panther
Are there others having problems with CPAN in 10.3. ? None of the file transfer methods seems to work and everything times out on more than 10 different ftp archives. I already followed the instructions from one BSD mailing list: http://news.gw.com/comp.unix.bsd.openbsd.misc/37614 but it only skips the initial retrieval errors, and just copying all perl modules in the .cpan directory outside of CPAN just to install them from the cpan shell doesn't seem to be the solution. I know that lynx, wget, ftp etc are working outside of cpan I would be grateful for your advise or pointers to the archives (where I must have missed it then). thanks/h -- 1GHz TiBook 1GB - Superdrive MacOsX 10.3 aim: hannes92122 www: http://users.sdsc.edu/~hannes
Re: CPAN broken in Panther
Turning off the firewall made it working again. I still don't understand why CPAN can't do all these file transfers on the commandline with or without the firewall enabled. Thanks to all who responded /h On Nov 25, 2003, at 1:07 PM, Elizabeth Mattijsen wrote: At 12:30 -0500 11/25/03, Morbus Iff wrote: I can confirm - just shut off the internal firewall (System Prefereces Sharing), and cpan works fine. I've not had time to look into it further. You might wanna do a export FTP_PASSIVE=1 before running CPAN. Helps me most of the time... Liz -- 1GHz TiBook 1GB - Superdrive MacOsX 10.3 aim: hannes92122 www: http://users.sdsc.edu/~hannes
Re: CPAN broken in Panther
What I meant was: On Nov 25, 2003, at 1:27 PM, Hannes wrote: Turning off the firewall made it working again. I still don't understand why CPAN can't do all these file transfers If ftp, lynx, wget etc. work with no problems if I run them on the commandline with or without the firewall enabled. Thanks to all who responded /h -- 1GHz TiBook 1GB - Superdrive MacOsX 10.3 aim: hannes92122 www: http://users.sdsc.edu/~hannes
Re: libxml2
On Sunday, September 28, 2003, at 05:57 PM, Brad Rice wrote: Then if I try to install XML::LibXML or another module needing libxml3 it tells me it can't find libxml2. Any thoughts? http://packages.opendarwin.org/ hth/h
Re: File write/read problem
On Wednesday, September 24, 2003, at 10:54 PM, [EMAIL PROTECTED] wrote: Now that sounds like that could be the overarching problem. It would also explain (I thingk) why I can't change the permissions of any of those directories with an ftp client. So if I change the ownership of the cgi-bin (and all the folders associated with the server) to www:www, then I should be able to write to the file. How is that accomplished? Thanks for your help, May I suggest that think of the security implications by making cgi-bin work writeable. It only has to be world executeable NOT more. If you want to write to a file write to a directory outside of cgi-bin in mac osx you might want to use /Users/shared/. If you still want change ownership issue the command 'man chown' in the terminal (without the quotes), for changing file permissions use 'man chmod'. Please Do inform yourself before you change ownership and permissions - you can screw yourself big time. JM2C/h
Re: File write/read problem
On 9/24/03 6:37 AM, Mark Wheeler [EMAIL PROTECTED] wrote: Hi, This is my first post to this group. Please forgive me if this is the wrong group for this question. I've been coding for a short time (a year or so) and love it. I've been using other hosts for my scripts, and am now setting up my OSX server. I've run into a snag. I can't figure it out. When I try to read (or write, for that matter) to a file nothing happens. Below is an example script. If the file is there, nothing. If the files is not there, nothing. I get the initial print statement about the file contents, but that's it. Is this a permissions problem? I've checked the permissions of the folder and it's 775, everything looks good. What am I missing. Again, forgive me if this post is misplaced. Mark -- #!/usr/bin/perl -w use strict; print Content-type: text/html\n\n; print The contents of the file: brbr; open (DATA, example.txt) || die (Could not open file br $!); my @text = DATA; print @text; close (DATA); exit; --- The above runs for me just fine (perl 5.8.0/ 10.2.8) from within bbedit. Since you get the initial statement - e.g. Part of your program are actually run through the interpreter I assume that you've taken care of the path to perl and also made sure you got Unix and NOT Mac line breaks. You probably intend to run this as a cgi script - thus how did you actually run the script? /h
Re: dbi 1.35 on mac os x [10.2.4]
On 3/19/03 10:55 AM, allan [EMAIL PROTECTED] wrote: hi i wonder why i can't install DBI version 1.35. below is some stdout from a cpan session suggesting to send a bug report. i am quite sure that other people has done this before me at least with version 1.30. [i had no problem installing 1.25 by the way]. i have perl 5.8 with threads insatlled basically i wonder if the lines below makes sense for some on this list ? thanks ./allan If you check the archives of that list you will find reports that DBI is incompatible with perl 5.8 with threads. Has this changed? /h
Re: XML::LibXML on Jaguar?
On 3/16/03 7:08 AM, Paul Corr [EMAIL PROTECTED] wrote: Folks, I was just wondering if anyone successfully installed the XML::LibXML and XML::LibXSLT Perl modules on Jaguar. I corresponded a bit with the author and he is aware that it works fine on 10.1 (I had it working) and it does not on 10.2. The module hasn't changed since last October or so. He has no Apple hardware to chase down the solution and it works everywhere else. He said if I, or anyone else I suppose, got it to install with some technique he would appreciate the info. I just recently found a solution that worked great for me on Mac OSX 10.2.4 (and 10.2.4 Server). Mount http://packages.opendarwinports.org in your finder install perl5.8 and all the libraries that you want from there. All the installs go in /opt/local and are very unlikely to interfere with anything you've installed already. The relink /usr/bin/perl to /opt/local/bin/perl and make sure you are running the new perl (which perl should now point to /opt/local/bin/perl). I also choose to put /opt/local/bin on position one in my path. Then run cpan -MCPAN -e shell and install all the modules you want, most of them work right out of the box and XML::LibXML and XML::LibXSLT did not pose any problem. Let me know if I was not detailed enough. HTH/h
FW: XML::LibXML on Jaguar?
From: R. Hannes Niedner [EMAIL PROTECTED] Mount http://packages.opendarwinports.org I am sorry the correct address is: http://packages.opendarwin.org Best/h
Compiling mod_perl on OSX 10.2.4
I was wondering whether some one knows why some tests are skipped. I think I am running into trouble because this functionality is missing in dependent Perl modules (I am trying to get Apache::PageKit to run). --- skip- seems ok--- modules/cookieskipped all skipped: no reason given modules/moduleskipped all skipped: no reason given modules/psections.skipped all skipped: no reason given modules/request...skipped all skipped: no reason given modules/stage.skipped all skipped: no reason given modules/symbolskipped all skipped: no reason given ---skip-seems ok to the end--- Thanks/h 10.2.4 default Perl V5.8 (with Apple's Perl 5.6.0 still untouched) Apples defaults Apache 1.37, mod_perl 1.27
Apache::PageKit
Did some manage to install Apache::PageKit on MacOSX. I tried it on 10.2.3 and Perl 5.8 but it dies on me at XML::LibXML and Apache::Request. Any hints are welcome. Thanks/h
Modules for 5.6.8
Has anybody successfully installed the following modules on a Mac Os 10.2.2 system (I tried on the server OS If that matters). Class::DBI::Extensions Class::DBI::Join I got the other Class::DBI modules installed just fine but these two throw errors in the make. Or how about compiling gd 2.0.8? I tried to compile it with usual hack: setenv LDFLAGS -flat_namespace -undefined suppress sudo ./configure --with-zlib=/usr --prefix=/usr/local But no go..I went for the 1.4x install which went ok, but Id love to try GD 2. In any case, happy holydays everybody /h
Re: BB Edit 7 reads shebang
On 11/14/02 9:08 AM, Tim Grant [EMAIL PROTECTED] wrote: On 11/14/02 11:21 AM, R. Hannes Niedner [EMAIL PROTECTED] wrote: On 11/14/02 7:07 AM, Tim Grant [EMAIL PROTECTED] wrote: Folks who have more than 1 Perl on their system might like to now that BBEdit (apparently) reads the shebang and acts appropriately. That is, now you can use the Check Syntax feature, and the correct install of Perl will check the document. I didn't see that feature in their literature, but it works. I guess that does not translate into checking against the Perl on the other side of the SSH tunnel? /h If you're interested in walking me through this a little, I'll try it out. I've only used ssh in the Terminal. -Tim Grant DBA, Knowledge Express If walk through means explain what I mean here it goes: Most of the files that I edit on my Powerbook reside on a Sun Host befind a firewall that does not allow insecure traffic (telnet ftp, etc.). To access them via BBEdit's FTP open remote function I establish an SSH tunnel that allows me to pipe the FTP through the firewall like: ssh -L 2025:remote.server.edu:21 remote.server.edu I can then establish an FTP connection in BBEdit using the local port (of the tunnel)127.0.0.1:2025 The question is in the context of the Shebang line but also of remote CVS check in and out. Someone posted that BBEdit would now read #! /which/perl/shall/I/use And checks the syntax against that Perl installation. I was wondering whether BBEdit would be so smart to see that a file actually resides on a remote server and would then test the perl script syntax against the remote Perl installation. The CVS question was already asked in a different mail, but basically can I use the CVS running on the remote server from within BBEdit? I hope I explained that ok? Best/h
Re: Way way way OT (IE default)
On 11/9/02 9:16 AM, Lou Moran [EMAIL PROTECTED] wrote: I have been to OS X Hints and I just can't get Internet Explorer to leave me alone. It continues to reset as the default browser. I like Chimera (especially for the tabbed browsing) and this is a major thorn in my side. perl_referencePerl rocks!/perl_reference -- D'oh! [EMAIL PROTECTED] (OS X) Check out http://www.obzorg.org/archives/0059.shtml /h
Re: Way way way OT (IE default)
On 11/9/02 10:29 AM, Kee Hinckley [EMAIL PROTECTED] wrote: Yow, that was complex. Did it work out for you (It did for me never had a problem ever since in 10.2.1)? /h