[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

MacPerl-Digest V1 #31




MacPerl-Digest          Friday, April 2 1999          Volume 01 : Number 031



[MacPerl] $^O and perlport
Re: [MacPerl] $^O and perlport
Re: [MacPerl] $^O and perlport
Re: [MacPerl] $^O and perlport
Re: [MacPerl] Find SMTP server(s): nslookup?
[MacPerl] Getting MacPerl to run locally on my Mac
Re: [MacPerl] Getting MacPerl to run locally on my Mac
Re: [MacPerl] Find SMTP server(s): nslookup?
Re: [MacPerl] Find SMTP server(s): nslookup?
[MacPerl] looking to compare and concatenate Web logs
Re: [MacPerl] looking to compare and concatenate Web logs
Re: [MacPerl] Find SMTP server(s): nslookup?
Re: [MacPerl] Flat files and variable miles
[MacPerl] Is there a port of Perl/Tk to the Mac?
Re: [MacPerl] looking to compare and concatenate Web logs

----------------------------------------------------------------------

Date: Thu, 01 Apr 1999 00:28:27 +0200
From: Milivoj Ivkovic <mi@alma.ch>
Subject: [MacPerl] $^O and perlport

>> While perlport is a good reference, it is not very complete in respect to
>> $^O values.  Perhaps it could be, though.
>

After discovering perlport, I couldn't resist compiling a little html table of the $^O values I found there, instead of going to bed...

I put it on <http://alma.ch/perl/perloses.htm>.

Milivoj

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org

------------------------------

Date: Wed, 31 Mar 1999 17:39:43 -0500
From: Chris Nandor <pudge@pobox.com>
Subject: Re: [MacPerl] $^O and perlport

At 17.28 -0500 1999.03.31, Milivoj Ivkovic wrote:
>>> While perlport is a good reference, it is not very complete in respect to
>>> $^O values.  Perhaps it could be, though.
>>
>
>After discovering perlport, I couldn't resist compiling a little html table of the $^O values I found there, instead of going to bed...
>
>I put it on <http://alma.ch/perl/perloses.htm>.

Cool.  I think something like this is needed.

Note that I did confirm that in the Darwin sources Apple released, the perl 
sources they had there do expect "rhapsody" as the value of $^O.  Partial diff between perl5.005_02 and Darwin source below.  I suppose the porter did not use $^O because he didn't know about it, but $^O is always the same as $Config{osname}.

*** Bird:src:Pudge:pudgeprogs:perl:perlget:perl5.005_02:installperl	Fri Jul 24 00:00:24 1998
- --- Bourque:Desktop Folder:Tabs:Down :perl:perl:installperl	Tue Mar 16 17:31:34 1999
***************
*** 107,112 ****
- --- 109,116 ----
  my $d_dosuid = $Config{d_dosuid};
  my $binexp = $Config{binexp};
  
+ my $osname = $Config{osname};
+ 
  if ($Is_VMS) {  # Hang in there until File::Spec hits the big time
      foreach ( \$installbin,     \$installscript,  \$installprivlib,
                \$installarchlib, \$installsitelib, \$installsitearch,
***************
*** 501,506 ****
- --- 537,560 ----
      $packlist->{$to} = { type => 'file' };
  }
  
+ sub strip
+ {
+     my($file) = @_;
+ 
+     print STDERR "  strip $file\n";
+     system("strip", "$file");
+ }
+ 
+ sub striplib
+ {
+     my($file) = @_;
+ 
+     if ($osname eq "rhapsody") {
+        print STDERR "  strip -S $file\n";
+        system("strip", "-S", "$file")
+     }
+ }
+ 
  sub samepath {
      my($p1, $p2) = @_;
  

- -- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org

------------------------------

Date: Wed, 31 Mar 1999 19:02:28 -0500
From: "Paul J. Schinder" <schinder@pobox.com>
Subject: Re: [MacPerl] $^O and perlport

At 5:39 PM -0500 3/31/99, Chris Nandor wrote:


} +     if ($osname eq "rhapsody") {

Wow.  Apple's professional liars^W^Wlawyers aren't going to be happy about
this.  Aren't they trying to be nasty to people with some type of
continuing licensing agreements that give them access to "Rhapsody
something or other" by claiming that Mac OS X server isn't Rhapsody?

}
} --
} Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
} %PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])
}



- -----
Paul J. Schinder
schinder@pobox.com

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org

------------------------------

Date: Wed, 31 Mar 1999 19:06:12 -0500
From: Chris Nandor <pudge@pobox.com>
Subject: Re: [MacPerl] $^O and perlport

At 19.02 -0500 1999.03.31, Paul J. Schinder wrote:
>At 5:39 PM -0500 3/31/99, Chris Nandor wrote:
>
>} +     if ($osname eq "rhapsody") {
>
>Wow.  Apple's professional liars^W^Wlawyers aren't going to be happy about
>this.  Aren't they trying to be nasty to people with some type of
>continuing licensing agreements that give them access to "Rhapsody
>something or other" by claiming that Mac OS X server isn't Rhapsody?

Yep!  I sent this info to macintouch (and the guy noted on macintouch who
had been having trouble with Apple) when that story broke.  I dunno if he
did anything about it.

- --
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org

------------------------------

Date: Wed, 31 Mar 1999 19:52:26 -0500
From: "Paul J. Schinder" <schinder@pobox.com>
Subject: Re: [MacPerl] Find SMTP server(s): nslookup?

At 3:49 PM +0200 3/31/99, Milivoj Ivkovic wrote:

} >there be a "/etc/resolv.conf", which isn't a real problem, except MacPerl
} >users don't usually have one.  You have to construct one and point Net::DNS
} >at it.
}
} Not sure what you mean by construct one. You mean that if the user
}doesn't have a "/etc/resolv.conf" file, I have to tell Net::DNS which DNS
}to use? Would make sense. Any way to get the info out of the system? If
}there is, it probably should be part of Net::DNS, actually.

MacOS uses a completely different way of getting the nameserver(s) than
Unix.  There isn't a file named /etc/resolv.conf lying around, and there's
no text file with lines "domain this" "nameserver that" that can be used as
a substitute.  Anyone on MacOS that wants to use Net::DNS has to find out
what the format of an /etc/resolv.conf and roll their own.  I simply copied
the one off my Sun workstation and edited it, and then changed
Net::DNS::Resolver to point to that file.  Chris' experience this morning,
though, may mean that I didn't have to do this.  I don't remember why I
did, but I vaguely remember the module throwing up because I didn't have
one when I tried to use it.

}
} >} Would some Macs have environment variables like $ENV{MAILHOST} set?
} >
} >Mine does, but that's because I use MailTools.  In general, no.
}
} So I guess that if there is one, it should also get a high priority. I
}wonder whether it is usually correctly set on Unix systems.

I don't think it's in my environment on any of my Unix boxen.  All of them
run SMTP servers (even my Mac when running Linux), so "localhost" is right
for all of them.

}
} >} Or would some Macs have such a command (I read something about Unix tools
} >}in a new Mac OS)?
} >
} >Sure, on Mac OS X server.  But the number of people willing to spend $500
} >to run it on the limited number of models that will run it are few.  And
} >they're probably running 5.005_03 or 5.005_5? rather than MacPerl in the
} >blue box anyway.  Those you treat as BSD boxes, because in essence that's
} >what they are.
}
} So I can still try `nslookup`. It would just print an error message if
}it's not there? Or would it be smarter to first check whether this is an X
}server? Anything different in $^O from a "plain" Mac?

If it's in BSD, MacOS X will probably have it.  I don't see it by name at
<http://www.publicsource.apple.com/projects/darwin/>, but it's probably in
one of the packages, maybe "network_cmds".  (Darwin is the free/incomplete
version of MacOS X server.)


}
} >Since I've tested Mail::Sendmail multiple times, and edited test.pl, I've
} >always thought what you should do is have the test simply prompt the user
} >and ask for the address to send the test to and the server address.  The
}
} Yes, these goodies have been postponed too long. Still, I feel it would
}be cool finding the SMTP server(s) first, and prompting the user with good
}defaults. I hate having to type these names over and over. It would also
}be nice to figure the user's e-mail address, but that would be far too
}much trouble for something that would only work occasionally. But the SMTP
}servers I'll try.

Good luck.

}
} >software.  Ordinarily I hate prompting software, but here you need only two
} >things, and the test is run only once for each release.
}
} It has been 3 releases in 2 days this time, but it should stay quiet
}again now :-)...
}
} Milivoj
}


- -----
Paul J. Schinder
schinder@pobox.com

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org

------------------------------

Date: Wed, 31 Mar 1999 18:46:17 +0100
From: Timothy Reynolds <Celica80@csd.net>
Subject: [MacPerl] Getting MacPerl to run locally on my Mac

Hi,

Is there a way to run MacPerl on my Mac without having to been connected 
to the internet?  In other words I would like to run it from my hard 
drive.  Any suggestions would be appreciated.

Regards,

Tim Reynolds

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org

------------------------------

Date: Wed, 31 Mar 1999 20:57:58 -0500
From: "Paul J. Schinder" <schinder@pobox.com>
Subject: Re: [MacPerl] Getting MacPerl to run locally on my Mac

At 6:46 PM +0100 3/31/99, Timothy Reynolds wrote:

} Hi,
}
} Is there a way to run MacPerl on my Mac without having to been connected
} to the internet?  In other words I would like to run it from my hard
} drive.  Any suggestions would be appreciated.

Why do you think you need to be connected to the Internet to run MacPerl?
You don't.  Do you have MacPerl installed on your local Mac?

}
} Regards,
}
} Tim Reynolds
}
} ===== Want to unsubscribe from this list?
} ===== Send mail with body "unsubscribe" to macperl-request@macperl.org



- -----
Paul J. Schinder
schinder@pobox.com

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org

------------------------------

Date: Thu, 01 Apr 1999 12:53:36 +0200
From: Milivoj Ivkovic <mi@alma.ch>
Subject: Re: [MacPerl] Find SMTP server(s): nslookup?

>} >there be a "/etc/resolv.conf", which isn't a real problem, except MacPerl
>} >users don't usually have one.  You have to construct one and point Net::DNS
>} >at it.
>}
>} Not sure what you mean by construct one. You mean that if the user
>}doesn't have a "/etc/resolv.conf" file, I have to tell Net::DNS which DNS
>}to use? Would make sense. Any way to get the info out of the system? If
>}there is, it probably should be part of Net::DNS, actually.
>
>MacOS uses a completely different way of getting the nameserver(s) than
>Unix.  There isn't a file named /etc/resolv.conf lying around, and there's
>no text file with lines "domain this" "nameserver that" that can be used as
>a substitute.  Anyone on MacOS that wants to use Net::DNS has to find out
>what the format of an /etc/resolv.conf and roll their own.  I simply copied
>the one off my Sun workstation and edited it, and then changed
>Net::DNS::Resolver to point to that file.  Chris' experience this morning,
>though, may mean that I didn't have to do this.  I don't remember why I
>did, but I vaguely remember the module throwing up because I didn't have
>one when I tried to use it.

Chris may have a DNS server on his Mac? Net::DNS defaults to 127.0.0.1 if all else fails. Or he may have edited Resolver.pm, or specified the nameservers in the calling script ($res->nameservers("x.x.x.x", "y.y.y.y"). Found all this while re-trying to make it work on Win95. (And eventually patched it, so it gets the info from the registry as for NT).

Quentin suggested this, which sounds promising:

>the way I get the address of the SMTP hostname is this (it uses
>InternetConfig, which has come bundled with the Mac OS since Mac OS 7.6):
>
>use Mac::InternetConfig;
>print $InternetConfig{kICSMTPHost};

If it's that easy, it should be integrated into Net::DNS. Even if it doesn't work on all Macs, it doesn't cost a lot to try...

>If you want to send e-mail, then you can just use Net::SMTP, which is in
>libnet. It automatically gets the data from InternetConfig, including SMTP
>host, SMTP username, SMTP password, and others.

No need for a password for SMTP, but if the user's e-mail address is there too, that's interesting. What would the key be?


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org

------------------------------

Date: Thu, 1 Apr 1999 09:05:09 -0500
From: "Paul J. Schinder" <schinder@pobox.com>
Subject: Re: [MacPerl] Find SMTP server(s): nslookup?

At 12:53 PM +0200 4/1/99, Milivoj Ivkovic wrote:

} >
} >use Mac::InternetConfig;
} >print $InternetConfig{kICSMTPHost};
}
} If it's that easy, it should be integrated into Net::DNS. Even if it
}doesn't work on all Macs, it doesn't cost a lot to try...

It's not that easy.  That little snippet does not work for me, and I
certainly have Internet Config, with a setting for the SMTP server.  It
comes built into the latest versions of MacOS, including the one I'm using.
It may be that Mac::InternetConfig can't deal with the new Internet Config
(it changed even before being incorporated into the OS, the one that ships
with MacPerl is old).
}
} >If you want to send e-mail, then you can just use Net::SMTP, which is in
} >libnet. It automatically gets the data from InternetConfig, including SMTP
} >host, SMTP username, SMTP password, and others.
}
} No need for a password for SMTP, but if the user's e-mail address is
}there too, that's interesting. What would the key be?

>From the docs, the email address seems to be kICEmail.



- -----
Paul J. Schinder
schinder@pobox.com

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org

------------------------------

Date: Thu, 1 Apr 1999 09:08:55 -0500 (EST)
From: Paul Corr <corr@voicenet.com>
Subject: [MacPerl] looking to compare and concatenate Web logs

Folks,

I'd like some feedback on how to best concatenate two Common Log Format
Web server logs. I have two WebSTAR servers mapped to the same hostname.
Each has an access log. I'd like to concatenate them and use WebTrends to
generate a report. WT works fine with individual logs. It chokes on doing
both because the start dates are the same.

I saw a recipe in the Perl Cookbook on reading a line from the CLF file
into variables. Basically, I want to read the two files, compare lines on
the date and time 'fields' and write the lines to an output file
appropriately. I'm open to suggestions.

Here's some background information on my current level of expertise. I'm
beginning to explore MacPerl with a colleague and I'm tracking my
progress and keeping configuration notes on my personal Web site. Here's a
description of my working MacPerl environment:

http://www.voicenet.com/~corr/macsupt/macperl/environs.html

I have a basic script on reading a file and re-writing it to output on the
same site:

http://www.voicenet.com/~corr/macsupt/macperl/

Feel free to comment on my pages and/or my current log problem.

Thanks in advance.

Paul


===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org

------------------------------

Date: Thu, 1 Apr 1999 09:19:17 -0500
From: Chris Nandor <pudge@pobox.com>
Subject: Re: [MacPerl] looking to compare and concatenate Web logs

At 09.08 -0500 1999.04.01, Paul Corr wrote:
>I saw a recipe in the Perl Cookbook on reading a line from the CLF file
>into variables. Basically, I want to read the two files, compare lines on
>the date and time 'fields' and write the lines to an output file
>appropriately. I'm open to suggestions.

Most web logfile anaylzers I've seen don't care if the data is sorted.  You
could just concatenate them into one file.  BBEdit can do this with large
files easily with its Concatenate Files ... tool, and you can do it with
MacPerl like this or something similar:

  @ARGV = ($file1, $file2);   # pretend they are on the command line
  open F, "> newfile" or die $!;
  print F while <>;           # one line at a time print to new file


If you do need the data sorted, you can look at the File::Sort module which
is intended to do stuff like that.  I am rewriting it to mimic the features
of Unix sort now, which gives the flexibility you might need for something
like this.  See http://pudge.net/files/macperl/scripts/sort.pudge for the
current version.  It is a command line tool, but you can just stick
arguments into @ARGV at the top to get the same effect.

I'll be merging the new changes back into File::Sort at some point.

- --
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org

------------------------------

Date: Thu, 1 Apr 1999 09:22:44 -0500
From: Chris Nandor <pudge@pobox.com>
Subject: Re: [MacPerl] Find SMTP server(s): nslookup?

At 09.05 -0500 1999.04.01, Paul J. Schinder wrote:
>} >use Mac::InternetConfig;
>} >print $InternetConfig{kICSMTPHost};
>}
>} If it's that easy, it should be integrated into Net::DNS. Even if it
>}doesn't work on all Macs, it doesn't cost a lot to try...
>
>It's not that easy.  That little snippet does not work for me, and I
>certainly have Internet Config, with a setting for the SMTP server.  It
>comes built into the latest versions of MacOS, including the one I'm using.
>It may be that Mac::InternetConfig can't deal with the new Internet Config
>(it changed even before being incorporated into the OS, the one that ships
>with MacPerl is old).

It should work, with the caveat that because kICSMTPHost is not an inlined
sub, you need to put the parens after it (I have it on my TODO list to make
sure it is inlined in the next release of MacPerl).  The IC API is
basically unchanged, so this code should work with the Mac OS 8.5 Internet
Control Panel and Internet Preferences (after you add the parens).

    use Mac::InternetConfig;
    print $InternetConfig{kICSMTPHost()};

Works for me, and I don't have the "real" Internet Config installed under
Mac OS 8.5.

- --
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org

------------------------------

Date: Thu, 01 Apr 1999 09:47:59 -0500
From: Allan Greenier <agreenier@snet.net>
Subject: Re: [MacPerl] Flat files and variable miles

Richard,

> So, my guess is that this isn't very viable as a pure Perl project 
> unless the data is very static (maintenance problems) and the 
> intended usage is pretty narrow (lack of flexibility), but I suppose 
> it could be done.

Actually both these criteria are met...very little maintenance and very
static data.
1.Pick a Mac from an HTML pop-up
2. Have returned a page with data about the Mac (50 items worth)

I'd like to thank everyone on this list who have suggested
solutions...I'm new to Perl and to paraphrase Bruce Eckel I'm not yet
"Thinking in Perl".

Allan Greenier
AutoScript Applications

agreenier@snet.net
http://www.geocities.com/~autoscript

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org

------------------------------

Date: Thu, 1 Apr 1999 07:54:50 -0800 
From: Greg Bartlett <gbartlett@metapath.com>
Subject: [MacPerl] Is there a port of Perl/Tk to the Mac?

I guess the subject says it all.

Greg

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org

------------------------------

Date: Thu, 1 Apr 1999 10:55:05 -0500 (EST)
From: rjk@linguist.dartmouth.edu (Ronald J. Kimball)
Subject: Re: [MacPerl] looking to compare and concatenate Web logs

Paul Corr wrote:
> 
> Folks,
> 
> I'd like some feedback on how to best concatenate two Common Log Format
> Web server logs. I have two WebSTAR servers mapped to the same hostname.
> Each has an access log. I'd like to concatenate them and use WebTrends to
> generate a report. WT works fine with individual logs. It chokes on doing
> both because the start dates are the same.
> 
> I saw a recipe in the Perl Cookbook on reading a line from the CLF file
> into variables. Basically, I want to read the two files, compare lines on
> the date and time 'fields' and write the lines to an output file
> appropriately. I'm open to suggestions.

Sounds like you want to do a merge.  That should be very simple.


open(IN1, "logfile1") or die "Unable to open logfile1: $!\n";
open(IN2, "logfile2") or die "Unable to open logfile2: $!\n";
open(OUT, "outfile") or die "Unable to open outfile: $!\n";

my $in1 = <IN1>;
my $in2 = <IN2>;

while (defined($in1) and defined($in2)) {
    if (order($in1, $in2) <= 0) {
        print OUT $in1;
        $in1 = <IN1>;
    } else {
        print OUT $in2;
        $in2 = <IN2>;
    }
}

print OUT while <IN1>;
print OUT while <IN2>;


Where order() resembles a sort subroutine, except that it
compares $_[0] and $_[1] instead of $a and $b.  It should return
- -1 if $_[0] comes first,
1 if $_[1] comes first,
0 if $_[0] and $_[1] have the same sort order.

I would have defined order() above, but I don't know what your
data looks like.  ;)


Ronald

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org

------------------------------

End of MacPerl-Digest V1 #31
****************************


==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to
==== macperl-digest-request@macperl.org