Re: New Perl-Installation on new OS X

2011-06-09 Thread Vic Norton
I recently installed Fink to see if it had "pdffonts". This conversation has 
scared me; I have uninstalled Fink. I certainly don't want to start looking for 
Perl modules in /sw.

Now I see no PERL5LIB in %ENV. I guess Perl is looking in
  /System/Library/Perl/5.10.0
  /Library/Perl/5.10.0
  /System/Library/Perl/Extras/5.10.0
but I really don't know.

Regards,

Vic


On Jun 9, 2011, at 7:08 AM, Sherm Pendley wrote:

> On Thu, Jun 9, 2011 at 6:43 AM, 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"
>> 
>> I only see two files:
>> 
>>~/.profile
>> 
>> and
>> 
>>~/.tcshrc
> 
> PERL5LIB can be set in either one; which one is executed depends on
> what shell you're using. The current default shell is Bash, which
> reads .profile - at one point in ancient history, the default was
> Tcsh, which reads .tcshrc.
> 
>> in the first file I only have one line:
>> 
>>test -r /sw/bin/init.sh && . /sw/bin/init.sh
> 
> If you haven't changed your default shell, that's the culprit. It
> executes Fink's init.sh script, which exports the PERL5LIB environment
> variable. Again, this behavior goes back a while - they used to think
> it was a good idea for the system Perl to be able to see modules that
> Fink had installed under /sw/lib.
> 
> I haven't used Fink in a while - I switched to MacPorts - but I
> *thought* they stopped doing that after a few Mac OS X releases, each
> with a new version of Perl that disagreed with those modules, showed
> them how problematic that was. If you've been migrating for a while,
> that line in .profile could be a remnant from an old install.
> 
> At any rate, delete (# or comment) that line, exit from the shell
> session and start a new one, and that should clear up your PERL5LIB
> variable.
> 
>> To export the right PERL5LIB, can I add the following line to ~/.tcshrc
>> 
>> set PERL5LIB = (/System/Library/Perl/5.10.0:/Library/Perl/5.10.0)
> 
> That wouldn't accomplish anything - PERL5LIB just adds to the default
> paths, and the above are already in the default.
> 
>> Syntax seems alright, but I have still the /sw path at the beginning:
> 
> Did you log out of the current shell session, and back in? These
> startup files are only processed when you start a new shell session,
> not every time they're changed.
> 
> sherm--
> 
> -- 
> Cocoa programming in Perl:
> http://camelbones.sourceforge.net



What does ord mean?

2009-03-04 Thread Vic Norton
I am confused. I can't figure out what ord does. For example I've  
pasted the NO-BREAK-SPACE (00A0) between the quotation marks in the  
ord of the following line.

   print ord(" "), "\n";
When I run this line in a Perl script I get
   194
What does this 194 mean? As far as I know A0 = 10x16 = 160. And 194  
certainly can't be an octal numeral.


Regards,

Vic



Re: Adding to @INC

2009-01-07 Thread Vic Norton
That is exactly what has happened, Sherm. Thanks a lot. Prior to my  
recent installation of Leopard, I had used MacPorts to install  
Perl5.8.8. So I have 5.8.8 in two places, in /usr/bin and in /opt/ 
local/bin. And /opt/local/bin comes earlier in my PATH than /usr/bin.


I'm going to have to think about this. Thanks for the aside!

Another curiosity. I just checked out the Perl5.8.8 files in /usr/bin  
and /opt/local/bin. The /usr/bin one came with Leopard, which I bought  
from Apple a week or so ago. It was created on Dec 7, 2007, and it  
weighs 48 KB. The MacPorts perl was created on Sep 5, 2008, and weighs  
1.1 MB. Why, I wonder, should one Perl5.8.8 be 25 times as big as  
another?


Regards,

Vic

On Jan 7, 2009, at 3:06 PM, Sherm Pendley wrote:


On Jan 7, 2009, at 10:24 AM, 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


As an aside, I think it's kind of odd that /usr/bin/perl would do  
that... Are you sure there's not an /opt/local/bin/perl earlier in  
your PATH? If you used MacPorts to install a newer Perl, that's  
where it would install it.


sherm--





Re: Adding to @INC

2009-01-07 Thread Vic Norton

Now I realize that
  export PERL5LIB=${PERL5LIB}:/opt/local/lib/perl5/site_perl/5.8.8
is overkill. The lines
  PERL5LIB
  /opt/local/lib/perl5/site_perl/5.8.8
in ~/.MacOSX/environment.plist do it all. Then
  $ENV{PERL5LIB} = "/opt/local/lib/perl5/site_perl/5.8.8"
and "/opt/local/lib/perl5/site_perl/5.8.8" is near the beginning of
@INC.


On Jan 7, 2009, at 11:50 AM, Vic Norton wrote:


Thanks guys! That did the trick. I added
  export PERL5LIB=${PERL5LIB}:/opt/local/lib/perl5/site_perl/5.8.8
to ~/.bash_profile = ~/.bashrc, and I also added
  PERL5LIB
  /opt/local/lib/perl5/site_perl/5.8.8
to my ~/.MacOSX/environment.plist so Mac applications, e.g., BBEdit,  
will also search in the right place.




Re: Adding to @INC

2009-01-07 Thread Vic Norton

Thanks guys! That did the trick. I added
   export PERL5LIB=${PERL5LIB}:/opt/local/lib/perl5/site_perl/5.8.8
to ~/.bash_profile = ~/.bashrc, and I also added
   PERL5LIB
   /opt/local/lib/perl5/site_perl/5.8.8
to my ~/.MacOSX/environment.plist so Mac applications, e.g., BBEdit,  
will also search in the right place.



On Jan 7, 2009, at 10:30 AM, 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


On Jan 7, 2009, at 10:47 AM, Chas. Owens wrote:


OS X 10.5 (or at least my version of 10.5) uses ~/.bash_profile not
~/.profile for user overrides to the default profile (/etc/bashrc).
If this is a multiuser machine and you want the other users to see the
modules as well you can set it in the default profile instead of your
own.

--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.




Adding to @INC

2009-01-07 Thread Vic Norton
I just installed Mac OS X 10.5, and I'm trying to get Perl back up to  
snuff. My current @INC contains only

  /System/Library/Perl/5.8.8/darwin-thread-multi-2level
  /System/Library/Perl/5.8.8
  /Library/Perl/5.8.8/darwin-thread-multi-2level
  /Library/Perl/5.8.8
  /Library/Perl
  /Network/Library/Perl/5.8.8/darwin-thread-multi-2level
  /Network/Library/Perl/5.8.8 /Network/Library/Perl
  /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level
  /System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6
  /Library/Perl/5.8.1/darwin-thread-multi-2level
  /Library/Perl/5.8.1

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';

Thanks for your help.

Vic Norton



Re: MacPort: how to port perl?

2008-09-10 Thread Vic Norton
I guess you are right, Charlie. Apparently each of 3 Perls in my  
system has it's own PERLIB, but a PERL5LIB specification in  
~/.bashprofile will add directories to any of the 3 corresponding  
@INC's.


On Sep 9, 2008, at 10:32 PM, Charlie Garrison wrote:


Good afternoon,

On 9/9/08 at 9:24 PM -0400, Vic Norton <[EMAIL PROTECTED]> wrote:

I'm not sure what this proves, David. I've tried your trick 3  
times and gotten three different answers. And I don't think  
PERL5LIB has anything to do with any of them.


What is the value of your PERL5LIB? From your perl output we can  
see the defaults for @INC, but without knowing the value of  
PERL5LIB it's hard to draw any conclusions.


My experience matches David's; the PERL5LIB variable does work as  
advertised.



Charlie




Re: GET ME OFF THIS GODDAM LIST!

2008-09-10 Thread Vic Norton
If you look at the headers of any message you've received from the  
list, you will see

List-Post:  
List-Help:  
List-Unsubscribe:   
List-Subscribe: 
I suggest you try the third address and quit whining.

- Vic

On Sep 9, 2008, at 10:15 PM, Stephen M. Harris wrote:


-- Forwarded message --
From: Stephen M. Harris <[EMAIL PROTECTED]>
Date: Tue, Sep 9, 2008 at 9:26 PM
Subject: Fwd: Re: MacPort: how to port perl?


GET ME OFF THIS GODDAM LIST!




Re: MacPort: how to port perl?

2008-09-09 Thread Vic Norton
I'm not sure what this proves, David. I've tried your trick 3 times  
and gotten three different answers. And I don't think PERL5LIB has  
anything to do with any of them.


### Test 1 ###
vic$ /usr/bin/perl -e '$,="\n";print @INC,"\n";'
/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/darwin-thread-multi-2level
/Library/Perl/5.8.1
.

### Test 2 ###
vic$ /usr/local/bin/perl5.8.8 -e '$,="\n";print @INC,"\n";'
/usr/local/lib/perl5/5.8.8/darwin-2level
/usr/local/lib/perl5/5.8.8
/usr/local/lib/perl5/site_perl/5.8.8/darwin-2level
/usr/local/lib/perl5/site_perl/5.8.8
/usr/local/lib/perl5/site_perl
.

### Test 3 ###
vic$ /opt/local/bin/perl -e '$,="\n";print @INC,"\n";'
/opt/local/lib/perl5/5.8.8/darwin-2level
/opt/local/lib/perl5/5.8.8
/opt/local/lib/perl5/site_perl/5.8.8/darwin-2level
/opt/local/lib/perl5/site_perl/5.8.8
/opt/local/lib/perl5/site_perl
/opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level
/opt/local/lib/perl5/vendor_perl/5.8.8
/opt/local/lib/perl5/vendor_perl
.

Modules from MacPorts like Cript::SSLeay appear in the vendor_perl  
folder of /opt/local/lib/perl5.


Regards,

Vic

On Sep 9, 2008, at 9:07 AM, David Cantrell wrote:


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-07 Thread Vic Norton

On Sep 7, 2008, at 11:42 AM, David Green wrote:

Do you have an issue of Perl versions here -- 5.8.6 having been  
upgraded to 5.8.8?  I never solved the issue myself; ultimately I  
just stayed with the OS X standard or 5.8.8 and removed MacPorts.   
Would love for some clued in explanations ;)


I can not remember the details of what I was trying but I guess it  
was less important then having a fully 'aware' Perl installation.


David


Hi David,

As far as I can tell Perl on a Mac pays absolutely no attention the  
environmental variable PERL5LIB. I have eliminated all PERL5LIB  
specifications on my machine.


Here are a couple of test scripts that illustrate my point.

Script 1
   [put either shebang line here]

   #!/usr/bin/perl -w
   #!/opt/local/bin/perl -w

   # test1.pl  - Test Perl constructs

   use strict;
   use Date::Format;

Script 2
   [put either shebang line here]

   #!/usr/bin/perl -w
   #!/opt/local/bin/perl -w

   # test2.pl  - Test Perl constructs

   use strict;
   use Crypt::SSLeay;

When I run Script 1, either from Terminal or from BBEdit, nothing  
happens with the top shebang line (Date::Format is in my /usr/bin/ 
perl [5.8.6] tree), but I get an error message listing @INC with the  
bottom shebang line (Date::Format is not in my /opt/local/bin/perl  
[5.8.8] tree).


Just the opposite situation occurs when I run Script 2, either from  
Terminal or from BBEdit. I get an error message listing @INC with top  
bottom shebang line (Crypt::SSLeay is not in my /usr/bin/perl [5.8.6]  
tree), but nothing happens with the bottom shebang line  
(Crypt::SSLeay is in my /opt/local/bin/perl [5.8.8] tree).


I have found no way of running a module in one Perl tree with the  
other version of Perl.


Regards,

Vic



Re: MacPorts: how to port perl?

2008-09-07 Thread Vic Norton

I've solved the problem. The solution was simple.

As David Green suggested I was having a problem with Perl versions.  
The original script started with the shebang line

   #!/usr/bin/perl -w
I was running Perl 5.8.6 here; Crypt::SSLeay could not be found in  
this Perl's libraries. When I switched the shebang line to

   #!/opt/local/bin/perl -w
the corresponding Perl 5.8.8 had no trougle finding Crypt::SSLeay,  
and everything worked fine.


Thanks for your input!

Regards,

Vic


On Sep 7, 2008, at 10:09 AM, Vic Norton wrote:

I want to access https URLs on the web via LPW. To do this I need  
Crypt::SSLeay.


I have not been able to install Crypt::SSLeay directly so I tried  
MacPorts. Everything seemed to go fine, but LPW::UserAgent says  
Crypt::SSLeay is not installed:


   501 Protocol scheme 'https' is not supported (Crypt::SSLeay not  
installed)




MacPort: how to port perl?

2008-09-07 Thread Vic Norton
I want to access https URLs on the web via LPW. To do this I need  
Crypt::SSLeay.


I have not been able to install Crypt::SSLeay directly so I tried  
MacPorts. Everything seemed to go fine, but LPW::UserAgent says  
Crypt::SSLeay is not installed:


   501 Protocol scheme 'https' is not supported (Crypt::SSLeay not  
installed)


I can see Crypt::SSLeay in two places:
   /opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level/Crypt/SSLeay
   /opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level/auto/Crypt/ 
SSLeay

Right now I've got
   PERL5LIB=/Library/Perl/5.8.6:/opt/local/lib/perl5/vendor_perl/ 
5.8.8/darwin-2level
LPW insists Crypt::SSLeay is not installed. I've tried various other  
PER5LIB strings that seemed appropriate. None worked.


How do I get Perl to recognize a Perl module ported via MacPorts? In  
particular, how do I get LPW::UserAgent to see Crypt::SSLeay?


Thanks for any advice you van give me.

Regards,

Vic



Re: CamelBones: Will hack for food!

2007-05-09 Thread Vic Norton
On 5/8/07, at 5:25 PM -0400, Sherm Pendley wrote:
> It's not just in Mac circles either - there's a very widespread  
> misconception that Perl is useful for system admins, web developers,  
> and little else. One thing I find personally frustrating is the  
> corollary, that Perl *programmers* must be admins or web devs.

I'm a "retired" mathematician, myself. I can't even administer my own (iMac) 
system, but I use Perl constantly. I am not particularly interested in Camel 
Bones, but I do use the ShuX application quite often. You had something to do 
with that didn't you, Sherm? I believe I got it from your site.

Regards,

Vic
-- 
*---* mailto:[EMAIL PROTECTED]
| Victor Thane Norton, Jr.
| Mathematician and Motorcyclist
| Bowling Green, OH 43402-2223, USA
| Phone: 419-353-3399 
*---* http://vic.norton.name


Re: pdf2text ?

2007-03-23 Thread Vic Norton
As I mentioned John Delacour's GUI scripting solution will work fine for me. 
However, another approach might work on more complicated PDF documents.

At Shelly Spearing's suggestion I "looked at xpdf". In fact I installed "xpdf" 
and "pdftohtml" via darwinports. Now the command
   pdftohtml somefile.pdf
will produce one or more html documents that I can be accessed with Perl. It 
might be easier to find things in this html code than in text copied from the 
original PDF file.

This is just a thought; I haven't tried it.

Regards,

Vic

On 3/23/07, at 3:52 PM -0700, Avi Rappoport wrote:
> >If all that's needed is to copy the whole text of a pdf window and 
> >put it in a text file, then GUI scripting can be used.
> >
> This will work for some PDF files, but not all.  Some have no text at 
> all (scanned only), and others the text has been generated badly, so 
> a two-column page will have text from column 1, line 1; then column 
> 2, line 1; then column 1, line 2...
> 
> Sigh.
> 
> Avi

On 3/21/07, at 8:07 PM -0600, Shelly Spearing wrote:
> Have you looked at xpdf?
> See
> http://www.foolabs.com/xpdf/
> --Shelly


Re: pdf2text?

2007-03-22 Thread Vic Norton
Thanks to everyone who replied to my query. The GUI script by John Delacour and 
Bruce Van Allen should work fine for my purposes.

Regards,

Vic

On 3/22/07, at 11:37 AM -0700, Bruce Van Allen wrote:

> tell application "System Events"
> set the clipboard to "" -- no spurious clipboard content
> tell process "Preview"
> set frontmost to true
> keystroke "2" using command down -- use text Tool
> keystroke "a" using command down
> delay 1 -- or longer for large docs 
> keystroke "c" using command down
> end tell
> end tell
> set _text to the clipboard
> do shell script "cd; pbpaste > trash.txt; open -a bbedit trash.txt"


pdf2text ?

2007-03-21 Thread Vic Norton
What is a good package for extracting text from a PDF file? For example I get 
monthly PDF reports from E*Trade, an online broker. It would be very convenient 
if I could access this data from Perl. Right now, I can extract data by copying 
and pasting into a text file, but I'd like a more efficient (and automatic) 
method.

Thanks for any ideas you may have.

Regards,

Vic


Re: @INC problem

2007-02-22 Thread Vic Norton
On 2/22/07, at 7:27 PM -0500, Sherm Pendley wrote:
> Possibly, someone replaced all your scripts #!/usr/bin/perl with #!/ 
> usr/local/bin/perl. Maybe you did that to test them against the newer  
> Perl and forgot to change it back, or maybe someone in your house has  
> a strange sense of humor. :-)

I don't have that strange a sense of humor, Sherm, and I'm the only one in the 
house who works with Perl. The bang lines on my problematic test routines all 
read "#!/usr/local/bin/perl" and the bang lines on good routines read 
"#!/usr/bin/perl". I think my computer may be infected with gremlins.

I've changed everything to read "#!/usr/bin/perl" and now everything works. 
Thanks so much for your help! Unfortunately most of this system stuff is a 
mystery to me.

Regards,

Vic


@INC problem

2007-02-22 Thread Vic Norton
Apple suggested I install something the other day. (Java or something like 
that.) I did it. Now I discover that many of my Perl scripts don't work.

The problem is with @INC. It appears to have been upgraded to Perl 5.8.8. For 
example, when I try
   use Date::Parse qw(str2time);
I get the message
   /Volumes/VTN Docs/ My Perl/Tests/test5.pl:6: Can't locate Date/Parse.pm in 
@INC
followed by a list of what @INC contains:
   /Volumes/VTN Docs/ My Perl/Tests
   /usr/local/lib/perl5/5.8.8/darwin-2level
   /usr/local/lib/perl5/5.8.8
   /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level
   /usr/local/lib/perl5/site_perl/5.8.8
   /usr/local/lib/

The package "Date/Parse.pm" is right where it has always been, along with a 
whole pile of other stuff, in
   /Library/Perl/5.8.6

So this is my question. How do I add "/Library/Perl/5.8.6" to @INC, without 
having to add
   use lib "/Library/Perl/5.8.6";
to every script ?

Regards,

Vic


Re: Upgrading Perl 5.8.8

2006-09-26 Thread Vic Norton
On 9/26/06, at 11:56 AM -0400, Sherm Pendley wrote:
> I use 5.8.6. My scripts run fine with it, and why fix what ain't
> broke?

I just installed 5.8.8 in /usr/local. It went very smoothly and Perl 5.8.8 
seems to work fine.

Except that it can't see the packages in /System/Library/Perl/5.8.6 that I use 
all the time. Stuff like
   Date::Format
   Date::Parse
   LWP
   ...

I tried the 5.8.8 script
   #!/usr/local/bin/perl -w
   use strict;
   use lib "/System/Library/Perl/5.8.6";
   for (@INC) {
  print "$_\n";
   }
   #use Date::Format;

It shows @INC as
   /System/Library/Perl/5.8.6
   /Volumes/VTN Docs/ My Perl/Tests
   /usr/local/lib/perl5/5.8.8/darwin-2level
   /usr/local/lib/perl5/5.8.8
   /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level
   /usr/local/lib/perl5/site_perl/5.8.8
   /usr/local/lib/perl5/site_perl
   .
Since Date/Format.pm is in /System/Library/Perl/5.8.6/,
I figured that I could use it by uncommenting the
   #use Date::Format;
line. No way. Perl 5.8.8 still can't use Date::Format:
   Can't locate Date/Format.pm in @INC ...

As you can see not much of a systems person. I haven't any idea how to 
straighten this problem out. I think I'll take Sherm Pendleys's advice and 
stick with 5.8.6.

Regards,

Vic




A Mactel question

2006-06-07 Thread Vic Norton
Sorry. This is the wrong list to ask this question, but it's the only
Mac list I belong to.

Yesterday I was told that a chip maker other than Intel will be
supplying chips for Macs sometime in the not too distant future. Is
there any credence to this assertion. If so, what chip maker?

Thanks for any information you can give me.

Regards,

Vic


Re: hex editor

2006-05-20 Thread Vic Norton
On 5/20/06, at 1:37 PM -0500, Joseph Alotta wrote:
> I have this text file I want to read that has ^M as the record  
> separator (in emacs).  Is there a utility on the Mac that i can use  
> to view this file in hex.   I thought i remember something like "hex  
> filename", but it is not there.

Path Finder  can do this. It is an
extraordinarily useful Finder substitute.


Re: CPAN modules ...

2006-01-01 Thread Vic Norton
This has been an interesting discussion but, unfortunately, my first
question about getting CPANPLUS to work is nowhere near resolved. I'll
have to do a bit more research in that area.

As for the second question about setting up my BBEdit environment, Doug
McNutt's solution of putting everything I need in
   $HOME/.MacOSX/environment.plist
has worked perfectly. After reading through "BPRuntimeConfig.pdf" from
the Apple developer site I thought I could even be more BBEdit specific
and put its environmental stuff in an LSEnvironment dictionary in
   /Applications/BBEdit.app/Contents/Info.plist
-- but that didn't seem to work.

Thanks to everyone for all the advice.

Regards,

Vic

On 12/31/05, at 10:17 PM -0600, Ken Williams wrote:
>
>On Dec 31, 2005, at 7:43 PM, John Delacour wrote:
>
>> At 6:49 pm -0500 31/12/05, Chris Devers wrote:
>>
>>> On Sat, 31 Dec 2005, John Delacour wrote:
  print `/usr/bin/./printenv`
>>>   ^^
>>>
>>> Why the '/./' here?
>>>
>>> Isn't `/usr/bin/printenv` equivalent, clearer, and simpler?
>>
>> Sure, but I didn't get that far.  printenv works in tcsh without the 
>> path but not in bash, so I tried that in bash, it worked and voilà.
>>
>
>That's because in tcsh it's a built-in shell command, but in bash it 
>invokes /usr/bin/printenv.  For some reason you seem not to have 
>/usr/bin in your path or something.
>
>  -Ken
>


Re: CPAN modules ...

2005-12-30 Thread Vic Norton
Hi Chris,

I have no 'FTP_PASSIVE' key in %ENV. Should I have
   $ENV{'FTP_PASSIVE'} = 1?
Apparently this can be accomplished by inserting the two lines
   FTP_PASSIVE=1
   export FTP_PASSIVE
in my '.bash_profile' file.

A second question. When I run
   for (sort keys %ENV) {
  printf "%25s => %s\n", $_, $ENV{$_};
   }
from BBEdit, I see a small subset of the %ENV that comes from running
the script in Terminal. How can I make BBEdit's %ENV more like the
system %ENV?

Regards,

Vic

>On Fri, 30 Dec 2005, Joel Rees wrote:
>
>> >[CP_ERROR] [Mon Dec 26 14:07:55 2005] Fetching of
>> >   'ftp://ftp.cpan.org/pub/CPAN/authors/id/G/GA/GAAS/CHECKSUMS'
>> >   failed: Command failed:
>> [...]
>> > This hand installation usually works, but it would be very 
>convenient if
>> > I could make CPANPLUS ar CPAN work. Any suggestions?
>> 
>> Choose a less busy mirror?
> 
>And/or check that passive-mode FTP is enabled? (Hint: $ENV{FTP_PASSIVE} 
>is the one you need, if I remember right...) 
>
>


Re: CPAN modules ...

2005-12-29 Thread Vic Norton
Speaking of CPAN, I've never had much luck using 'cpan' to install Perl
modules.

Most of my stuff is on an iMac G3. Now I've got a new iMac G5. I've
installed CPANPLUS on my G5, but that hasn't worked so far. Perhaps this
has something to do with sudo. I do not and will not operate as root.

I tried to install LWP with CPANPLUS. These are the kind of messages I
got back.
   [CP_MSG] [Mon Dec 26 14:07:52 2005] Trying to get
 'ftp://ftp.cpan.org/pub/CPAN/authors/id/G/GA/GAAS/CHECKSUMS'
   [CP_ERROR] [Mon Dec 26 14:07:55 2005] Fetching of 
  'ftp://ftp.cpan.org/pub/CPAN/authors/id/G/GA/GAAS/CHECKSUMS'
  failed: Command failed: 
   [CP_MSG] [Mon Dec 26 14:07:55 2005] Trying to get
  'http://www.cpan.org/authors/id/G/GA/GAAS/CHECKSUMS'
   [CP_ERROR] [Mon Dec 26 14:07:56 2005] Fetching of
  'http://www.cpan.org/authors/id/G/GA/GAAS/CHECKSUMS' failed:
   Command failed: 
   [CP_MSG] [Mon Dec 26 14:07:56 2005] Trying to get
   'ftp://ftp.nl.uu.net/pub/CPAN/authors/id/G/GA/GAAS/CHECKSUMS'
   [CP_ERROR] [Mon Dec 26 14:08:02 2005] Fetching of
   'ftp://ftp.nl.uu.net/pub/CPAN/authors/id/G/GA/GAAS/CHECKSUMS'
   failed: Command failed: 
   [CP_MSG] [Mon Dec 26 14:08:02 2005] Trying to get

'ftp://cpan.valueclick.com/pub/CPAN/authors/id/G/GA/GAAS/CHECKSUMS'
   [CP_ERROR] [Mon Dec 26 14:10:02 2005] Fetching of

'ftp://cpan.valueclick.com/pub/CPAN/authors/id/G/GA/GAAS/CHECKSUMS'
  failed: Command failed: 
   [CP_ERROR] [Mon Dec 26 14:10:09 2005]
  Could not fetch 'CHECKSUMS' file
   [CP_ERROR] [Mon Dec 26 14:10:09 2005]
  Checksum error for 'libwww-perl-5.805.tar.gz'
  -- will not trust package

Since then I've installed LWP by hand, with the usual
   perl Makefile.PL
   make
   make test
   sudo make install

This hand installation usually works, but it would be very convenient if
I could make CPANPLUS ar CPAN work. Any suggestions?

Regards,

Vic



Re: libnet.cfg on 5.8.6

2005-02-28 Thread Vic Norton
For what it's worth, Phil:
I had a Net::Config problem last November. I also was using LWP, but the line
   use Net::Config qw(%NetConfig);
was having absolutely no effect -- regardless of what I put in 
"~/.libnetrc". My son, Thane,suggested that I repair my disk 
permissions. Net::Config worked perfectly after that.

Regards,
Vic
At 10:02 AM + 2/28/05, Phil Dobbin wrote:
On 28/02/2005 @ 09:29 GMT, Sherm Pendley, [EMAIL PROTECTED], wrote:
On Feb 28, 2005, at 4:07 AM, Phil Dobbin wrote:
 Having just installed 5.8.6 into /usr/local/bin I'm coming across the
 usual 400 error when trying to use LWP in CPAN.
 On 5.6.0 I just set ftp_int_passive to 1 in libnet.cfg but I can't
 find any corresponding file in 5.8.6.
Have a look at Net::Config.pm. Interestingly, that seems to be
Mac-aware - it looks like it will use Mac::InternetConfig if you've
installed that. Cool!
Interestingly CPAN claims that:

CPAN: Storable loaded ok
Going to read /Users/phil/.cpan/Metadata
  Database was generated on Mon, 28 Feb 2005 03:48:56 GMT
Warning: Cannot install libnet, don't know what it is

I decided to install all modules (Net::FTP, etc) because CPAN is 
using anonymous FTP to fetch anything.

Any clues appreciated.
Regards,
Phil.
--
*---* mailto:[EMAIL PROTECTED]
| Victor Thane Norton, Jr.
| Mathematician and Motorcyclist
| Bowling Green, Ohio
*---* http://vic.norton.name


Re: A Net::Config problem

2004-11-23 Thread Vic Norton
Thanks for the test, Paul. That is just what is supposed to happen. 
My system is screwed up somehow. Oh well, maybe when I get my next 
iMac, after Tiger comes out, I'll have a working Perl system.   ;^)

Regards,
Vic
At 12:09 PM +1030 11/23/04, Paul McCann wrote:
 Hi Vic,
 you wrote...
 I've got a ".libnetrc" file in my home directory. It reads
{
   'nntp_hosts' => [ "news.dacor.net" ],
   'smtp_hosts' => [ "mail.dacor.net" ],
   'pop3_hosts' => [ "mail.dacor.net", "mailstore.bgsu.edu" ],
}
 I've thrown that file into my home directory as ".libnetrc", and
 then try to use it with Net::Config via
--
 #!/usr/bin/perl
 use strict;
 use Net::Config qw(%NetConfig);
 use Data::Dumper::Simple;
 warn Dumper(%NetConfig);
--
 And out she comes...
 %NetConfig = (
'pop3_hosts' => [
  'mail.dacor.net',
  'mailstore.bgsu.edu'
],
'ftp_firewall' => undef,
'ph_hosts' => [],
'time_hosts' => [],
'inet_domain' => undef,
'smtp_hosts' => [
  'mail.dacor.net'
],
'daytime_hosts' => [],
'test_exist' => 1,
'test_hosts' => 1,
'nntp_hosts' => [
  'news.dacor.net'
],
'snpp_hosts' => [],
'ftp_ext_passive' => 0,
'ftp_int_passive' => 0
  );
 I don't know if this is more help than hindrance, but at least it's
 another data point!
 Cheers,
 Paul



A Net::Config problem

2004-11-22 Thread Vic Norton
I have never been able to set up "Net::Config" properly, and, for the 
life of me, I can't figure out what I am doing wrong.

According to the "Net::Config" manual:
  "Net::Config" holds configuration data for the modules in the
  libnet distribuion. During installation you will be asked for
  these values.
  The configuration data is held globally in a file in the perl
  installation tree, but a user may override any of these values by
  providing their own. This can be done by having a ".libnetrc" file
  in their home directory. This file should return a reference to a
  HASH containing the keys described below.  For example
  .libnetrc
  {
  nntp_hosts => [ "my_prefered_host" ],
  ph_hosts   => [ "my_ph_server" ],
  }
I've got a ".libnetrc" file in my home directory. It reads
   {
  'nntp_hosts' => [ "news.dacor.net" ],
  'smtp_hosts' => [ "mail.dacor.net" ],
  'pop3_hosts' => [ "mail.dacor.net", "mailstore.bgsu.edu" ],
   }
and the test script
   %mylibnet = %{do "$ENV{HOME}/.libnetrc"};
   for (keys %mylibnet) {
  print "$_ => @{$mylibnet{$_}}\n";
   }
produces just what it should, namely
   smtp_hosts => mail.dacor.net
   pop3_hosts => mail.dacor.net mailstore.bgsu.edu
   nntp_hosts => news.dacor.net
Nevertheless,
   use Net::Config qw(%NetConfig);
always produces the, more or less empty, hash
   %NetConfig = (
   'ftp_int_passive' => 0,
   'test_exist' => 1,
   'time_hosts' => [],
   'ftp_testhost' => undef,
   'inet_domain' => undef,
   'test_hosts' => 1,
   'nntp_hosts' => [],
   'smtp_hosts' => [],
   'pop3_hosts' => [],
   'snpp_hosts' => [],
   'ph_hosts' => [],
   'daytime_hosts' => [],
   );
contained in "/System/Library/Perl/5.8.1/Net/libnet.cfg".
What am I doing wrong here? At this point "Net::Config" is useless 
(unless I decide to rewrite "libnet.cfg").

Thanks for any help you can give me!
Vic


Re: Confusion about "die"

2004-07-02 Thread Vic Norton
Sounds good, Chris. But I miss the beginning:
  Half a league
  Half a league
  Half a league, onward
  Rode the Perl Brigade
  ...
Regards,
Vic   ;)
At 10:44 AM -0400 7/2/04, Chris Devers wrote:
 "Forward, the Perl Brigade!"
 Was there a soul dismayed?
 Not though the coder knew
 Some one had blundered.
 Theirs not to make reply, [*ahem*]
 Theirs not to reason why,
 Theirs but to do "$Bin/test2.pl" or die [EMAIL PROTECTED]
 Into the valley of Death
 Rode [EMAIL PROTECTED]
 ...sorry, couldn't resist...

 --
 Chris Devers



Confusion about "die"

2004-07-02 Thread Vic Norton
I am confused about how "die" works. Here is an example of the source of
my confusion.
I have two files (Perl scripts) in the same directory. They are named
"test1.pl" and "test2.pl". They are shown below.
When test1 is executed, it fires the "shot" in test2. The warning "OK,
Hombre, die!" is followed by "You missed!" The "die" line in "shot" has
no effect.
When test2 is executed, it fires the same "shot". But now "OK, Hombre,
die!" is followed by the error output "I'll die, but only under
protest!" The "die" line in "shot" is now working.
So this is my question. Why is the "die" line in the test2 "shot"
invisible when test1 is in control?
Thanks in advance for your input.
- Vic
P.S. You can throw away the "use FindBin" line in test1 and replace
"$Bin" in the "do" line with the test2's directory.
=== test1.pl ===
#!/usr/bin/perl -w
use FindBin qw($Bin);
do "$Bin/test2.pl";
print "You missed!\n";
=== end test1.pl ===
=== test2.pl ===
#!/usr/bin/perl -w
shot();
print "You missed!\n";
sub shot {
print "OK, Hombre, die!\n";
die "I'll die, but only under protest!";
}
=== end test2.pl ===


Re: (sips?) Re: Converting PDF to JPEG

2004-05-18 Thread Vic Norton
Thanks everyone. Somehow, now that Apple has adopted Unix, I would 
have thought they would learn to write manuals.

In any case, "sips --help" shows me that I had sips all along.
Regards,
Vic


(sips?) Re: Converting PDF to JPEG

2004-05-18 Thread Vic Norton
This sips application sounds interesting. Where do you get it? I'm 
running OS X 10.3.3, but "man sips" produces nothing. I looked at
   http://www.apple.com/applescript/imageevents/
but I couldn't find anything to download. A search for "sips" at 
Apple Developer Connection returned nothing.

Regards,
Vic


Re: anacron (backing up system)

2004-05-01 Thread Vic Norton
Anacron sounds like just what I need for certain weekly stuff. I 
tried to install it, but the installation didn't work. Make produced 
these two errors
   /usr/include/stdio.h: At top level:
   readtab.c:40: error: storage size of `input_o' isn't known
   readtab.c:41: error: storage size of `tab_o' isn't known
as well as a whole lot of warnings about
   assignment makes pointer from integer without a cast
and finally
   make: *** [readtab.o] Error 1

Is it necessary to go the Fink route to install Anacron on OS X 10.3?
Regards,
Vic
At 4:45 PM -0400 4/30/04, Chris Devers wrote:
 Isn't that the sort of problem that Anacron is supposed to solve?
 
 Seems like it might make this sort of thing easier...
At 4:57 PM -0400 4/30/04, Sherm Pendley wrote:
 Or you could use anacron:
 
 
 There's a Fink package too.
 sherm--



Problem solved (Re: confusing bulltest)

2004-01-12 Thread Vic Norton
That was it, Jim. Thanks!!! Once I unchecked "Send UTF-8 to 
Interpreter for Perl and Unix Scripts" in my "Unix Scripting" 
preferences, BBEdit stopped changing one byte to three.

The "Send UTF-8 ..." preference has been a big annoyance to me. When 
I would copy stuff off of the web, I would often get symbols I wanted 
to recognize in a regex. If the copied stuff were pasted into a file 
and BBEdit looked at the file via a Perl script, it would see things 
one way. But if the copied text were pasted directly into the script, 
below a __DATA__ or __END__ line, BBEdit would interpret things 
differently. Now, at least, BBEdit is consistent in the way it sees 
things.

On the other hand, perhaps I should change all my Mac Roman 
preferences to UTF-8 in BBEdit. Maybe BBEdit can be consistent that 
way too. Or is that too much to ask?

Regards,

Vic

At 10:10 PM -0500 1/11/04, Jim Correia wrote:
This can be controlled by the checkbox in the Unix Scripting prefs.

Jim




Re: confusing bulltes

2004-01-11 Thread Vic Norton
I'm sorry for all the confusion. Let me try one last time.

I have a perl file with a single chunk of data produced by typing 
option-8 after __DATA__. So the end of the file looks like this:

__DATA__
option-8
When I look at this file with HexEdit, option-8 appears as "A5".

My actual script looks for the pattern "m/\xa5/" in the data. If I 
make the script executable and run it from the terminal, it finds 
"A5". If I execute the script from BBEdit, either directly or "Run in 
Terminal", no "A5" is found.

When I write another script to print out the bytes under __DATA__, I see
"A5" if I execute the script from Terminal, and I see "E2 80 A2" if I 
run the script fom BBEdit, either directly or "Run in Terminal." But 
BBEdit can see "A5". It just can't see it as "DATA". If I write a 
script to look for "A5" in the file that contains the single option-8 
data element and run the script from BBEdit, BBEdit has no trouble 
spotting the A5 at the end of the file.

Sorry to be such a bore! Now I quit.

Regards,

Vic


Re: confusing bullets

2004-01-11 Thread Vic Norton
Hi John,

What I meant and sent was what Sherm Pedley called a bullet, namely 
what is produced on a Mac when you type option-8. The unicode 
character is \x{2022}. On web pages it is •.

When I put "bullet • on a web page, open the page in 
Safari, copy the "bullet" from the page, and paste it into to a Mac 
Roman BBEdit text file, I see a bullet that is encoded in the file as 
A5. I can get the same bullet by typing option-8 in the text file.

I now realize that I was only seeing the CA "bullet" before because I 
was showing invisibles in BBEdit. Then the CA character looked like a 
faded bullet. Ordinarily it is invisible.

Regards,

Vic

P.S. I tried your script below. I haven't the slightest idea what the 
output means. As I said, a real web bullet is •.

At 8:37 PM + 1/11/04, John Delacour wrote:
At 1:52 pm -0500 11/1/04, Vic Norton wrote:

 # file0.pl - The data in "file0.pl" is a real bullet,
 #namely A5. But the script "file0.pl" can't
 #find it when run from BBEdit.
Vic, before I spend time testing this, what do you mean by "real 
bullet" namely A5.  Do you mean that we are to replace "\x5" in the 
scripts you posted with Macintosh character "*" and save the scripts 
as Unix without the Encode as Unicode checked ?  There are a lot of 
options and your instructions are far from unambiguous.

I get the feeling you have not yet visited the Unicode page I recommended.

As to BBEdit, it's important to realise that it does not speak 
Unicode.  It uses an interpreter. What you see is not what you get. 
If the interpreter can't convert to mac it prints the raw UTF-8.

If you run this script from BBEdit you will see how "real" your bullet is.

#!/usr/bin/perl
no warnings ;
$f = "/tmp/vicsbullet.html" ;  open  F, ">$f" ;
print "\x{1F00}";  print F "\x{1F00}"; 
print chr 10;  print F chr 13;
print "\xA5";  print F "\xA5";
close F;
`open -a safari $f` ;



JD




Re: confusing bullets

2004-01-11 Thread Vic Norton
Hi John and Sherm,

Thanks for the info. I have tried your 
experiments and found them very interesting. But, 
in all of your examples, perl and HexEdit see 
exactly the same thing; whereas, in my problem, 
perl and HexEdit were seeing things differently. 
Perl seemed to have double vision.

Now I seem to have resolved the problem--sort of. 
I believe it's a bug in BBEdit. Perhaps you could 
check it out with the following two file/scripts 
(Mac Roman).

=== first file/script ===

 #!/usr/bin/perl -w

 # file0.pl - The data in "file0.pl" is a real bullet,
 #namely A5. But the script "file0.pl" can't
 #find it when run from BBEdit.
 use strict;

 while () {
print "found A5\n" if /\xa5/;
 }
 __DATA__
 *
=== second file/script ===

 #!/usr/bin/perl -w

 # file1.pl - On the other hand, this script has no trouble
 #finding the bullet in the data of "file0.pl",
 #whether or not it is run from BBEdit.
 use strict;
 use FindBin qw($Bin);
 open FILE, "<$Bin/file0.pl";
 while () {
print "found A5\n" if /\xa5/;
 }
 close FILE;
If you create the two files in the same folder 
and make then both executable, then the commands

 $  ./file1.pl
 $  ./file2.pl
produce the same result, "found A5". If you run 
"file1.pl" from BBEdit, you get the "found A5" 
result as well. However, if you open "file0.pl" 
in BBEdit and run it either directly or "in 
Terminal", no output is produced. As far as 
BBEdit is concerned, that 1 byte A5 bullet is now 
3 bytes long. You can find it with the pattern 
"\xe2\x80\xa2". Apparently BBEdit is 
reinterpreting the single byte of data as 3 bytes 
of a "UTF8 encoding with no byte-order mark," to 
quote you, Sherm.

Regards,

Vic

At 12:14 PM + 1/11/04, John Delacour wrote:
At 9:26 pm -0500 10/1/04, Vic Norton wrote:

I'm sorry, John. I was talking figuratively. I didn't mean real bullets.
FIguratively or no, you were right on target 
with your choice.  The bullet is a character in 
the 'macintosh' character set (referred to 
wrongly by the Perl people "MacRoman") which 
does not exist in the widely used (or at least 
declared) charset Latin-1 and has the same 8-bit 
codepoint as the i with diaeresis « ï » in the 
Windows-1252 charset. It is to rebuild this 
Tower of Babel that Unicode was conceived and, 
far too slowly, brought into the computer world 
first in Windows NT and finally in Mac OS X. 
Unicode is a 'good thing' but it requires to be 
learned about and you'll come unstuck pretty 
often if you don't put aside a bit of time to do 
so.

<http://www.unicode.org/standard/WhatIsUnicode.html>

%   perldoc -X Encode | more

SEE ALSO
Encode::Encoding, Encode::Supported, Encode::PerlIO, encoding,
perlebcdic, "open" in perlfunc, perlunicode, utf8, the Perl Unicode
Mailing List <[EMAIL PROTECTED]>
How come Perl sees "C2 A0" whenever HexEdit 
sees "CA" and visa versa? I don't care what 
kind of characters we are talking here. To 
paraphrase Gertrude Stein, "a byte is a byte is 
a byte." At least that's what I thought until 
now.
Gertrude Stein was a character.  Some characters 
are a byte. Some are not, and you have to care.

use strict ;
my $file = "/tmp/file";
#
open FILE, ">:utf8", $file ;
print FILE "\xF0" ;
close FILE ;
#
open FILE, $file ;
print "UTF-8:\t" .   . $/ ;
        close FILE;
#
open FILE, ">$file" ;
print FILE "\xF0" ;
close FILE ;
#
open FILE, $file ;
print "MacRoman:\t" .   . $/ ;
close FILE;
exit ;
JD
At 1:45 AM -0500 1/11/04, Sherm Pendley wrote:
On Jan 10, 2004, at 9:26 PM, Vic Norton wrote:

How come Perl sees "C2 A0" whenever HexEdit 
sees "CA" and visa versa? I don't care what 
kind of characters we are talking here. To 
paraphrase Gertrude Stein, "a byte is a byte is 
a byte." At least that's what I thought until 
now.
Like John said - text encoding.

The file you're viewing with HexEdit is most 
likely encoded using MacRoman, or possibly ISO 
8859-1. Internally, Perl uses UTF8 encoding.

Try this: Create a new text file in BBEdit, and 
enter a bullet (opt-8). Save it using the 
default text encoding. HexEdit shows a single 
byte in the file: A5. Now, open the file again, 
and save a copy of it using UTF8 encoding with 
no byte-order mark. HexEdit now shows *three* 
bytes: E2 80 A2. And, you have to tell BBEdit 
what encoding the file uses when you open it - 
without the byte-order mark, BBEdit can't tell 
it's UTF8.

Just for grins, save it again, this time *with* 
the byte-order mark. HexEdit now reports *six* 
bytes in the file: EF BB BF E2 80 A2.

In other words, yes - a byte is a byte is a 
byte. But you're not working with bytes, you're 
working with text. A character is not always a 
byte. It can be several bytes, depending on how 
it's encoded.

sherm--




Re: confusing bullets

2004-01-10 Thread Vic Norton
I'm sorry, John. I was talking figuratively. I didn't mean real bullets.

How come Perl sees "C2 A0" whenever HexEdit sees "CA" and visa versa? 
I don't care what kind of characters we are talking here. To 
paraphrase Gertrude Stein, "a byte is a byte is a byte." At least 
that's what I thought until now.

Regards,

Vic

At 5:33 PM + 1/10/04, John Delacour wrote:
At 11:22 am -0500 10/1/04, Vic Norton wrote:

What is going on here? HexEdit sees one byte for each bullet and perl
sees two. I thought hex stuff was unambiguous, but, as a mathematician,
I am pretty certain that 1 is not equal to 2.
Perl talks UTF-8.  The bullet in utf-8 is chr (8226) "\x{2022}"

 >>>>   perldoc -X encoding | more

TMTOWTDI but it sounds as though you'd like to work as though 
Unicode didn't exist and something like this might be simplest.

binmode(STDOUT=>':encoding(MacRoman)') ;
my $display_in_dumb_editor = 1 ;
my $f = '/tmp/bullet.txt' ;
open F, ">$f";
print F "Here's a bullet *\r" ;
`open -a 'simpletext' $f` if $display_in_dumb_editor;
close F ;
open F, $f ;
for () {
  /*/ and print "Got one !" or print " :-< "
}
PS. for anyone rash enough, like me, to have installed 5.8.3 and 
having problems finding CongigLocal.pm, this will solve the problem:

enc2xs -C

JD




confusing bullets

2004-01-10 Thread Vic Norton
Now and then I copy data from the web and paste it into a perl script
after "__END__" or "__DATA__". I plan to take the data apart with perl.
The file is generally a BBEdit text file with unix line feeds.
Sometimes there are bullets in the data. According to HexEdit these
bullets are "\xca" characters, but when I try to spot these characters
with "m/\xca/" I find none.
So I look at a line that contains just a bullet, nothing more. HexEdit shows
that line as "CA 0A", a bullet and a new line. On the other hand perl says that
the line has length 3. Using "ord" I see that the line consists of "C2 A0 0A".
To prove its point perl has no trouble finding all bullets with the pattern
"m/\xc2\xa0/".
What is going on here? HexEdit sees one byte for each bullet and perl
sees two. I thought hex stuff was unambiguous, but, as a mathematician,
I am pretty certain that 1 is not equal to 2.
Regards,

Vic

--
*---* mailto:[EMAIL PROTECTED]
| Victor Thane Norton, Jr.
| Mathematician and Motorcyclist
| phone: 419-353-3399
*---* http://vic.norton.name


Re: Installing Perl from a Package

2003-12-17 Thread Vic Norton
Here's what worked for me, Huw. (Well, not for getting Perl. I'm 
using Apple's 5.8.0 version on Panther.)

0. If Developer Tools (for 10.2.x) or XCode (for 10.3.x) isn't installed,
   install it.
1. Go to
  http://darwinports.opendarwin.org/docs/ch01s03.html
   and follow the instructions to install DarwinPorts.
2. After you have installed DarwinPorts the (terminal) command
  port list
   will show you available ports.
3. You want perl 5.8.1. The command
  sudo port perl5.8
   will install perl 5.8.1 in /opt/local/.
Regards,

Vic

At 1:55 PM + 12/17/03, Huw Jenkins wrote:
Hi there,

Anyone know how I can install Perl onto a Mac OS X system from a Package.
I've made a horrible mess of my installation and want to rip it out and
start again using a tried and tested package handler.
Regards

Huw




Re: Path problem

2003-12-16 Thread Vic Norton
Thanks for the tip, Ken. I was not aware of FindBin. The combination

   use FindBin($Bin);
   use lib "$Bin/../ThisProjectLib;
is a particularly nice idea.

Regards,

Vic

At 10:21 PM -0600 12/15/03, Ken Williams wrote:
Yeah, that's a BBEdit-specific quirk.

For a more general solution you might want to use the FindBin module.

 -Ken



Re: Path problem

2003-12-15 Thread Vic Norton
I'm no expert, Tim, but I have discovered that $INC[0] is where you 
are, at least from BBEdit's standpoint.

Regards,

Vic

At 3:02 PM -0800 12/15/03, Tim Warner wrote:
Thanks, Vic. That worked. My books don't say what is supposed to be 
placed in INC[0], though. Is that a standard location for the path 
to the current script?



Re: Path problem

2003-12-15 Thread Vic Norton
Try
   $path = "$INC[0]/sourcefile.txt";
   $resultpath = "$INC[0]/results.txt";
I'm not sure what the chomps are for.

Regards,

Vic

At 1:23 PM -0800 12/15/03, Tim Warner wrote:
A very basic question, but the answer eludes me: How do I open files 
in the same directory as my Perl script?

I'm running these scripts from BBEdit and they worked fine under 
BBEdit 6.5 on OS 9.2. But when I run them under BBEdit 7 on OS 9 or 
with BBE7.1 in Mac OS X, I get an error when trying to read a file, 
saying that the file doesn't exist.

I can successfully write files, but they all go to the root volume 
directory (in OSX). If I move the file I want to read to the root 
directory, everything works fine.

I tried using File::Spec after reading messages in the 
[EMAIL PROTECTED] archive, but while I do get lovely paths using it, 
things still don't work. File::Spec->path(); returns ".", and even 
if I concatenate that with my filename using 
File::Spec->catpath(args); I still get bupkiss.

Here's my original script:
<<
#!/usr/bin/perl
print STDOUT "starting...\n";
$path = "sourcefile.txt"; chomp;
$resultpath = "results.txt"; chomp;
#source file
open (SOURCEFILE, $path)
or die "Couldn't open $path for reading: $!\n";
#results file
open (TARGETFILE, ">> $resultpath")
or die "Couldn't open $resultpath for writing: $!\n";
... etc snipped

Thanks for your help.
--Tim
^^
Tim Warner
mailto:[EMAIL PROTECTED]
--
*---* mailto:[EMAIL PROTECTED]
| The blues are the roots; everything else is the fruits.
| - Willie Dixon
*---* http://vic.norton.name


Panther man solution

2003-11-22 Thread Vic Norton
Thanks for all the input on my man problems with Panther (and bash).
Here's my final solution. Perhaps it will work for others.
1. I have accepted the /man directory. Why perl module manuals should be
   going in there is still unclear to me, but I can live with it. So I
   have simply added the line
  OPTIONAL_MANPATH  /man
   to /private/etc/manpath.config.
2. In my .bash_profile I have added the line
  export PATH
   after PATH is constructed. I picked up this idea from the darwinports
   README file. It seems to make manpath work.
   For example my current .bash_profile reads
  PATH=~/bin:$PATH
  PATH=$PATH:/usr/X11R6/bin
  PATH=$PATH:/opt/local/bin
  PATH=$PATH:/usr/local/bin
  PATH=$PATH:/usr/local/teTex/bin
  export PATH
   and I expect I may add some more "PATH=$PATH:" lines in the future.
Regards,

Vic

--
*---* mailto:[EMAIL PROTECTED]
| Victor Thane Norton, Jr.
| Mathematician and Motorcyclist
| phone: 419-353-3399
*---* http://vic.norton.name


Re: Panther problems

2003-11-16 Thread Vic Norton
I'm sorry about the confusion, Morbus. My ".bash_profile" contains the line
   MANPATH=/usr/share/man:/man:/usr/X11R6/man:~/man
The "set" command, with no parameters, reproduces this as
   MANPATH=/usr/share/man:/man:/usr/X11R6/man:/Users/vic/man
Regardless, I cannot see manuals in either
   /man  or  /usr/X11R6/man
and "manpath" still produces
   /usr/share/man:/Users/vic/man
My conclusion, in bash the value of the variable MANPATH has no effect
whatsoever on "man". Maybe bash doesn't need "setenv", but, so far, it
can't tell "man" where to look either.
Regards,

Vic

At 8:58 PM -0500 11/16/03, Morbus Iff wrote:
Bash doesn't need setenv.

MANPATH=/man:/usr/share/man:Users/vic/man
That would be correct IF you had a leading slash on "Users". You also
would have to start a new shell so your new .bash_profile would be read.



Panther problems

2003-11-16 Thread Vic Norton
I have recently done a clean installation of Panther (10.3.1), and I am
having some system problems. Since I primarily get into the (Unix)
system for Perl related stuff, I thought I'd ask your advice.
The default shell for Panther is bash. I had become accustomed to tcsh
under Jaguar. That is part of my problem. I'm trying to go with bash
under the new system.
OK, here is my situation. My new system starts absolutely "clean". I run
cpan in Terminal and accept the default configurations. Then I try
   cpan> install Bundle::CPAN
and, after that,
   cpan> install Bundle::LWP
Everything seems to work perfectly. Carried away with my success I
install "TimeDate-1.16", but this time I do it with the basic
   perl Makefile.PL
   make
   make test
   make install
commands. Again everything seems to work perfectly.
My problems start when I want to peruse some manuals. Manuals for LWP
or TimeDate modules are not immediately accessible. The commands
   man LWP::Simple
   man Date::Parse
yield absolutely nothing. When I check "manpath", I get
"/usr/share/man:/Users/vic/man". There are definitely no LWP or TimeDate
manuals in either of these directories.
Apparently a new "/man" directory has been created for me, and all new
package manuals have gone there. (I don't even have a "/man" directory
on my 10.2.8 system, which thankfully still exists on an external
drive.) Now I see that the commands
   man -M /man LWP::Simple
   man -M /man Date::Parse
produce the manuals desired. Plain old "man" just won't do it: to read a
new manual you have to know where it is.
Sorry for the long preamble. Here are my questions.

   1. Aren't these package manuals going in the wrong place? Shouldn't
  they automatically be placed in a subdirectory of
  "/usr/share/man"? If so, how do I change the configuration of my
  system so that the "make" procedure automatically puts new manuals
  in the right place?
   2. If I must live with the current setup, how do I change my MANPATH
  in bash. In tcsh I would simply put the line
 setenv MANPATH "/man:/usr/share/man: ... :${HOME}/man"
  in my ".tcshrc" file to tell "man" where to look. Unfortunately,
  there doesn't seem to be a "setenv" command in bash, and the command
 MANPATH=/man:/usr/share/man:Users/vic/man
  in my ".bash_profile" has no effect on either "man" or "manpath".
  The directory "/man" is never searched.
Any advice you might have on my predicament would be greatly
appreciated.
Regards,

Vic

--
*---* mailto:[EMAIL PROTECTED]
| Victor Thane Norton, Jr.
| Mathematician and Motorcyclist
| phone: 419-353-3399
*---* http://vic.norton.name


How to add to @INC?

2003-10-25 Thread Vic Norton
My Perl 5.8.0 resides in "/opt/local/bin/". Perl 5.6.0 is in "/usr/bin".

When I start a script with

   #!/opt/local/bin/perl -w
   use Date::Parse;
I get an error message because "Date::Parse" is in "/Library/Perl/Date"
and my Perl 5.8.0 @INC doesn't contain "/Library/Perl".
I have no problems when I change the script to start with

   #!/opt/local/bin/perl -w
   use lib qw(/Library/Perl);
   use Date::Parse;
but this effectively puts "/Library/Perl" in front of everything in my
5.8.0 @INC array.
My question is this. How do I change my Perl 5.8.0 @INC so that it reads
like
   ~/where_ever_I_am
   /opt/local/lib/perl5/5.8.0/darwin
   /opt/local/lib/perl5/5.8.0
   /opt/local/lib/perl5/site_perl/5.8.0/darwin
   /opt/local/lib/perl5/site_perl/5.8.0
   /opt/local/lib/perl5/site_perl
   /System/Library/Perl/darwin
   /System/Library/Perl
   /Library/Perl
   ...
so that Perl 5.8.0 looks in my "/opt/local/" directories first --- and is
this advisable?
Regards,

--
Vic Norton
vic at norton dot name


Re: What is going on?

2003-10-22 Thread Vic Norton
Problem solved. There was something wrong with the file. It was 
encoded in Unicode(UTF-16), whatever that means. I have no idea how 
it got that way. Apparently my script was just adding invisible lines 
to the file.

(The Encoding option is at the bottom of the File Options icon in the 
BBEdit Status Bar.)

Solution. I just copied what I needed to a new " extractedFiles" 
(encoded in Mac Roman). Now I have no problems appending lines.

Regards,

Vic

At 6:25 PM -0400 10/22/03, Vic Norton wrote:
I've been having problems appending text to a file. I can't figure out
what is going on.
Here is a simple script that illustrates the problem. I have a file
named " extractedFiles". (The first character in its name is a space.)
It lives in the directory indicated in this script.
   #!/usr/bin/perl -w

   my $headdir = "$ENV{HOME}/Perl/MyPerl/Virus/New Viruses/Headers";
   # my $headdir = "$ENV{HOME}/Desktop";
   open EXTRACTED, ">>$headdir/ extractedFiles"
   or die "cannot open extractedFiles: $!";
   print EXTRACTED "Extracting head from somefile\n";
   close EXTRACTED;
When I run the script, nothing is appended to " extractedFiles". The
content of the file is unchanged. But its "Date modified" time has changed
to the time when the script was run.
If I comment out the first "my $headdir" line and uncomment the second,
the script works just as it should. Every time it is run another line is
appended to the " extractedFiles" file on my desktop.
BTW, both " extractedFiles" files have the same permissions, "-rw-r--r--".

Any ideas would be greatly appreciated!

Regards,

Vic

--
Vic Norton
vic at norton dot name




What is going on?

2003-10-22 Thread Vic Norton
I've been having problems appending text to a file. I can't figure out
what is going on.
Here is a simple script that illustrates the problem. I have a file
named " extractedFiles". (The first character in its name is a space.)
It lives in the directory indicated in this script.
   #!/usr/bin/perl -w

   my $headdir = "$ENV{HOME}/Perl/MyPerl/Virus/New Viruses/Headers";
   # my $headdir = "$ENV{HOME}/Desktop";
   open EXTRACTED, ">>$headdir/ extractedFiles"
   or die "cannot open extractedFiles: $!";
   print EXTRACTED "Extracting head from somefile\n";
   close EXTRACTED;
When I run the script, nothing is appended to " extractedFiles". The
content of the file is unchanged. But its "Date modified" time has changed
to the time when the script was run.
If I comment out the first "my $headdir" line and uncomment the second,
the script works just as it should. Every time it is run another line is
appended to the " extractedFiles" file on my desktop.
BTW, both " extractedFiles" files have the same permissions, "-rw-r--r--".

Any ideas would be greatly appreciated!

Regards,

Vic

--
Vic Norton
vic at norton dot name


Re: BBEdit-Perl confusion

2003-10-16 Thread Vic Norton
I guess there is no fix right now.

But actually the bug is somewhat convenient. Now a BBEdit script starting with
#!/opt/local/bin/perl -w
# Perl 5.8
uses Perl 5.8.0 with its @INC list if "Run" from BBEdit and
uses Perl 5.6.0 with a different @INC list if "Run in Terminal".
It's not all bad---though it is a bit confusing.

Regards,

Vic

At 12:03 PM -0400 10/16/03, Bare Bones Software Technical Support wrote:
There is a bug in BBEdit where run in terminal hard codes the path 
to perl as /usr/bin/perl instead of taking the other usual steps to 
choose which interpreter to run. I have a bug logged and this will 
be corrected for the next release.
At 9:56 AM -0400 10/16/03, Vic Norton wrote:
I have recently installed Perl 5.8.0 on my iMac via "PortsManager" from
DarwinPorts <http://www.opendarwin.org/projects/darwinports/>. Perl 5.8.0
resides in the "/opt/local/bin" directory, and this directory is at the
beginning of $PATH. Everything works well except that BBEdit seems rather
confused. Any suggestions as to how to rectify this confusion would be
appreciated.



BBEdit-Perl confusion

2003-10-16 Thread Vic Norton
I have recently installed Perl 5.8.0 on my iMac via "PortsManager" from
DarwinPorts . Perl 5.8.0
resides in the "/opt/local/bin" directory, and this directory is at the
beginning of $PATH. Everything works well except that BBEdit seems rather
confused. Any suggestions as to how to rectify this confusion would be
appreciated.
Here is an example of BBEdit's confusion.

In Terminal the command
   % perl -e 'for (@INC) { print "$_\n" }'
produces
   /opt/local/lib/perl5/5.8.0/darwin
   /opt/local/lib/perl5/5.8.0
   /opt/local/lib/perl5/site_perl/5.8.0/darwin
   /opt/local/lib/perl5/site_perl/5.8.0
   /opt/local/lib/perl5/site_perl
   .
When "Run" from BBEdit the script
   #!/opt/local/bin/perl -w
   for (@INC) { print "$_\n" }
produces exactly the same output in the "Unix Script Output" window.
However, when this script is "Run in Terminal" from BBEdit, the output
is
   /Users/vicnorton/Perl/MyPerl/Misc/tests-work
   /System/Library/Perl/darwin
   /System/Library/Perl
   /Library/Perl/darwin
   /Library/Perl
   /Library/Perl
   /Network/Library/Perl/darwin
   /Network/Library/Perl
   /Network/Library/Perl
   .
 Something seems to be wrong here.

 Any suggestions as to what is going on here and how to rectify it
 would be greatly appreciated.
 Regards,

 Vic

--
*---* mailto:[EMAIL PROTECTED]
| Victor Thane Norton, Jr.
| Mathematician and Motorcyclist
| phone: 419-353-3399
*---* http://vic.norton.name


An example (of Weird math)

2003-10-14 Thread Vic Norton
# An example that tells it all:
#   1 + 1/20  = 1.05= 1.00 0011 : bit52 = 0, bit53 = 1
#   1 + 1/40  = 1.025   = 1.000 0011: bit52 = 0, bit53 = 0
#   1 + 1/80  = 1.0125  = 1. 0011   : bit52 = 1, bit53 = 0
#   1 + 1/160 = 1.00625 = 1.0 0011  : bit52 = 1, bit53 = 1
# where
#   1.00 0011 means
#   1.11001100110011001100110011001100110011... base 2,
# and similarly for the other binary representations.
# Also bit52 and bit53 are the 52nd and 53rd bits after the point.
# The results:
  printf "%.1f\n", 1.05; # produces  1.1
  printf "%.2f\n", 1.025;# produces  1.02
  printf "%.3f\n", 1.0125;   # produces  1.012
  printf "%.4f\n", 1.00625;  # produces  1.0063
# This is 52-bit precision with rounding arithmetic. Sprintf rounds a
# number up or down according as the 53rd bit in the binary
# representation of the number is set or not. (The 52nd bit would be
# the indicator with 52-bit precision and truncating arithmetic.)
--
*---* mailto:[EMAIL PROTECTED]
| Victor Thane Norton, Jr.
| Mathematician and Motorcyclist
| phone: 419-353-3399
*---* http://vic.norton.name


Re: Weird math... (once more)

2003-10-13 Thread Vic Norton
You are wrong about the 64 bit part, Edward, no matter what the Perl books say.

The precision, eps, of a machine is the smallest positive number such that
1 + eps > 1  in machine arithmetic. For example, if
   1.01 > 1  but  1.001 = 1   (binary),
then the precision of the machine is 0.01 = 2**6, and the machine 
can be said to have 6 bit precision.

By this definition the precision of Perl (on Mac OS X) is 2**52. The 
following script shows this quite clearly.

   $n = 0;
   while( 1 + 2**(-$n) > 1 ) { $n++ }
   $n = $n-1;
   print "precision = 2**$n\n";
Probably Perl's precision is best put at 48 bits (12 hex). In the 
case of rounding 1.655 and 1.755, this is the last point at which the 
former rounds down and the latter rounds up. This can be seen with 
the script

   $twopower = 48;
   $bigtwo = 2**$twopower;
   print "two power = $twopower\n";
   while ($a = ) {
  chomp $a;
  $b = (sprintf "%.0f", $a * $bigtwo)/$bigtwo;
  $up_or_down = $b >= $a ? "round up" : "round down";
  print "$a  $up_or_down\n";
   }
   print "---\n";
  
   __END__
   1.655
   1.755

When $twopower > 48 both numbers always round up. And they round 
every which way for 32 < $twopower < 48.

The pair of numbers, 1.655 and 1.755, illustrate machine pathology 
marvelously. Thank you Bill Stevenson!

Regards,

Vic

At 6:29 PM -0700 10/13/03, Edward Moy wrote:
Yes, Vic is correct (except Perl uses double precision, which is 64 bits).
--
*---* mailto:[EMAIL PROTECTED]
| Mathematicians are like Frenchmen: whatever you say to them
| they translate into their own language, and at once it is
| something entirely different.
|- Johann Wolfgang von Goethe, Maxims and Reflections
*---* http://vic.norton.name


Re: Weird math... (once more)

2003-10-13 Thread Vic Norton
Here is a little Perl routine that shows exactly what is going on.

   #!/usr/bin/perl -w

   $bigtwo = 2**32;
   while ($a = ) {
  $b = (sprintf "%.0f", $a * $bigtwo)/$bigtwo;
  $up_or_down = $b >= $a ? "round up" : "round down";
  print "$a  $up_or_down\n";
   }
   __END__
   1.655
   1.755
The output of this script is
   1.655  round up
   1.755  round down
===
Here is what is going on.
The 32-bit floating point number $b closest to $a = 1.655 is greater 
than 1.655. This number $b is the computer representation of 1.655; 
consequently the instruction
   sprintf "%.2f", $a;
rounds $b up to 1.66.

On the other hand, 32-bit floating point number $b closest to $a = 
1.755 is less than 1.755. This number $b is the computer 
representation of 1.755; consequently the instruction
   sprintf ".2f", $a;
rounds $b down to 1.75.

Regards,

Vic

At 1:49 PM -0500 10/13/03, Bill Stephenson wrote:
I've got a script that takes numbers similar to those below and then rounds
them and adds them together using code similar to what is below.
#!/usr/bin/perl -w
use strict;
my $item_1 = "1.655";
my $item_2 = "1.755";
my $rnd_1 = (sprintf qq~%.2f~, $item_1);
my $rnd_2 = (sprintf qq~%.2f~, $item_2);
print "$rnd_1, $rnd_2";
The code above prints this result (system 10.1.5, perl 5.6.0):

1.66, 1.75

But shouldn't it be:

1.66, 1.76

or:

1.65, 1.75

I'm no math wizard, so if someone could please take the time and tell what
I'm missing here I would very much appreciate it!
--

Bill Stephenson
www.PerlHelp.com
1-417-546-5593
--
*---* mailto:[EMAIL PROTECTED]
| Victor Thane Norton, Jr.
| Mathematician and Motorcyclist
| phone: 419-353-3399
*---* http://vic.norton.name


Re: Weird math...

2003-10-13 Thread Vic Norton
Here's a short rounding routine that uses sprintf and does produce 
correct results.

#!/usr/bin/perl -w

while () { print round($_,2), "\n" }

sub round {
my ($number, $places) = @_;
my $tenpower = 10**$places;
return (sprintf "%.0f", $number * $tenpower)/$tenpower;
}
__END__
1.655
1.755
Regards,

Vic

At 1:49 PM -0500 10/13/03, Bill Stephenson wrote:
I've got a script that takes numbers similar to those below and then rounds
them and adds them together using code similar to what is below.
#!/usr/bin/perl -w

use strict;

my $item_1 = "1.655";

my $item_2 = "1.755";

my $rnd_1 = (sprintf qq~%.2f~, $item_1);

my $rnd_2 = (sprintf qq~%.2f~, $item_2);

print "$rnd_1, $rnd_2";

The code above prints this result (system 10.1.5, perl 5.6.0):

1.66, 1.75

But shouldn't it be:

1.66, 1.76

or:

1.65, 1.75

I'm no math wizard, so if someone could please take the time and tell what
I'm missing here I would very much appreciate it!
--

Bill Stephenson
www.PerlHelp.com
1-417-546-5593
--
Vic Norton
vic at norton dot name


Re: Locale setting errors in Perl

2003-09-28 Thread Vic Norton
And, if you run scripts from BBEdit like I do, you should write something like





LANG
en_US
LC_ALL
C
MAILADDRESS
[EMAIL PROTECTED]


in "~/.MacOSX/environment.plist". (Forget about the MAILADDRESS; that is mine.)

Regards,

Vic

At 1:58 AM -0700 9/28/03, Chris Cantrall wrote:
If your shell is tcsh, put the following 2 lines in your .tcshrc 
login/setup file.

setenv LANG en_US
setenv LC_ALL C


--
Vic Norton
vic at norton dot name


Re: 2 "/Library/Perl" in @INC

2003-02-28 Thread Vic Norton
Got me, Riccardo. I got doubling doubling as well, two different ways:

   ~% perl -e 'print "$_\n" for @INC'
   /sw/lib/perl5/5.6.1/darwin
   /sw/lib/perl5/5.6.1
   /Library/Perl/darwin
   /Library/Perl
   /Library/Perl
   .
   ~% perl5.6.0  -e 'print "$_\n" for @INC'
   /System/Library/Perl/darwin
   /System/Library/Perl
   /Library/Perl/darwin
   /Library/Perl
   /Library/Perl
   /Network/Library/Perl/darwin
   /Network/Library/Perl
   .
Regards,

Vic
   /Network/Library/Perl
   .
At 11:22 AM -0500 2/27/03, Riccardo Perotti wrote:
I just did a

perl -e 'print "$_\n" for @INC'

in Terminal and both "/Library/Perl" and "/Network/Library/Perl" are listed
twice. Why?
Riccardo
--
mailto:[EMAIL PROTECTED]
http://www.riccardoperotti.com




Re: What's the best POP module?

2003-02-06 Thread Vic Norton
I think Net::POP3 came with my iMac, Sherm, but maybe I installed it. 
Some days I have a hard time remembering my name.   - Vic   <:^(

At 4:45 PM -0500 2/5/03, Sherm Pendley wrote:
On Wednesday, February 5, 2003, at 03:13 PM, Vic Norton wrote:


For simple stuff consider Net::POP3 from the libnet-1.12 package. 
This is probably already installed in your system.

Maybe not - it's a standard module with 5.8.0, but remember, OS X 
ships with 5.6.0, and for that version libnet is an optional install.

sherm--

UNIX: Where /sbin/init is Job 1.





Re: What's the best POP module?

2003-02-05 Thread Vic Norton
For simple stuff consider Net::POP3 from the libnet-1.12 package. 
This is probably already installed in your system.

Regards,

Vic

At 10:47 AM +0100 2/5/03, Elizabeth Mattijsen wrote:
At 17:43 +0100 2/4/03, Gian Luca Gaiba wrote:

I tried POP3::Client
but it seems that have no methods
to fetch and retrieve attachments...

Someone uses other one
with best performances
or with the methods for attachments?


Maybe you should have a look at Mail::Box.  It also has POP3 functionality...


Liz






Upgrading to Perl v5.6.1

2003-01-18 Thread Vic Norton
I just tried installing Mail-Box-2.034. Apparently the Perl v5.6.0 
that came with my new iMac is not recent enough:

   ~/Download/Mail-Box-2.034% perl Makefile.PL
   Perl v5.6.1 required--this is only v5.6.0, stopped at Makefile.PL line 5.

I'm really not interested in trying to install Perl v.5.8. Is there a 
simple way of upgrading 5.6.0->5.6.1?

Thanks for any advice you can gives me.

Regards,

Vic
--
*---* mailto:[EMAIL PROTECTED]
| Life is a jest; and all things show it.
| I thought so once; and now I know it.
|   My Own Epitaph - John Gay, 1689-1732
*---* http://vic.norton.name


And I thought it was 5.6?

2003-01-11 Thread Vic Norton
Just installed Mail::Sendmail. Part of its test is to send an email. 
The test worked fine, but I was surprised by the message:

   This is a test message sent with Perl version 5.006 from a darwin system.

Jeez, I was feeling guilty about not installing Perl 5.8, but I 
thought my iMac came with Perl 5.6. Be that as it may, the Perl code

   print "$]\n";

produces 5.006 on my system. Am I missing something here?

On the terminal, "% perl -V" produces the first line

   Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:

Doesn't this mean I am using Perl 5.6? Why doesn't "$]" contain 5.6?


Regards,

Vic



Re: OT praise for the cookbook

2002-11-28 Thread Vic Norton
I'll have to admit that I haven't gone through most of the cookbook, but I use

   sub commify { # commify a number. Perl Cookbook, 2.17, p. 64
  my $text = reverse $_[0];
  $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;
  return scalar reverse $text;
}

every day. I like my numbers to look right.

Regards,

Vic

--
*---* mailto:[EMAIL PROTECTED]
| Uncle Bill, why didn't you ever marry?  - Gloria Jean
| I was in love with a beautiful blonde once, dear.
| Drove me to drink. That's the one thing I'm indebted
| to her for. - W.C. Fields
|   - Never Give A Sucker An Even Break
*---* http://vic.norton.name



Help: make install

2002-11-26 Thread Vic Norton
Hi all,

Thanks to drieux I've pretty much figured out how to install modules, 
but I am having one problem. When I update my SPPD module, the 
reinstallation goes along with no problems, except that the man part 
is left in limbo. I have to copy the new VTN::SPPD manual into man3 
by hand.

Here is the error message I get:
* [VTN-iMac:vicnorton/VTN/SPPD] root# make install <-- my command
* Cannot forceunlink /Library/Perl/VTN/SPPD.pm: Operation not
* permitted at /System/Library/Perl/File/Find.pm line 499
* make: *** [pure_site_install] Error 255

Apparently I am not permitted to update my VTN::SPPD manual. Is there 
some way that I can "forceunlink" and straighten out this situation?

Thanks for any advice you can give me.

Regards,

Vic
--
*---* mailto:[EMAIL PROTECTED]
| You can't fool me. There ain't no sanity clause!
|   - Chico Marx, A Night at the Opera
*---* http://vic.norton.name


Perl Package Problem

2002-11-17 Thread Vic Norton
Hello all,

I am having a problem installing a package of my own. I am at a 
complete loss as to what the problem is. The details are appended. 
Any suggestions would be greatly appreciated.

Regards,

Vic

= The details ===
I check syntax (in BBEdit) of a Perl script "sppd0A.pl". I get the errors
   Error: File sppd0A.pl; Line 12:
  VTN/Sppd.pm did not return a true value
   Error: File sppd0A.pl; Line 12:
  BEGIN failed--compilation aborted

The script "sppd0A.pl" reads like this:
 ...
10:  use Bit::Vector;
11:  use VTN::Utilities qw(commify);  # Perl Cookbook, 2.17.
12:  use VTN::Sppd qw(hasdecomp);
 ...
with the line numbers on the left. There is no problem with line 11. 
I use the "commify" routine from my "VTN::Utilities" package 
frequently. But for some reason the package on line 12, "VTN::Sppd", 
is rejected.

The "VTN::Utilities" and "VTN::Sppd" packages are here
   /Library/Perl/darwin/VTN% ls -l
   total 56
   -rwxr--r--  1 vicnorto  admin  5427 Nov  2 16:26 Sorts.pm*
   -rwxr--r--  1 vicnorto  admin  2116 Nov 17 12:28 Sppd.pm*
   -rwxr--r--  1 vicnorto  admin  2886 Nov  7 07:13 Utilities.pm*
along with another package called "VTN::Sorts". "Utilities" and 
"Sorts" work. "Sppd" does not. I can't figure out why not.

The structure of "Sppd.pm" as extremely simple. This is it
   /Library/Perl/darwin/VTN/Sppd.pm
  package VTN::Sppd;
  require Exporter;

  our @ISA = qw(Exporter);
  # our @EXPORT  = qw(hasdecomp);
  our @EXPORT_OK   = qw(hasdecomp);
  our %EXPORT_TAGS = (all => [@EXPORT_OK]);
  our $VERSION = '1.0';

  sub hasdecomp { # code follows
  }

  sub issquare { # code follows
  }

  1;

How can "Sppd.pm ... not return a true value"?

One last thing. There is an invisible file in 
"/Library/Perl/darwin/VTN/", namely ".DS_Store". I can read 
"Sorts.pm" and "Utilities.pm" in its one line:
   ...Sorts.pmIlocblob...Utilities.pmIlocblob...
but I don't see any reference to "Sppd.pm".

Thanks for your help!

--
*---* mailto:[EMAIL PROTECTED]
| Victor Thane Norton, Jr.
| Mathematician and Motorcyclist
| phone: 419-353-3399
*---* http://vic.norton.name


An application of Bit::Vector (Re: How do you install ...)

2002-11-03 Thread Vic Norton
Hi Ken,

I didn't really search. I just added odd squares to primes congruent 
to 3 mod 4. Such sums always give you multiples of 4. (Primes like 5, 
which are congruent to 1 mod 4, don't give multiples of 4 when added 
to odd squares.) Then I checked the (bit vector) list of results to 
see if any nonsquare multiples of 4 had not been hit.

I did my largest test last night. It took 12 hours on my new iMac to 
verify that 3676 is the only nonsquare multiple of 4 less than 
100,000,000 that does not have a square plus prime decomposition. My 
guess is that 3676 is the only nonsquare multiple of 4 that has no 
such decomposition, period.

I got into this problem when I went to a regional meeting of the 
Mathematical Association of America. I presented a talk on "How to 
beat the market and sleep well at night" (see my signature) at the 
meeting, but I also went to listen to Charles McCracken talk about 
this square plus prime problem. Charles had done a lot of 
computations, and every nonsquare multiple of 4 he had tested had 
always had a square plus prime decomposition. I figured that looking 
for counterexamples would be a good test of Perl on my new machine. 
At that point I had run exactly one Perl script on my iMac: I had 
printed "hello world" on the screen.

I'll send you the code in a separate letter, Ken. If anyone else is 
interested in this application of "Bit::Vector", let me know. I'll 
sent you the code as well.


Regards,

Vic


At 1:55 PM +1100 11/3/02, Ken Williams wrote:
On Saturday, November 2, 2002, at 03:02  PM, Vic Norton wrote:

So here is the answer to your homework exercise. There is exactly 
one nonsquare multiple of 4 less than or equal to 10,000,000 that 
is not the sum of a square and a prime. That nonsquare multiple of 
4 is 3,676.

Note that all small, nonsquare multiples of 4 do have a square plus 
prime decomposition:
   8 = 1 + 7, 12 = 1 + 11, 20 = 1 + 19 = 9 + 11,
   24 = 1 + 23, 28 = 9 + 19 = 25 + 3, ...

The exercise with the 10,000,000 upper limit took 26 minutes and 53 
seconds on my new iMac. I don't think I'll try it on my Power 
Computing tower. When I set the upper limit at 2,000,000 rather 
than 10,000,000, the comparative computation times were
   Power Computing 240 MHz:  8 minutes, 43 seconds,
   iMac 800 MHz: 2 minutes, 53 seconds.
So far, no matter which machine I use, the answer is always the same: 3,676.

Interesting, where did you find this problem?  Is it conjectured 
that 3,676 is the only such number, or are there other known ones 
above 10M?

Also, how did you use Bit::Vector to search?  Want to post your code?

 -Ken


--
*---* http://vic.norton.name/finance/btm
| How to beat the market and sleep well at night
| or
| How optimizing a weighted Sharpe ratio
| can lead to an effective investment strategy
*---* mailto:vic@;norton.name



Re: How do you install modules in OS X?

2002-11-01 Thread Vic Norton
Thanks again to everyone for their help!

Paul Goracke, among others, suggested that "Developer Tools" might be 
in my "/Applications/Installers/" directory. I had even started to 
download "Developer Tools" from ADC (Apple had got my registration 
straightened out) when I realized that Paul was right---so I 
cancelled the transmission.

It's kind of pathetic. I spent most of an hour on two phone calls to 
Apple Technical Support yesterday. Both people I talked to were iMac 
specialists, presumably, but there was a good deal of wait time while 
they asked even more expert technicians for advice. Still, no one at 
Apple had the slightest notion that Developers Tools was already 
loaded, ready to be installed, on my new iMac's hard drive.

In any case, I've now installed the Developers Tools and CPAN. I've 
even installed Steffen Beyer's "Bit:Vector" to run a comparison 
against my Power Computing, 240 MHz PowerPC 604e machine.

So here is the answer to your homework exercise. There is exactly one 
nonsquare multiple of 4 less than or equal to 10,000,000 that is not 
the sum of a square and a prime. That nonsquare multiple of 4 is 
3,676.

Note that all small, nonsquare multiples of 4 do have a square plus 
prime decomposition:
   8 = 1 + 7, 12 = 1 + 11, 20 = 1 + 19 = 9 + 11,
   24 = 1 + 23, 28 = 9 + 19 = 25 + 3, ...

The exercise with the 10,000,000 upper limit took 26 minutes and 53 
seconds on my new iMac. I don't think I'll try it on my Power 
Computing tower. When I set the upper limit at 2,000,000 rather than 
10,000,000, the comparative computation times were
   Power Computing 240 MHz:  8 minutes, 43 seconds,
   iMac 800 MHz: 2 minutes, 53 seconds.
So far, no matter which machine I use, the answer is always the same: 3,676.


Regards,

Vic

--
*---* mailto:vic@;norton.name
| Victor Thane Norton, Jr.
| Mathematician and Motorcyclist
| phone: 419-353-3399
*---* http://vic.norton.name


Re: How do you install modules in OS X?

2002-10-31 Thread Vic Norton
Thanks for the help, everyone. I've spent much of the afternoon 
trying to find out how to get the Developer Tools CD that doesn't 
come with new Macs. After a couple of calls to Apple I was finally 
directed to , but that didn't help much. 
To download the software I need to be registered. Apparently I am 
already registered, but the only passwords I can think of don't work. 
When I try to get help, they ask me for my birth date. I can remember 
that: April 22 (1935). "Nope," Apple says, "The authentication 
provided doesn't match our records."

Catch 22. I'm still in the same quandary. I can't "make" anything in OS X!

So I've bought a new machine whose system is crippled and which 
doesn't have the "Developer" CD that store-bought versions of OS X 
have. Well, my new 17" iMac looks nice, but I guess I'll be doing 
Perl on my Power Computing tower for a while. I have all the tools I 
need there.

Exercise, using Bit::Vector, find the one nonsquare multiple of 4 
less than 1 million that is not the sum of a square and a prime. I'd 
like to see how long this exercise takes on my new machine, but, 
unfortunately, I can't use Bit::Vector.

Regards,

Vic

--
*---* mailto:vic@;norton.name
| Life is a jest; and all things show it.
| I thought so once; and now I know it.
|   My Own Epitaph - John Gay, 1689-1732
*---* http://vic.norton.name


How do you install modules in OS X?

2002-10-31 Thread Vic Norton
Hello all,

I got a new iMac a few of weeks ago. I've been using MacPerl on a Power
Computing tower until now. I'm a bit stymied by Perl on the iMac. My
primary problem is that I don't know how to install Perl modules. This was
easy in MacPerl. I just dropped the module on Chris Nandor's "installme"
droplet. (A future question: How do you make droplets in OS X?)

I have tried to install CPAN-1.63 by running "cpan". I wasn't ready for
a manual configuration. I let cpan decide what to do.

The first thing cpan told me was that I didn't have "unzip", "make",
"lynx", "ncftpget", "ncftp" in PATH. Where can I get these? Are they
necessary? Larry Wall (Programming Perl, 3rd ed, p 553) seems to think
that "make" is quite important.

After writing "/Users/vicnorton/.cpan/CPAN/MyConfig.pm" cpan tried to
"install Bundle::CPAN". First it asked me to "install Net::FTP as soon as
possible". It continued by connecting to "ftp.cpan.ddns.develooper.com".
Apparently it "GOT /Users/vicnorton/.cpan/sources/authors/01mailrc.txt.gz",
but after this the process broke down. Cpan could no longer connect.

   ...
   226-File [01mailrc.txt.gz] successfully transferred
   226 1.556 seconds (measured here), 35.53 Kbytes per second
   56634 bytes received in 00:01 (30.04 KB/s)
   221-Goodbye. You uploaded 0 and downloaded 56 kbytes.
   221 Logout - CPU time spent: 0.000 seconds.
   GOT /Users/vicnorton/.cpan/sources/authors/01mailrc.txt.gz
   Going to read /Users/vicnorton/.cpan/sources/authors/01mailrc.txt.gz
   Issuing "/usr/bin/ftp -n"
   /usr/bin/ftp: No address associated with nodename
   Not connected.
   Local directory now /Users/vicnorton/.cpan/sources/modules
   Not connected.
   Not connected.
   Not connected.
   Not connected.
   Not connected.
   Not connected.
   Bad luck... Still failed!
   Can't access URL 
ftp://ftp.perl.org/pub/CPAN/modules/02packages.details.txt.gz.


 Please, install Net::FTP as soon as possible. CPAN.pm installs it for you
 if you just type
 install Bundle::libnet

   Please check, if the URLs I found in your configuration file () are valid.
   The urllist can be edited. E.g. with ``o conf urllist push ftp://myurl/''

   Cannot fetch modules/02packages.details.txt.gz

   Issuing "/usr/bin/ftp -n"
   /usr/bin/ftp: No address associated with nodename
   Not connected.
   Local directory now /Users/vicnorton/.cpan/sources/modules
   Not connected.
   Not connected.
   Not connected.
   Not connected.
   Not connected.
   Not connected.
   Bad luck... Still failed!
   Can't access URL ftp://ftp.perl.org/pub/CPAN/modules/03modlist.data.gz.


 Please, install Net::FTP as soon as possible. CPAN.pm installs it for you
 if you just type
 install Bundle::libnet

   Please check, if the URLs I found in your configuration file () are valid.
   The urllist can be edited. E.g. with ``o conf urllist push ftp://myurl/''

   Cannot fetch modules/03modlist.data.gz

   Can't install Bundle::CPAN, don't have an associated bundle file. :-(
at /System/Library/Perl/CPAN.pm line 1806

   cpan>


So where do I go from here? I would have no problems downloading the files
that cpan couldn't, namely "02packages.details.txt.gz" and
"03modlist.data.gz", and uncompress them, but I wouldn't know what to do
with them after that.

Any advice would be greatly appreciated. Appropriate references would also
be nice. The URL  doesn't seem to
know that Mac OS X exists, and, of course, it assumes you have "make" if
you are on a UNIX system.

Sorry for the length of this (my first) posting. I'm a bit frustrated.


Regards,

Vic

--
*---* mailto:vic@;norton.name
| Victor Thane Norton, Jr.
| Mathematician and Motorcyclist
| phone: 419-353-3399
*---* http://vic.norton.name