Re: New Perl-Installation on new OS X

2011-06-10 Thread David Cantrell
On Thu, Jun 09, 2011 at 12:43:43PM +0200, Marek Stepanek wrote:

 But perhaps this list could help me, to get @INC and $PERL5LIB clean of 
 /sw ... How is it possible, that I have $PERL5LIB set to
 
 %ENV:
 PERL5LIB=/sw/lib/perl5:/sw/lib/perl5/darwin
 
 in [my .profile] I only have one line:
 
   test -r /sw/bin/init.sh  . /sw/bin/init.sh

So you're wondering where the /sw/wibble is coming from, and you've
found something mentioning /sw/wibble in your .profile.  D'you think
they might be related?

Several fixes come to mind:

1. delete that line from .profile.  This will, however, prevent anything
   else that it does from happening.

2. edit /sw/bin/init.sh to prevent it from messing with PERL5LIB.

3. save PERL5LIB before that line and restore it afterwards.

4. just set PERl5LIB to whatever you fancy after that line.  This will,
   however, mean that you override any changes that may be made to your
   startup files elsewhere at a later date.

-- 
David Cantrell | Reality Engineer, Ministry of Information

  Blessed are the pessimists, for they test their backups


Re: New Perl-Installation on new OS X

2011-06-10 Thread David Cantrell
On Fri, Jun 10, 2011 at 04:11:43PM +0100, John Delacour wrote:
 At 10:38 -0400 10/06/2011, Sherm Pendley wrote:
   What would be the effect of setting a value (or no value) for PERL5LIB 
  in
  ~/.MacOSX/environment.plist?
 That plist is for setting up environment variables for GUI apps. It
 has no effect on shell sessions.
 Obviously I'm missing something.  If I do set it, it seems to have 
 the same effect ...

Are you using Terminal.app?  That's a GUI application, so it takes
effect, and is then inherited by the shell.  Try sshing into your
Mac from elsewhere.

-- 
David Cantrell | Enforcer, South London Linguistic Massive

PERL: Politely Expressed Racoon Love


Re: Perl 5.10.0 Memory Usage

2010-08-04 Thread David Cantrell
On Mon, Aug 02, 2010 at 07:13:17AM -0400, Bill Birkett wrote:
 I recently upgraded from Leopard to Snow Leopard.
 
 Now, some scripts that ran nicely on Perl 5.8.9 are consuming all 
 available RAM on Perl 5.10.0, and bringing the system to its knees.
 
 The scripts I'm referring to create a series of large objects, each 
 of which should be garbage-collected when the next object is created.
 
 Apparently, Perl 5.10.0 is not picking up the trash.
 
 I know how to use Perl 5.8.9 on Snow Leopard, but I would rather use 
 the 64-bit version.

If your 5.8.9 is 32-bit and 5.10.0 is 64-bit, then you can expect data
structures to use more memory, up to twice as much in the worst case.

-- 
David Cantrell | Nth greatest programmer in the world

Hail Caesar!  Those about to vi ^[ you!


Re: Perl 5.10.0 Memory Usage

2010-08-04 Thread David Cantrell
On Mon, Aug 02, 2010 at 06:05:46PM -0400, Bill Birkett wrote:

 I found some circular references, and after removing them, garbage 
 collection worked as expected.
 
 Strange that Perl 5.8.9 destroyed the objects, but Perl 5.10.0 didn't.

Do you know if 5.10.1 does?

 Is there an easy way to troubleshoot this sort of problem, other than 
 digging through your code?

There are some modules for helping to find memory leaks.  I forget their
names, but search for leak on search.cpan.org.

-- 
David Cantrell | top google result for topless karaoke murders

Arbeit macht Alkoholiker


Re: perl modules installation on OSX

2010-02-17 Thread David Cantrell
On Tue, Feb 16, 2010 at 04:17:40PM -0500, Daniel Staal wrote:

 As of perl 5.10 it is standard with perl, and the old cpan module/client
 has been depreciated.  The plan is to remove the old client altogether.

The only core modules that are deprecated are:

  Class::ISA
  Pod::Plainer
  Shell
  Switch

At least according to Module::CoreList.

-- 
David Cantrell | even more awesome than a panda-fur coat

Vegetarian: n: a person who, due to malnutrition caused by
  poor lifestyle choices, is eight times more likely to
  catch TB than a normal person


Re: paths in Perl

2009-03-12 Thread David Cantrell
On Thu, Mar 12, 2009 at 09:27:54AM -0400, Wayne Brissette wrote:

 Anyhow, I'm playing around with reading in some static files in perl, what 
 I've discovered is that if put the script in the same directory as the text 
 file, it works properly. However, if I try to provide a path like: 
 ~/Documents/log_files/
 
 The script can't open the file. is there a trick in Mac OS X to do this that 
 is outside the perl norm? 

Using ~ as a shortcut for your home directory is a shell-ism, perl
doesn't handle it.  Replace it with $ENV{HOME}, or if you want your code
to be portable to non-Unix platforms, use the File::Homedir module.

-- 
David Cantrell | A machine for turning tea into grumpiness

fdisk format reinstall, doo-dah, doo-dah;
fdisk format reinstall, it's the Windows way


Re: Dumb path question

2009-03-11 Thread David Cantrell
On Tue, Mar 10, 2009 at 02:48:07PM -0600, Doug McNutt wrote:
 At 20:25 + 3/10/09, John Delacour wrote:
 At 21:10 -0600 9/3/09, Doug McNutt wrote:
 At 22:24 -0400 3/9/09, Chris Devers wrote:
 How can a Perl script reliably, portably resolve the path inside which
 it is running?...
 portable seems to be the key here.  Modules good for that.

If you look at the code for Cwd, you can see all the contortions it goes
through to be portable.  See also the perl versions/platforms matrix
generated from CPAN-testers data:

http://bbbike.radzeit.de/~slaven/cpantestersmatrix.cgi?dist=PathTools+3.29

-- 
David Cantrell | Nth greatest programmer in the world

Lesbian bigots try to put finger in linguistic dyke:
  http://news.bbc.co.uk/1/hi/world/europe/7376919.stm


Re: What does ord mean?

2009-03-05 Thread David Cantrell
On Thu, Mar 05, 2009 at 01:17:38PM -0600, Bill Stephenson wrote:

 Okay, but now I'm curious. What does ord mean? 
 (or do)

perldoc -f ord

-- 
David Cantrell | Nth greatest programmer in the world

What profiteth a man, if he win a flame war, yet lose his cool?


Re: Adding to @INC

2009-01-07 Thread David Cantrell
On Wed, Jan 07, 2009 at 03:30:59PM +, Adam Witney wrote:
 On 7 Jan 2009, at 15:24, Vic Norton wrote:
 I plan to use CPANPLUS to install new packages and modules. Right  
 now it installs them in
  /opt/local/lib/perl5/site_perl/5.8.8
 This seems like a good place, but how can I add this directory to  
 @INC? I would prefer not having to start every script with
  use lib '/opt/local/lib/perl5/site_perl/5.8.8';
 Try adding this to your ~/.profile
 export PERL5LIB=${PERL5LIB}:/opt/local/lib/perl5/site_perl/5.8.8

Or PERL5LIB=/opt/blahblah:$PERL5LIB, cos you want your own installs to
come first, just like you normally put your own private binaries
directory at the front of your $PATH.

-- 
David Cantrell | Cake Smuggler Extraordinaire

  You know you're getting old when you fancy the
  teenager's parent and ignore the teenager
-- Paul M in uknot


Re: MacPort: how to port perl?

2008-09-09 Thread David Cantrell
On Sun, Sep 07, 2008 at 06:23:13PM -0400, Vic Norton wrote:

 As far as I can tell Perl on a Mac pays absolutely no attention the  
 environmental variable PERL5LIB.

I'm afraid that's not the case:

cowshed-door:~ david$ /usr/bin/perl -e '$,=\n;print @INC'
/sw/lib/perl5
/sw/lib/perl5/darwin
/System/Library/Perl/5.8.6/darwin-thread-multi-2level
/System/Library/Perl/5.8.6
/Library/Perl/5.8.6/darwin-thread-multi-2level
/Library/Perl/5.8.6
/Library/Perl
/Network/Library/Perl/5.8.6/darwin-thread-multi-2level
/Network/Library/Perl/5.8.6
/Network/Library/Perl
/System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.8.6
/Library/Perl/5.8.1


Re: MacPort: how to port perl?

2008-09-09 Thread David Cantrell
On Tue, Sep 09, 2008 at 02:07:58PM +0100, David Cantrell wrote:

 cowshed-door:~ david$ /usr/bin/perl -e '$,=\n;print @INC'
 /sw/lib/perl5
 /sw/lib/perl5/darwin
 /System/Library/Perl/5.8.6/darwin-thread-multi-2level
 /System/Library/Perl/5.8.6
 /Library/Perl/5.8.6/darwin-thread-multi-2level
 /Library/Perl/5.8.6
 /Library/Perl
 /Network/Library/Perl/5.8.6/darwin-thread-multi-2level
 /Network/Library/Perl/5.8.6
 /Network/Library/Perl
 /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level
 /System/Library/Perl/Extras/5.8.6
 /Library/Perl/5.8.1

Ooh, bug in mutt!  That was followed by a line with '.' on its own, and
then a whole load more stuff where I unset PERL5LIB and demonstrated
that @INC changed.

I wonder if I can make it happen again ...



Re: Proposed Mac::Pasteboard

2008-01-29 Thread David Cantrell
On Mon, Jan 28, 2008 at 10:45:56AM -0800, [EMAIL PROTECTED] wrote:

 That seems to argue that I publish Mac::Pasteboard pretty much as is,
 then follow with Mac::Clipboard. It's lazy, but is it lazy _enough_?
 Would it expedite discussion if I put out a pre-release of the code?
 If so, how should it be done? Mail the tarball to people who ask? Post
 to the newsgroup? Submit to CPAN with a development version number? I
 can't guarantee the documentation to be limpid prose, but the code
 works.

Release early, release often, that's what I do.

I note, however, that there is already a Clipboard module that claims to
do the job on OS X.  But the tests don't run properly on OS X.

So *maybe* Mac::Clipboard isn't necessary.

-- 
David Cantrell | London Perl Mongers Deputy Chief Heretic

There are many different types of sausages.  The best are
from the north of England.  The wurst are from Germany.
  -- seen in alt.2eggs...


Re: Leopard Upgrade Killed my Modules

2008-01-10 Thread David Cantrell
On Wed, Jan 09, 2008 at 10:51:03PM -0800, John Baldwin wrote:

 perl 5.9 looks like it has some nice features anyway.

5.10 is out now.  Unfortunately it was just a bit too late to make it
into Leopard.

-- 
David Cantrell | Nth greatest programmer in the world

Eye have a spelling chequer / It came with my pea sea
It planely marques four my revue / Miss Steaks eye kin knot sea.
Eye strike a quay and type a word / And weight for it to say
Weather eye am wrong oar write / It shows me strait a weigh.


Re: bluetooth devices

2007-11-20 Thread David Cantrell
On Tue, Nov 20, 2007 at 06:16:56AM -0600, namotco wrote:

 I've heard of a solution which uses AppleScript (which I don't know),  
 something about reading Apple Events.  But, this doesn't seem like  
 the best solution to me...

Applescript is *never* the best solution.  In fact, it's usually the
worst, coming in after doing it by hand with paper and pencil and
stabbing yourself repeatedly in the crotch.

-- 
David Cantrell | Minister for Arbitrary Justice


Re: Not exactly a Perl question

2007-10-26 Thread David Cantrell
On Fri, Oct 26, 2007 at 08:51:16AM -0400, Robert Hicks wrote:
 Do any of you use use VMWare or Parallels to test your stuff on other 
 distros? Which did you pick to use and why?

I use Parallels for both my CPAN-testers stuff and also for testing my
own code on Linux and FreeBSD.  I also test on Solaris (on a Sparc box)
and NetBSD on Alpha.

I use Parallels because VMware for Mac didn't exist at the time.

I wish that Parallels could run OS X as a 'guest' OS.  That Apple won't
allow virtualisation is bloody annoying.

-- 
David Cantrell | Minister for Arbitrary Justice

You are so cynical.  And by cynical, of course, I mean correct.
 -- Kurt Starsinic


Locale weirdness

2007-10-23 Thread David Cantrell
As some of you may know, I'm one of the cpan-testers.  I recently sent a
test failure for Log-Report-0.11 on OS X.  The author is most puzzled
about what's happening, and once I gave him a guest account he could
play with, he found that ...

 What I found out, is that locale -a says that nl_NL exists, and
 /sw/share/locale/nl/glibc.mo is present.  However,
 
   LANG=nl ls /xx
 
 is still in English.  Don't know why.

This seems rather odd.

Anyone know what's going on?

-- 
David Cantrell | Cake Smuggler Extraordinaire

 Repent through spending


OT: non-perl dependencies (was: Thanks Apple! You snubbed perl yet again!)

2007-10-19 Thread David Cantrell
On Fri, Oct 19, 2007 at 01:06:48PM +0200, [EMAIL PROTECTED] wrote:

All you have to do is call `apt-get  
 update` and you have the new packages with dependency handling built  
 in! (Even better than CPAN's because CPAN's can only handle perl  
 dependecies ...

I'm working on that!

I'm already testing it on OS X, but if anyone has access to some other
proprietary Unix, eg Solaris or Irix, and has perl built with the
proprietary compilers, can you please test Devel::CheckLib for me?

Results from VMS would be good too, although providing them will be
deemed to be a sign that you're also volunteering to contribute the code
to make it work :-)

That will be a partial solution, in that it will at least let people
check whether a non-perl dependency is installed.  I'm going to also
have a go at packaging pkg-config as a module.  Once that's done, that
will hopefully provide a template others can use to bundle other
executables and libraries in a CPAN-friendly manner.

Why choose pkg-config? Cos there's a module that depends on it.

-- 
David Cantrell | Enforcer, South London Linguistic Massive

Computer Science is about lofty design goals and careful algorithmic
optimisation.  Sysadminning is about cleaning up the resulting mess.


Re: Leopard Perl version... @ 1192462023

2007-10-17 Thread David Cantrell
Doug McNutt wrote:
 At 15:29 +0100 10/16/07, David Cantrell wrote:
 The one I'm most looking forward to is perl being relocatable.  Current
 versions of perl have the values for @INC hard-coded into the binary at
 compile-time.
 
 You can add to @INC in perl 5 by defining an environment variable PERL5LIB..

It means a lot more than just doing that.  You can't use PERL5LIB to
*remove* things from the search path.

-- 
David Cantrell | Minister for Arbitrary Justice

Please stop rolling your Jargon Dice and explain the problem
you are having to me in plain English, using small words.
  -- John Hardin, in the Monastery


Re: PerlObjCBridge

2007-10-17 Thread David Cantrell
macshaggy wrote:

 I can't wait for Leopard, but I'm going to have to since I can't
 afford to spend the money on it next week.

I can wait for it, because I always like to let other people test an OS
before I use it :-)

-- 
David Cantrell | http://www.cantrell.org.uk/david

You can't judge a book by its cover, unless you're a religious nutcase


Re: Leopard Perl version...

2007-10-16 Thread David Cantrell
On Sun, Oct 14, 2007 at 11:32:09AM -0700, Edward Moy wrote:

So software updates are restricted to keep the size down.   
 Because most users do not use the command-line or develop software,  
 updates to command-line programs never make the cut (developer  
 software has it own update channel).

This makes perfect sense.

Is it possible to add this seperate channel to Software Update?

-- 
header   FROM_DAVID_CANTRELLFrom =~ /david.cantrell/i
describe FROM_DAVID_CANTRELLMessage is from David Cantrell
scoreFROM_DAVID_CANTRELL15.72 # This figure from experimentation


Re: Is there a True Boolean type in Perl?

2007-10-16 Thread David Cantrell
On Mon, Oct 15, 2007 at 01:27:26PM -0700, Michael Barto wrote:

 As both Java and Javascript both have a 'true' and 'false' or Boolean 
 data type, is there any interest in evolution of Perl to have a true 
 Boolean. Or what is the preferred method to do this in Perl.

The place to discuss this is the perl5-porters mailing list, not an
obscure platform-specific mailing list.

And the answer is no.  Because we already have a real Boolean.  We have
boolean *context*.  An operator like ?: forces its first operand to be
evaluated in boolean context:

$value ? 'true' : 'false'

That first operand can, of course, be a complex expression, the end
result of which is evaluated in boolean context:

cheezburger-{$cutecat}-() ? print LOL! : print OH NOES!

We also don't have int or float or a numeric type (the internals do, but
Perl the language doesn't) - we have numeric context.  Consider this:

$ perl -e 'print foo\n if 2abc == 2def'

The == operator forces both its operands to be evaulated in numeric
context before comparing them.  As numbers, 2abc and 2def are both just
plain ol' 2, so the == returns true and we print.  If we change it to
this:

$ perl -e 'print foo\n if 2abc eq 2def'

then the eq operator evaluates its operands in string context, where
2abc and 2def most definitely aren't the same.

 The C programmers want me to use 0's and 1's.

Seems reasonable.  Those do evaluate to false and true in perl.  Perl's
comparison operators return 1 for true and the empty string for false.
In numeric context that's the same as returning 1 and 0 because:

'' == 0

-- 
David Cantrell | Hero of the Information Age

   When a man is tired of London, he is tired of life
  -- Samuel Johnson


Detecting OS X version from perl

2007-10-14 Thread David Cantrell
Is there any simple way that people can think of to detect which major
version of OS X my perl code is running on?

ie whether it's 10.0, 10.1 etc, I don't care about the difference
between 10.3.3 and 10.3.4.

-- 
David Cantrell | Hero of the Information Age

I caught myself pulling grey hairs out of my beard.
I'm definitely not going grey, but I am going vain.


Re: Detecting OS X version from perl

2007-10-14 Thread David Cantrell
On Sun, Oct 14, 2007 at 10:45:30AM -0700, Edward Moy wrote:

 % perl -e 'chomp($vers = `sw_vers -productVersion`); print $vers\n'
 That will get you either 10.x or 10.x.y.  You just need to strip off  
 the .y if it is there.

Perfect, thanks!

-- 
David Cantrell | Nth greatest programmer in the world

The whole aim of practical politics is to keep the populace alarmed
 (and hence clamorous to be led to safety) by menacing it with an
 endless series of hobgoblins, all of them imaginary  -- H. L. Mencken


Re: Leopard Perl version...

2007-10-13 Thread David Cantrell
On Sat, Oct 13, 2007 at 08:51:52PM +0200, [EMAIL PROTECTED] wrote:

 (5.10 is rumored to be frozen too, but don't hold your breath. :^) )

It isn't.  Raphael was still applying patches earlier today.

-- 
David Cantrell | Reality Engineer, Ministry of Information


Re: Problem with installing DBD::MySQL (Mac OS X 10.4.10)

2007-09-20 Thread David Cantrell
Anthony Armstrong wrote:

 I attempted to install DBD::MySQL from the CPAN repositories. I received
 a ton of errors seen below:
 
 Can't exec mysql_config: No such file or directory at Makefile.PL line
 76.

Find mysql_config and put it in the $PATH, either by modifying $PATH or
creating a symlink to it in the $PATH.

-- 
David Cantrell | top google result for topless karaoke murders

  You know you're getting old when you fancy the
  teenager's parent and ignore the teenager
-- Paul M in uknot


BUG: strange behaviour with 'use open IN = :byte'

2007-09-17 Thread David Cantrell
On Sat, Sep 15, 2007 at 02:44:27PM +0200, [EMAIL PROTECTED] wrote:

 If I run this script:
 #!/usr/bin/perl
 use open IN  = :byte;
 use constant A = 1;
 
 on a MacBook Pro (Intel) with perl version 5.8.6 (the pre-installed) I
 get this error:
   Can't locate constant.pm in @INC  ...
 
 if I change the line to:
 use open IN  = :encoding(UTF16-BE);
 
 I get this error:
   Unrecognized character \xE0 at /System/Library/Perl/5.8.6/constant.pm line 
 1.

I get similar with 5.8.7 and 5.9.5 on NetBSD/Alpha, and 5.10.0 patch 31863
on Solaris/SPARC.  Congratulations, it looks like you've found a bug in
perl!

 In both cases:
 If I swap the lines, everything runs smoothly.

Same here. I've CCed p5p on this mail.

-- 
David Cantrell | A machine for turning tea into grumpiness

There's a hole in my bucket, dear Liza, dear Liza.
WHAT MAKES YOU SAY THERE IS A HOLE IN YOUR BUCKET?


Re: Speaking of support for Camel Bones

2007-05-08 Thread David Cantrell

Sherm Pendley wrote:

On May 8, 2007, at 5:23 PM, Bruce Van Allen wrote:

I think we can confidently answer the Benefits to the Perl Community
issue.
That's my biggest concern. CB is mostly of use to the subset of the  
community who are using Macs, and need to write GUI apps. My concern  is 
whether that's a big enough subset to warrant a grant.


They've sponsored some projects with *very* small audiences in the past, 
such as pVoice.  I'm sure that Camelbones's audience outweighs pVoice's 
by at least a couple of orders of magnitude - although helping trendy 
Mac users is less press-worthy than helping disabled people.


--
David Cantrell | Hero of the Information Age

More people are driven insane through religious hysteria than
by drinking alcohol.-- W C Fields


Re: CamelBones: Will hack for food!

2007-05-07 Thread David Cantrell
On Sun, May 06, 2007 at 08:25:49PM +0100, Alex Robinson wrote:

   Why did the OS X loving bit of 
 the perl community sit by and let PyObjC become the default bridge. 

Because the vast majority of perl people who moved to OS X did so
because it was Unix That Worked On A Laptop and not because it was Mac.
Too many of us still sneer at anything non-Unix.

-- 
David Cantrell | Enforcer, South London Linguistic Massive

I apologize if I offended you personally,
I intended to do it professionally.
-- Steve Champeon, on the nanog list


Re: Getting all file paths

2007-03-26 Thread David Cantrell
On Fri, Mar 23, 2007 at 10:25:54AM -0500, Daniel T. Staal wrote:
 On Fri, March 23, 2007 7:52 am, [EMAIL PROTECTED] said:
  #!/usr/bin/perl -w
 I normally see 'use warnings;' listed instead of the -w switch, but that's
 mostly preference.

'use warnings' doesn't work in 5.005.

Obviously this isn't an issue if you're only ever working on OS X, but
needlessly restricting your code to particular versions of perl is a bad
habit to get in to, because you *will* get bitten by it if you share
your code with other people.

-- 
David Cantrell | top google result for internet beard fetish club

There are many different types of sausages.  The best are
from the north of England.  The wurst are from Germany.
  -- seen in alt.2eggs...


Re: Interacting with other applications

2007-03-23 Thread David Cantrell
On Thu, Mar 22, 2007 at 05:55:18PM -0400, Sherm Pendley wrote:
 On Mar 22, 2007, at 1:01 PM, Andrew Brosnan wrote:
 I'd like to run a daily backup script on my laptop, but I'd like it to
 ask permission first. I'm wondering what is the best way to do this.
 First off - can you always depend on a user being logged in? If so,  
 the simplest ideas tend to be the best. For a full-blown GUI app I'd  
 use CamelBones, but for a simple OK/Cancel dialog the old MacPerl  
 module is still the easiest:
 
   #!/usr/bin/perl
   use MacPerl;
   my $verify = MacPerl::Answer('Do you want to run backups?', 'OK',  
 'Cancel');
   print $verify, \n;

Consider what happens if I'm busily typing away, and the dialogue box
pops up and grabs focus, and then whatever its default is gets selected
because i hit space or enter.  So not only have you annoyed me by
popping something up and then removing it before I get a chance to read
it, you'll now take an action without the user knowing about it but on
the assumption that he does, *and* you've eaten an arbitrary amount of
what I typed, which I'll have to type again.

Needless to say, this is a Very Bad Idea.

-- 
David Cantrell | Nth greatest programmer in the world

It's my experience that neither users nor customers can articulate
what it is they want, nor can they evaluate it when they see it
-- Alan Cooper


Re: CamelBones on MySpace

2007-01-17 Thread David Cantrell
On Wed, Jan 17, 2007 at 08:02:40PM +0100, kurtz le pirate wrote:
 In article [EMAIL PROTECTED],
  [EMAIL PROTECTED] (Sherm Pendley) wrote:
  Well, I've finally given into peer pressure and created a MySpazz  
  account and CamelBones group:
  http://www.myspace.com/camelbones
 is the music essential ?

Given that the whole point of myspace is to be a ghetto for all the
least tasteful websites in the world - it absolutely is essential.
Without music (and preferably badly MIDIed music at that) his account
will be revoked.

-- 
David Cantrell | A machine for turning tea into grumpiness

  While researching this email, I was forced to carry out some
  investigative work which unfortunately involved a bucket of
  puppies and a belt sander
-- after JoeB, in the Monastery


Re: How to know if a module is installed

2006-09-27 Thread David Cantrell
On Thu, Sep 28, 2006 at 12:00:34AM +0900, Nobumi Iyanaga wrote:

 This is a newbie question: how can I determine if a specific module  
 is installed on a client machine?

if(eval use Whatever::Module) {
do this;
} else {
do that;
}

-- 
David Cantrell | Reality Engineer, Ministry of Information

EIN KIRCHE! EIN KREDO! EIN PAPST!


Re: Upgrading Perl 5.8.8

2006-09-26 Thread David Cantrell
On Mon, Sep 25, 2006 at 07:27:54PM -0400, Robert Hicks wrote:

 I know that Tiger comes with 5.8.6 but I would like to get 5.8.8 up and 
 running.
 I am just wondering if I should:
 a) download and compile Perl myself and replace the Tiger version

Don't do that.  It's possible (unlikely, I'll admit) that that will
break some of Apple's stuff, or that your nice shiny new 5.8.8 might get
downgraded by Software Update at some point.

 b) use macports (aka darwinports) to install 5.8.8 in /opt

Do that - or build your own and put it in /usr/local or similar.

-- 
David Cantrell | top google result for topless karaoke murders

If I could read only one thing it would be the future, in the
entrails of the bastard denying me access to anything else.


Re: Perl Module Installation

2006-08-24 Thread David Cantrell
On Thu, Aug 24, 2006 at 05:00:56PM +0100, Mois?s Chicharro wrote:

 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?

Yes, and it would make sense to you too if you bothered reading it.
Which part of Warning: You do not have permissions to install into
/usr/local/man/ is so difficult to understand?

Run the CPAN shell as root as all will be well.

-- 
David Cantrell | Benevolent Dictator Of The World

  On the bright side, if sendmail is tied up routing spam and pointless
  uknot posts, it's not waving its arse around saying root me!
  -- Peter Corlett, in uknot


Re: Mac Perl bug?

2006-07-19 Thread David Cantrell
On Wed, Jul 19, 2006 at 12:29:04AM +0200, ende wrote:

 Why?
 
 $a = 1  2 3;
   1  2 3
 split / /, $a;
   [1, , 2, 3]
 split  , $a;
   [1, 2, 3]

Splitting on / / is different from splitting on   because   is
magickal.  While this is mentioned in the docs for split(), it could
perhaps be written somewhat better.

-- 
David Cantrell | Enforcer, South London Linguistic Massive

Are you feeling bored? depressed? slowed down?  Evil Scientists may
be manipulating the speed of light in your vicinity.  Buy our patented
instructional video to find out how, and maybe YOU can stop THEM


Re: Odd 'head' problem

2006-06-15 Thread David Cantrell
On Thu, Jun 15, 2006 at 09:49:54AM -0400, Sherm Pendley wrote:
 On Jun 15, 2006, at 7:43 AM, Dennis Putnam wrote:
 Thanks, for letting me know I am not nuts. Unfortunately, I've  
 already replaced the wrong one with the right one. I guess I need  
 to get the perl version from somewhere so I can rename it.
 It's just a symlink to /usr/bin/lwp-request. You don't need it. Just  
 use 'lwp-request -m HEAD' instead, if you need to do an HTTP HEAD  
 request in a shell script.

Presumably you can create a HEAD alias in your shell and, the shell
being case-sensitive, avoid the problem.

-- 
David Cantrell | A machine for turning tea into grumpiness

IMO, the primary historical significance of Unix is that it marks the
time in computer history where CPUs became so cheap that it was possible
to build an operating system without adult supervision.
 -- Russ Holsclaw in a.f.c


Re: Waiting until Acrobat closes file

2006-05-28 Thread David Cantrell

Joel Rees wrote:

Except, of course, this is Unix, and we have i-nodes, and the system 
knows how to hold onto a file until all links are gone, as I recall.


Ergo, just delete it once you know the viewer has it open, IIRC.


Which is fine, but if you use 'open' to fork off and run Acrobat in 
parallel with your program, then at the moment system() returns you do 
*not* know that it has safely grabbed hold of the file.  You don't even 
know that it has when you see Acrobat appear in the process table.


--
David Cantrell | http://www.cantrell.org.uk/david

Eye have a spelling chequer / It came with my pea sea
It planely marques four my revue / Miss Steaks eye kin knot sea.
Eye strike a quay and type a word / And weight for it to say
Weather eye am wrong oar write / It shows me strait a weigh.


Re: Waiting until Acrobat closes file

2006-05-27 Thread David Cantrell
On Sun, May 28, 2006 at 12:27:02AM +0200, Tommy Nordgren wrote:

 My perl script generates pdf files, and opens them with Acrobat.
 How can I wait until Acrobat closes the file, so I can delete it?

system('acroread', 'myfile.pdf');
unlink('myfile.pdf');

if instead you're doing something like ...

system('open', '/Applications/Acrobat.app');

then you'll need to:

wait around until Acrobat appears in the process table;
wait around until that PID disappears;

Check out Mac::Processes on the CPAN.

-- 
David Cantrell | random organic glop and a metric fuckton of electricity

Wow, my first sigquoting! I feel so special now!
-- Dan Sugalski


Re: Formatting uploaded images

2006-02-16 Thread David Cantrell
On Thu, Feb 16, 2006 at 04:56:10PM +1100, John Horner wrote:

 Nobody's yet mentioned the Image::Size module?

If installing a module is hard, then it doesn't seem sensible to advise
using a different module!

 That's what I'd use before I went poking about in the bytes of a JPEG.

I'd grovel about in the guts of that module and extract the code I need.

-- 
David Cantrell | Hero of the Information Age

fdisk format reinstall, doo-dah, doo-dah;
fdisk format reinstall, it's the Windows way


Re: eval a string with a hash ref?

2005-11-14 Thread David Cantrell
On Sun, Nov 13, 2005 at 03:22:25PM -0600, Ken Williams wrote:

 Because he doesn't have methods, he has functions.  They're expecting 
 one argument, the hash ref, not an additional $self or $class argument 
 at the beginning.  In order to use this solution he'd have to retool 
 his entire code base of functions to make them methods instead.

It's entirely possible to write your subroutines so that they'll work
just fine as either functions *or* class methods *or* instance methods.
The code is a bit ghastly though, and I don't recommend it.  In fact,
I'm taking that particular breed of insanity out of one of my modules
that is on the CPAN.  Thankfully, I never documented that they could be
called as functions, and so I don't feel that I shuold care if their
removal breaks anything :-)

-- 
David Cantrell | Nth greatest programmer in the world

One person can change the world, but most of the time they shouldn't
-- Marge Simpson


Re: Send authenticated mail with MIME::Lite

2005-11-11 Thread David Cantrell
On Thu, Nov 10, 2005 at 09:43:08AM +, Carl Franks wrote:

 Mail::Sender handles sending via authenticated smtp.

As does MIME::Lite 3.01_04.  That is, however, marked as being a
developer release, and the CPAN testers results are ... not good.

Y'know, I'm sure that the same question was asked just a couple of weeks
ago on one of the many lists I subscribe to.  But I can't remember which
list, or who by.

-- 
David Cantrell | Nth greatest programmer in the world

  When one has bathed in Christ there is no need to bathe a second time
  -- St. Jerome, on why washing is a vile pagan practice


Re: How to find out if an application is running

2005-10-13 Thread David Cantrell
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.

-- 
David Cantrell | Benevolent Dictator Of The World

Eye have a spelling chequer / It came with my pea sea
It planely marques four my revue / Miss Steaks eye kin knot sea.
Eye strike a quay and type a word / And weight for it to say
Weather eye am wrong oar write / It shows me strait a weigh.


Re: build problems with metadata...

2005-10-07 Thread David Cantrell
On Fri, Oct 07, 2005 at 06:25:10PM +0100, William Ross wrote:

 (in which Tiger's newly metadata-enabled command line apps, such as  
 tar, silently add files like ._Makefile.PL to get around apple's  
 complete failure to put together a coherent strategy for managing  
 file information, which MakeMaker sensibly tries to run, and fails.  
 See eg http://caseywest.com/journal/archives/004393.html)

Death to Apple!

 I'm reluctant to install Gnu tar. I imagine that Apple is about to do  
 something that relies on tar unpacking metadata. Is that silly of me?  

If you leave the system tar(1) alone, and install GNU tar elsewhere (eg
in /sw if you use fink) *and* if you don't edit any system config stuff
like $PATHs, just edit your own $PATH in your .bash_whatever files to
put GNU tar first in your $PATH, then you *should* be OK.  Treat it as
you would perl, where you would install your own perl build and leave
Apple's own perl well alone.

-- 
David Cantrell | Hero of the Information Age

  I remember when computers were frustrating because they did
  exactly what you told them to.  That seems kinda quaint now.
  -- JD Baldwin, in the Monastery


Re: James J Stadler/US/DNY is out of the office.

2005-06-08 Thread David Cantrell

[EMAIL PROTECTED] wrote:


I will be out of the office starting  06/04/2005 and will not return until
06/11/2005.


I wonder if this guy is always stupid enough to send auto-replies to 
mailing lists, or if we've been singled out for special treatment.


--
David Cantrell | http://www.cantrell.org.uk/david

  VerisignRapesPuppiesForFunAndProfit.com -
 it must be true, I saw it on their website!


Re: ActiveState is announcing support for Mac OS X

2005-06-08 Thread David Cantrell

Lola Lee wrote:

David Cantrell wrote:

John Delacour wrote:

Getting CPAN to behave is also a black art.

I wonder what you're doing wrong, then.
I'm not the only one.  There's a couple modules that I haven't been able 
to get to compile lately, such as WebService::GoogleHack, and I don't 
know why it's not working. Yes, I entered the google key and the paths, 
but the tests tell me nothing except that it failed.


I'd be inclined to think that the module author has screwed up, rather 
than that CPAN is at fault.


--
David Cantrell | top google result for internet beard fetish club

I often think that if we Brits had any gratitude in our hearts, we
would put up a statue to Heinz Guderian - who probably saved us from
ruin by booting our Army off the continent before we could do
ourselves real harm.
   -- Mike Stone, in soc.history.what-if


Re: Problem with Encoding

2005-02-18 Thread David Cantrell
John Delacour wrote:
At 7:32 pm +0100 17/2/05, Philippe de Rochambeau wrote:
I am trying to convert MacRoman encoded text to iso-8859-1...
The input file, data.txt contains the following string:
Les éléphants sont arrivés. EURO
First of all iso-8859-1 does not contain the Euro sign.  The character 
set you probably intend is Windows-1252
No he doesn't, he wants iso-8859-15
--
David Cantrell | Reality Engineer, Ministry of Information
WARNING! People in front of screen are stupider than they appear
-- Tanuki the Raccoon-dog, in the Monastery


Re: Problem with Encoding

2005-02-18 Thread David Cantrell
John Delacour wrote:
At 12:33 pm + 18/2/05, David Cantrell wrote:
First of all iso-8859-1 does not contain the Euro sign.  The 
character set you probably intend is Windows-1252
No he doesn't, he wants iso-8859-15
I doubt it very much
If he says he wants ISO 8859 1 and he says he wants the Euro sign, then 
he wants ISO 8859 15 which is identical to 8859 1 but with the generic 
currency symbol replaced with the Euro symbol, and a few rarely used 
characters replaced with slightly less rarely used letters.

  but you seem to have inside information.
That's funny, so do you when you claim he probably intends some odd 
proprietary Microsoft thing from their legacy Windows operating 
system.  Using that is dangerous both because whether the euro character 
is present in the character set depends on which version of windows-1252 
you use, and also because software support for it is poor.

 #!/usr/bin/perl -w
 use Encode;
 $euro = \x{20ac};
 $mac = encode(MacRoman, $euro);
 $cp1252 = encode(cp1252, $euro);
 $latin9 = encode(iso-8859-15, $euro);
 print $mac $cp1252 $latin9;
That prints a capital-U with circumflex (I think, it's hard to see), 
followed by two spaces, followed by a Euro symbol, proving my point 
rather elegantly.  Thankyou!

--
David Cantrell | Reality Engineer, Ministry of Information
 If I was made in God's image, does that
 make God a grouchy unshaven pervert?


Re: Problems with Spidering Hack #56

2005-01-15 Thread David Cantrell
Morbus Iff wrote:
I'm working on my knowledge of Perl by working through Spidering Hacks 
(O'Reilly).  Right now I'm stumped as to why this hack isn't working 
(code can be found at http://hacks.oreilly.com/pub/h/981#code.
Besides this bug, how's the book? :)
Judging by the random scattering of 'single' and double quotes in the 
original post - not worth buying.

--
David Cantrell | Official London Perl Mongers Bad Influence
Taking over the world, one zombie cyborg kitten at a time


Re: Trying to reinstall Apache mod_perl

2004-11-11 Thread David Cantrell
On Wed, Nov 10, 2004 at 10:16:59PM -0500, Sherm Pendley wrote:
 On Nov 10, 2004, at 10:01 PM, David Dierauer wrote:
 You need to somehow restore the head command that was installed with
 your version of OS X. I'm not sure of the best way to accomplish this, 
 and
 I don't know if it's the best way or not, but I'd use Pacifist 
 http://www.charlessoft.com to extract it from the install media.

I'd ask someone on here with exactly the right version of OS X to email
me a copy.

-- 
David Cantrell | Benevolent Dictator Of The World

   Norton Wipe Info uses hexadecimal values to wipe files.  This
provides more security than wiping with decimal values. 
-- from the manual of Norton Systemworks 2002, pg 160


Re: Installing new(er) perl on Jaguar

2004-11-03 Thread David Cantrell
On Tue, Nov 02, 2004 at 06:05:05PM -0500, Sherm Pendley wrote:

 Read the instructions that come with Perl - readme.macosx.
 
 Build and install the new Perl using the default layout. This will 
 install everything under /usr/local. Remove /usr/bin/perl and replace 
 it with a symbolic link to /usr/local/bin/perl.

I do *not* advise removing the perl that comes with OS X.  Or indeed
building your own version of any part of the system and replacing it, on
any OS.  Vendor updates will not have been tested with your version.

Instead, install perl in /usr/local/, and make sure that that comes
first in your path.

-- 
David Cantrell | http://www.cantrell.org.uk/david

 Pressure was growing last night for the global war on terror to be
 broadened to take in a wide range of other 'rogue emotions' including
 horror, shock and a general feeling of bewilderment about the state of
 the world.-- The Brains Trust


Re: Installing new(er) perl on Jaguar

2004-11-03 Thread David Cantrell
On Wed, Nov 03, 2004 at 11:50:07AM -0500, Sherm Pendley wrote:
 On Nov 3, 2004, at 6:42 AM, David Cantrell wrote:
 I do *not* advise removing the perl that comes with OS X.
 Neither did I. There's a big difference between removing perl and 
 changing which perl is the default.
 I suggested removing /usr/bin/perl, which by default is just a link to 
 /usr/bin/perl5.6.1.

Ah, OK.  I didn't know that was just a link.

 Instead, install perl in /usr/local/, and make sure that that comes
 first in your path.
 That's fine for scripts that you run from a shell, with perl 
 scriptname.pl. Do you run many of your scripts that way? I certainly 
 don't. Most of my scripts depend on the first #! line to choose a Perl.

And for me, that first line is always #!/usr/local/bin/perl.  I'm trying
to train myself to use #!/usr/bin/env perl instead.

-- 
David Cantrell | http://www.cantrell.org.uk/david

Every normal man must be tempted at times to spit on his hands,
 hoist the black flag, and begin slitting throats. -- H. L. Mencken


Re: Getting started with Perl OSX

2004-11-02 Thread David Cantrell
On Tue, Nov 02, 2004 at 04:25:12AM -0500, Paul G. Hackett wrote:
 Quoting David Cantrell [EMAIL PROTECTED]:
 The one about (C|C++|Objectionable C) and (Cocoa|Carbon|Coelocanth)
 might help.  It's on my bookshelf, but I've not used it much
 you couldn't be a *little* more specific about that book, could you?
 Title, author, etc ...?

Seeing that you asked so sweetly :-)

ISBN 0-596-00161-4

-- 
David Cantrell | http://www.cantrell.org.uk/david

  Longum iter est per praecepta, breve et efficax per exempla.
  -- Seneca


Re: Getting started with Perl OSX

2004-11-01 Thread David Cantrell
Albert Kaltenbaeck wrote:
Are there any good books on Perl for OSX?
Lots of books on Perl but OSX Specifically?
The only reason you might want one that is specifically about perl on OS 
X is if you want to do Cocoa (or is it Carbon  - one of those stupid 
names) development.  And for that there's no book so you're stuffed anyway

The one about (C|C++|Objectionable C) and (Cocoa|Carbon|Coelocanth) 
might help.  It's on my bookshelf, but I've not used it much because 
every time I try to use Project Builder or Interface Builder they make 
me want to eviscerate everyone at Apple with rusty blades.

[aside: Apple guys - just copy the interface from VB 3]
--
David Cantrell | http://www.cantrell.org.uk/david
May your blessings always outweigh your blotches!
-- Dianne van Dulken,
   in alt.2eggs...


Re: Installing modules on osX 10.3.3

2004-06-13 Thread David Cantrell
Phil Calvert wrote:
 I been trying to do hack no. 8 from the O'Reilly book Spidering 
Hacks but keep getting hung-up.

 I enter the line sudo perl -MCPAN -e 'install libwww-perl' and 
things seem to go well for a while but then it gets stuck at:

 CPAN: Storable loaded ok
 Going to read /Users/thatsme/.cpan/Metadata
  Database was generated on Tue, 08 Jun 2004 19:34:06 GMT
 Warning: Cannot install 0, don't know what it is.

That's because your perl program (the bit in quotes following the -e) is:
  install libwww-perl;
The hyphen is being interpreted as a minus operator.  Strings like 
libwww and perl are interpreted as being zero in numeric context, so 
that becomes 0 minus 0, which is 0.  So you're telling it to install 0.

The fix is to fiddle a bit with the quoting to ensure that libwww-perl 
is interpreted as one string:
  sudo perl -MCPAN -e 'install libwww-perl'

As sherm points out, without the extra quotes some modules install just 
fine, like Foo::Bar.  There's no mathemagical operator in there, so perl 
assumes that you meant it as a string, and so Does The Right Thing.

If you'd turned on warnings and strictness like so:
  perl -MCPAN -Mstrict -Mwarnings -e ...
you would have got some rather more useful error messages!
O'Reilly are good at putting errata on their web site, so you really 
should report this to them.  I just checked and it doesn't appear that 
this one has been reported yet.

--
David Cantrell | Official London Perl Mongers Bad Influence


Re: Installing modules on osX 10.3.3

2004-06-13 Thread David Cantrell
On Sun, Jun 13, 2004 at 11:49:10AM -0700, Phil Calvert wrote:

 But when I type in this;
   sudo perl -MCPAN -e 'install libwww-perl'
 I get this;
 
 Password:
 CPAN: Storable loaded ok
 Going to read /Users/philcalvert/.cpan/Metadata
   Database was generated on Sun, 13 Jun 2004 02:36:54 GMT
 Warning: Cannot install libwww-perl, don't know what it is.

libwww-perl is, IMO, badly named and badly packaged.  It's the same as
Bundle::LWP.

-- 
David Cantrell | Reality Engineer, Ministry of Information

  All praise the Sun God
  For He is a Fun God
  Ra Ra Ra!


Re: Sort by Mod Date

2004-05-14 Thread David Cantrell
On Thu, May 13, 2004 at 07:22:38PM -0500, Ken Youens-Clark wrote:

 The File::Find module can be a little cryptic, so you might be
 interested to look at Randal Schwartz's File::Finder module ...

Or Richard Clamp's File::Find::Rule.

-- 
David Cantrell |  Degenerate  | http://www.cantrell.org.uk/david

  With ... the fact that Linux has become so easy to install that
  certain species of bacteria are now being hired by MIS departments,
  what was once the domain of rigorously trained, highly specialized
  professionals has devolved into the Dark Land of the Monkeys.
 -- Greg Knauss


Re: Web servers with cable DSL

2004-03-16 Thread David Cantrell
Morbus Iff 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?
Define commercial grade.

This... this is a touchy subject, I think. I have my own feelings
about it, and they may not be typical. Certainly take them with
a grain of salt - I work at an ISP, and my opinions may be
heavily deluded with you need more than consumer access.
I can understand everything you said even if I don't agree - and I have 
a similar background.

My opinion is thusly:

 * you can do it, yes, but I wouldn't.
I've done it for the past four years on my home DSL, hosting both for 
myself, as well as for other people including some people running 
business web sites.

There are a few factors, really:

 * your dsl/cable provider may restrict you from doing so,
   both from the filtering of web traffic, from the restriction
   of their AUP, or just generically, DSL leases, equipment
   renumbering, and a dynamic static IP (where it's static
   for as long as they want it to be, but they've got no
   contract to continue providing you the same number).
Depends on your contract with the ISP.  I have a handful of static 
publicly routeable addresses, and there is no filtering at all on their 
part.

 * you're not just web serving. you'd also have to find someone
   to wear the security princess hat (ie., you're putting your
   own box on your the web full time - who's handling security?
I do.  There have been no incidents that I am aware of.

how many personal files
   are left on the machine?
Several (all my mail to start with)

 what happens when it goes down?

It stays down until I fix it.  This is not a problem, my users know what 
the score is and if they complain I can delete their accounts so that my 
terrible service is no longer a problem for them.  I have only had to do 
that once.

So far the longest period of downtime was three days, and I am up over 
99% of the time *including* planned maintenance.  This is better than 
some commercial hosting outfits I have had the displeasure of dealing with.

   what's your backup strategy?
rsync to another machine daily, CD backups whenever I feel it's 
necessary. If I lose all the backups at once I've got more important 
things to worry about, like my home being reduced to a pile of ash.

 as well as someone who is
   going to host your zone record.
My ISP

and, what about mail
   for the domain?
What about it?  Running a mail sewer is easy.

The *only* reason that I am now in the process of kicking all the other 
users off the box and moving my own stuff to a hosted machine is because 
it's cheaper to buy bandwidth for my content that way than to get fatter 
DSL.

--
Lord Protector David Cantrell  |  http://www.cantrell.org.uk/david
   Educating this luser would be something to frustrate even the
   unflappable Yoda and make him jam a lightsaber up his arse
   while screaming praise evil, the Dark Side is your friend!.
  -- Derek Balling, in the Monastery


Re: getting in between dates in a hash

2004-02-16 Thread David Cantrell
Joseph Alotta wrote:

I have a hash of data:

%highest_level = ( 2001-10-14 =  152, 2002-01-15 = 163, 2003-03-13 = 
210, 2004-08-07 = 307 );
I think you mean:

%highest_level = (
'2001-10-14' = 152,
'2002-01-15' = 163,
'2003-03-13' = 210,
'2004-08-07' = 307
);
because otherwise the dates will be interpreted as (eg) 2001 minus 10 
minus 14 == 1977.

Bravo for using decent, civilised ISO dates and not those crazy 
little-endian dates (as favoured by silly Europeans) or ridiculous 
middle-endian dates (as favoured by silly .USians)!

And I am give some dates in between:

@dates = ( 2001-12-30, 2002-03-19);
Again, quote the dates.

Am I missing something or is this harder than it first appears?
Aside from the above you're missing the many and varied Date::* modules 
on CPAN which exist to make date and time handling, including 
comparisons like what you need, easy.  I won't say which one to use cos 
that's a religious issue :-)

--
Lord Protector David Cantrell  |  http://www.cantrell.org.uk/david
 Repent through spending


Re: tricky parsing question

2004-01-23 Thread David Cantrell
On Thu, Jan 22, 2004 at 09:28:30PM -0800, wren argetlahm wrote:
 --- Bill Stephenson [EMAIL PROTECTED] wrote:
  You need to get a book on regex's.
 I know the solution lies in regex's

I don't.  I expect the code would be a lot clearer and considerably
quicker if you pull your strings apart using index(), rindex() and
substr().

-- 
David Cantrell |  Degenerate  | http://www.cantrell.org.uk/david

If you have received this email in error, please add some nutmeg
and egg whites, whisk, and place in a warm oven for 40 minutes.


Using challenge-response systems for mailing lists

2004-01-23 Thread David Cantrell
I just received this:

 I am an automated email sentry designed to protect against unwanted email.
 You recently sent an email titled 'Re: tricky parsing question' to 'macosx'.
 ...
 http://www.maxstrengthmail.com/quarantine/release?emailid=112.20040123-050514.001.601258ask=yes
 Just click the checkbox and hit submit, and your mail will be delivered.
 The SPAM conditions that were raised were:
  * SuspiciousMessageContent_001

So who's the idiot using this?  Sensible people *never* reply to such
things, as it is not possible to tell the difference between a stupid
(but non-malicious) user attempting to verify that I am a person, and a
spammer trying to verify that my address really exists and is read.

The policy on the mailing lists I run is that anyone moronic enough to
send such challenges in response to mailing list postings gets
unsubscribed.

-- 
David Cantrell |  Degenerate  | http://www.cantrell.org.uk/david

See the creativity that comes from misery! Without misery people who
would otherwise relax at home with a drink are spurred to great
heights of expression. Art thrives on constraint and unhappiness.
   -- Arp


Re: Using challenge-response systems for mailing lists

2004-01-23 Thread David Cantrell
On Fri, Jan 23, 2004 at 01:44:58PM +, David Cantrell wrote:
 I just received this:
  I am an automated email sentry designed to protect against unwanted email.
  You recently sent an email titled 'Re: tricky parsing question' to 'macosx'.
 ...

Amusingly, this message also triggered the broken software.

-- 
David Cantrell |  Reprobate  | http://www.cantrell.org.uk/david

Never attribute to malice that which can be explained by stupidity
-- Hanlon's Razor

Stupidity maintained long enough is a form of malice
-- Richard Bos's corollary


PDL

2003-12-22 Thread David Cantrell
Has anyone got PDL working on Jaguar?  I have my own perl 5.8 installed 
in /usr/local/ but just about *all* the tests fail.

I also tried installing PDL through fink, but that just moans about not 
being able to find my perl installation when trying to install one of 
the dependencies.

--
Grand Inquisitor David Cantrell | http://www.cantrell.org.uk/david
 Soylent green is purple!  Soylent green is purple!



Re: Executing an Xwindows app from perl on OSX

2003-12-06 Thread David Cantrell
Ari Kahn wrote:
David Cantrell [EMAIL PROTECTED] wrote:
Set the DISPLAY environment variable to something appropriate.
How do I figure out what is an appropriate setting for DISPLAY?
DISPLAY=:0 is almost always the right incantation.  You do, of course, 
need to be running a local X server.

--
David Cantrell | Reality Engineer, Ministry of Information
 Soylent green is purple!  Soylent green is purple!



Re: Executing an Xwindows app from perl on OSX

2003-12-05 Thread David Cantrell
On Thu, Dec 04, 2003 at 08:54:31PM -0500, Ari Kahn wrote:
 I have an Xwindows program (consed) that I would like to execute from perl.
 Of course OSX is not Xwindows so executing it outside of an xwindows
 terminal will not work because I get Error: Can't open display: 
 I need to find a way to somehow tell consed to run in an Xwindows
 environment if the Xwindows server is running.

Set the DISPLAY environment variable to something appropriate.

-- 
David Cantrell |  Degenerate  | http://www.cantrell.org.uk/david

Never attribute to malice that which can be explained by stupidity
-- Hanlon's Razor

Stupidity maintained long enough is a form of malice
-- Richard Bos's corollary


Re: Panther, Perl 5.8.*, threads, etc.

2003-07-16 Thread David Cantrell
On Tuesday, July 15, 2003 6:06 pm -0700 Rich Morin [EMAIL PROTECTED] wrote:

I'm putting together a scheduler to control a slew of soft real time
activities.  That is, there will be all sorts of things going on; some
things may be scheduled as often as once per second, but most won't.
I can think of several ways to implement this, but each seems to have
pluses and minuses:
   *  Spawn a process for each activity.

  I'm quite familiar with this approach, and I like the fact that
  I can set the nice(2) value for each process independently.  I
  don't like the overhead of starting up Perl interpreters, tho...
If you fork() you avoid both that overhead and the overhead of compiling 
your code to bytecode.  And while you can't nice a process that you are 
forking off, you could do something like system(renice $niceness -p $$) 
in the new process.

--
David Cantrell


Re: Panther, Perl 5.8.*, threads, etc.

2003-07-16 Thread David Cantrell
On Wednesday, July 16, 2003 11:58 am -0700 Rich Morin [EMAIL PROTECTED] wrote:
At 7:26 AM +0100 7/16/03, David Cantrell wrote:
If you fork() you avoid both that overhead and the overhead of
compiling your code to bytecode.  And while you can't nice a process
that you are forking off, you could do something like system(renice
$niceness -p $$) in the new process.
Interesting.  The fork(2) man page seems to indicate that forking a
process makes a complete copy of it.  Is this actually the case or is
this some sort of lazy (e.g., copy on write) equivalent?
As far as the program is concerned, it's a complete copy.  But yes, most 
modern virtual memory implementations will, I believe, do copy on write.  I 
haven't actually tested this on OS X though :-)

--
David Cantrell


Re: Panther, Perl 5.8.*, threads, etc.

2003-07-16 Thread David Cantrell
On Wednesday, July 16, 2003 1:15 pm -0700 Rich Morin [EMAIL PROTECTED] wrote:
At 8:33 PM +0100 7/16/03, David Cantrell wrote:
As far as the program is concerned, it's a complete copy.  But yes,
most modern virtual memory implementations will, I believe, do copy
on write.  I haven't actually tested this on OS X though :-)
OK, I'm curious; how _would_ one go about testing this?
Generate a really big data structure in memory.  fork().  sleep for a bit 
so you can see how much memory is used.  Now in one of the processes, 
change all the data.  sleep some more so you have time to see how much 
memory is used.

Not very elegant, I'll admit ;-)

--
David Cantrell


Re: DropScript confusion about cwd

2003-07-11 Thread David Cantrell
On Friday, July 11, 2003 14:14 -0500 Chip Howland [EMAIL PROTECTED] 
wrote:

I think you might be a special case. Not everyone has written Mac::Glue
or maintained MacPerl. If you are claiming that you can do everything
with Perl and Mac::Glue that you can with Applescript, then I won't
dispute you. But don't pretend it's just as easy for a novice.
I too can do everything with Mac::Glue that I can do with Applescript, and 
I wrote neither of 'em.

It matters not that he wrote Mac::Glue.  He's published it, so I can use it 
too.  And I have just as much difficulty with using Mac::Glue as I do with 
using Applescript.  That difficulty is solely because Applescript and all 
its trappings like the events and methods and stuff* that applications 
expose, and how to call them, is so piss-poorly documented that it may as 
well not be documented at all.

* - so badly documented that I don't even know what the correct terminology 
is

--
David Cantrell


Re: [OT] Japanese

2003-06-17 Thread David Cantrell
On Tuesday, June 17, 2003 16:09 +0900 Joel Rees [EMAIL PROTECTED] 
wrote:
Jedit, Java editor.
I've got to try that some time.
Very heavy, very slow, even on my G4-867 with a gig of RAM.  Is claimed to 
support folding in code but I could never get it to work.  I'll take BBedit 
any day, at least until Activestate port Komodo.

--
David Cantrell


Re: Regexp for split

2003-06-10 Thread David Cantrell
On Monday, June 9, 2003 8:20 -0500 Andy Lester [EMAIL PROTECTED] wrote:

my ($col1, $col2) = unpack( A4 X10 A10, $data_record );
perldoc -f pack says that X means back up a byte.  So I suspect your 
pattern is wrong.

This appears to work:

#!/usr/local/bin/perl

use warnings;
use strict;
while(my $datum = DATA) {
my @results = map {
(my $temp = substr($datum, 0, $_)) =~ s/\s+//g;
$datum = substr($datum, $_) if(length($datum) = $_);
$temp;
} (10, 10, 10, 4, 4, 10, 4);
print join(', ', @results).\n;
}
__DATA__
1119  1117  CCCAAAGACA  C  T  CACAGT  5
1 1 A  C  TGTTCTTTCA  4
1394  0 AGCAATAAAC  G  T  3
--
David Cantrell



Re: Learning Perl book, Chapter 1 example: open MAIL, |mail email_address doesn't work

2003-06-05 Thread David Cantrell
On Tuesday, June 3, 2003 20:24 -0700 Richard E. Adams [EMAIL PROTECTED] 
wrote:

I am working through the exercises in Chapter 1 of Learning Perl, Second
Edition, O'Reilly publishers.  I am using MacOS X (10.1.5), and Perl,
v.5.6.0.  An excerpt from one of the author's programs shows the
following three lines:
open MAIL, |mail YOUR_ADDRESS_HERE;
print MAIL bad news: $someone guessed $someguess\n;
close MAIL;
($someone and $someguess have been assigned appropriate values prior to
the above three lines.)
I suspect the above works fine in a typical UNIX environment, e.g.,

open MAIL, |mail [EMAIL PROTECTED];
print MAIL bad news: $someone guessed $someguess\n;
close MAIL;
How can I get the above to work on my Macintosh?  (I don't get an error
message, nor do I receive an email.)  Any help would be greatly
appreciated.
To send mail, you need two components.  A mail client (aka a mail user 
agent or MUA) and an SMTP program (aka a mail transport agent or MTA).  The 
'mail' program is an MUA.  It passes messages to a local MTA for delivery. 
IIRC on OS X the MTA (sendmail) is installed, but not configured, so 'mail' 
successfully hands the message over to sendmail, which then neither knows 
what to do with it, nor knows how to warn you of the fact.

--
David Cantrell
Beekeeping is like being a lion tamer, but
with smaller lions, and more of them.
  -- arp


Re: CPAN/compilation issues

2003-06-05 Thread David Cantrell
On Tuesday, June 3, 2003 20:48 -0500 Christopher D. Lewis 
[EMAIL PROTECTED] wrote:

Dearest and most learned MacOS X / Perl worthies,
We're not worthy! We're not worthy!

I've had problems recently trying to update my Perl modules ... I got a
lot of this sort of thing:
t/06gzdopen.dyld: /usr/bin/perl Undefined symbols:
_Perl_safefree
_Perl_safemalloc
_Perl_sv_2pv
_Perl_sv_catpvn
_perl_get_sv
Did you, perchance, compile and install your own perl from sources without 
diddling the Makefile and what have you?

--
David Cantrell
Beekeeping is like being a lion tamer, but
with smaller lions, and more of them.
  -- arp


Re: perl via Fink

2003-06-03 Thread David Cantrell
On Saturday, May 24, 2003 10:43 -0400 David R. Morrison 
[EMAIL PROTECTED] wrote:

I'm pleased to announce to this list that Fink has been revised to better
cope with the installation of multiple perl versions, and that perl itself
(versions 5.6.0, 5.6.1, and 5.8.0) can now be installed via Fink.
[snip]
I get this:

Unpacking system-perl580 (from 
.../system-perl580_5.8.0-1_darwin-powerpc.deb)  ...
Sorry, your perl is not version 5.8.0.  DO NOT INSTALL THIS PACKAGE.

dpkg: error processing /sw/fink/dists/unstable/main/binary-darwin-powerpc/
  languages/system-perl580_5.8.0-1_darwin-powerpc.deb (--install):
subprocess pre-installation script returned error exit status 255
Errors were encountered while processing:
 /sw/fink/dists/unstable/main/binary-darwin-powerpc/languages/system-
  perl580_5.8.0-1_darwin-powerpc.deb
### execution of dpkg failed, exit code 1
Failed: can't install package system-perl580-5.8.0-1
which is odd, when you consider:

510$ which perl
/usr/local/bin/perl
511$ perl -v
This is perl, v5.8.0 built for darwin

--
David Cantrell
Beekeeping is like being a lion tamer, but
with smaller lions, and more of them.
  -- arp