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

MacPerl-Digest V1 #14




MacPerl-Digest        Wednesday, March 17 1999        Volume 01 : Number 014



[MacPerl] Inside Mac -> Perl ?
[MacPerl] Glue
Re: [MacPerl] Inside Mac -> Perl ?
Re: [MacPerl] Glue
[MacPerl] trouble reading a file
Re: [MacPerl] trouble reading a file
[MacPerl] personal web sharing
Re: [MacPerl] Glue
Re: [MacPerl] Glue
Re: [MacPerl] personal web sharing
Re: [MacPerl] personal web sharing
Re: [MacPerl] personal web sharing
Re: [MacPerl] personal web sharing
Re: [MacPerl] personal web sharing
[MacPerl] Personal Web Sharing? Problem?
RE: [MacPerl] How do I find the day of the week from a given date (NOT today)

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

Date: Mon, 15 Mar 1999 12:51:06 -0500
From: Chris Nandor <pudge@pobox.com>
Subject: [MacPerl] Inside Mac -> Perl ?

People who buy the Inside Mac CD-ROM also by the Camel book.  Interesting.

    http://www1.clbooks.com/asp/BookInfo/BookInfo.asp?theisbn=0201406748

People who buy MacPerl: Power and Ease also by the Camel.

    http://www1.clbooks.com/asp/bookinfo/bookinfo.asp?theisbn=1881957322

Well, according to this site, anyway.

- --
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: Mon, 15 Mar 1999 11:13:43 -0800
From: "Mat Marcus" <mmarcus@Adobe.COM>
Subject: [MacPerl] Glue

I started working with Glue again recently (great work Chris!) and want to
share some observations in hope of possibly influencing the next version.

1) I'm working with apps that use a plugin architecture. In these apps some
aete information is found in the plugins. If I drag the main app onto the
glue droplet it extracts a file full of garbage. But if I use an individual
plugin with an aete it seems to work ok. This happens to me with CodeWarrior
for example.

2) I'm working with a dictionary that makes extensive use of properties. I
can do things in AppleScript that I can't do in perl/Glue. To explain I need
to give you a snippet from the Object Model:

### begin object model ###
Application
	property: Active Window (tag = 'pacw') # this refers to a window (cwin)
object
	element: document

Document:
	element: Window

Window: (tag = 'cwin')
	property: Active Spread (tag = 'pacs') # this refers to a spread (sprd)
object
	element: Spread

Spread: (tag = 'sprd')
	property: name
### end object model

In applescript I can say:
	set result to name of ActiveSpread of ActiveWindow

But I can't seem to do this naturally in Glue. What I would like to say is
something like this:

$result = $k2->get(
	$k2->p('name', property=>'active_spread', property=>'active_window')
)->get();


I believe that this can't work because of Glue::_doObj tries to check that
active_spread is a valid property of the active window at "compile time",
i.e. before the getdata event has been sent. But since the tag for Active
Window is not 'cwin' _doobj() thinks that there's a problem. I would like to
suggest that you drop the "compile time" property validation. Instead you
could build a big flat hash of all the properties upon Glue instantation. It
might appear that this would risk some name clashes. But I believe that this
is how AppleScript does it. I seem to recall from implementing AE Object
Models in the past that AppleScript puts all tags and strings in one big
global namespace. That is, it gets pretty unhappy if there is not a one to
one mapping between tags and associated strings. Thoughts?

Thanks,
- -Mat Marcus







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

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

Date: Mon, 15 Mar 1999 15:57:14 -0500 (EST)
From: rjk@linguist.dartmouth.edu (Ronald J. Kimball)
Subject: Re: [MacPerl] Inside Mac -> Perl ?

Chris Nandor wrote:
> 
> People who buy the Inside Mac CD-ROM also by the Camel book.  Interesting.
> 
>     http://www1.clbooks.com/asp/BookInfo/BookInfo.asp?theisbn=0201406748
> 
> People who buy MacPerl: Power and Ease also by the Camel.
> 
>     http://www1.clbooks.com/asp/bookinfo/bookinfo.asp?theisbn=1881957322
> 
> Well, according to this site, anyway.
> 

Conclusion:  Everybody buys the Camel book!

:)

Ronald

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

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

Date: Mon, 15 Mar 1999 16:20:34 -0500
From: Chris Nandor <pudge@pobox.com>
Subject: Re: [MacPerl] Glue

At 14.13 -0500 1999.03.15, Mat Marcus wrote:
>1) I'm working with apps that use a plugin architecture. In these apps some
>aete information is found in the plugins. If I drag the main app onto the
>glue droplet it extracts a file full of garbage. But if I use an individual
>plugin with an aete it seems to work ok. This happens to me with CodeWarrior
>for example.

With the latest release of Mac::Glue (from November, I think), the target
app is launched if there an aedt resource is detected.  Then an Apple Event
is sent to get the resource data, which should include any plugins.  So
this should not be a problem.


>global namespace. That is, it gets pretty unhappy if there is not a one to
>one mapping between tags and associated strings. Thoughts?

Well, not quite right, from what I understand.  That is, you can have
multiple strings for each four-char ID.  But yes, I believe a four-char ID
has to map back to exactly one "string" for each given application.

So you can type, in Script Editor:

  tell app "Finder" to get selection

And "app" will be expanded to "application".  But that is not too useful
for our discussion.  :)

I am in the middle of redoing Mac::Glue in many ways, and this is one of
them.  Right now I am reading a lot of documentation, including most of IM:
IAC.  I will be discussing more of the details of it on
macperl-modules@macperl.org as they come up rather than this list, and just
make announcements on this list, so please join that list if you're not
already on 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: Mon, 15 Mar 1999 16:20:41 -0500
From: Paul Corr <corr@voicenet.com>
Subject: [MacPerl] trouble reading a file

Folks,

I'm a novice perl and AppleScripter and reading this list and several perl
books. Lately, I'm testing various clippings from the list, assembling test
scripts. I'm having trouble with one. I hope I'm missing something simple.
I'm using BBEdit to construct scripts and its MacPerl Palette to check
syntax and run the script. (I set the working directory for the palette
prefs to the scripts' directory with no change in results. Running the
script from MacPerl is similar.)

Here's the script:

# -=-=-=-=-
# An AppleScript prompts user for directory. MacPerl works
# with resulting folder path reference string.

my $in_dir = MacPerl::DoAppleScript($show_dialog_in);
$in_dir =~ s/^alias "//;
$in_dir =~ s/"$//;

opendir(DIR, "$in_dir") || die ("Could not open $in_dir\n");
my @files = readdir(DIR);
closedir(DIR);

foreach $file (@files) {
	# do something with each file
	open(FILE, "$file") || die "Could not open $file: $!";

	while (defined($line = <FILE>)) {
	  	print $line;
	}

	close FILE;
}
# -=-=-=-=-

RESULTS:

- -=-
# Could not open accesspenn.html: No such file or directory.
File '<AppleEvent>'; Line 77 #[the open (FILE... line]
- -=-

If I replace the 'do something with each file' code block with a simple
'print "$file\n";' line, it prints a listing of file names (without full
path ref.) in the selected directory. If I clip the 'do something' code
block and place it in a new file, hard-coding file names or using
AppleScript to prompt the user for a file, it works fine.

Now the file path is fairly long, if that has an impact:

- -=-
MacintoshHD:ONLINE:alocalWeb:SyncPJC:PersonalContEd:Scripting:AppleScriptsŸ:curr
ent_work:testdir:accesspenn.html
- -=-

Any help would be appreciated.

Paul



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

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

Date: Mon, 15 Mar 1999 16:59:29 -0500
From: Chris Nandor <pudge@pobox.com>
Subject: Re: [MacPerl] trouble reading a file

At 16.20 -0500 1999.03.15, Paul Corr wrote:
># Could not open accesspenn.html: No such file or directory.
>File '<AppleEvent>'; Line 77 #[the open (FILE... line]

You need to either open "$in_dir$file" or "$in_dir:$file", or you need to
chdir($in_dir).

- --
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: Mon, 15 Mar 1999 14:52:29 -0800
From: jrough@nanospace.com
Subject: [MacPerl] personal web sharing

Since personal web sharing sets up your mac as a server is there a way
to test cgi scripts using this feature?  If there is how do you do it? 
My ISP has a site I can put my uploaded files but I would like a way to
test them out locally any ideas?  I keep downloading Webstar but they
only give you one free trial registration number.

Thanks.

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

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

Date: Mon, 15 Mar 1999 19:23:56 -0500
From: Jim Correia <correia@barebones.com>
Subject: Re: [MacPerl] Glue

On 3/15/99 at 4:20 PM, Chris Nandor <pudge@pobox.com> wrote:

> With the latest release of Mac::Glue (from November, I think), the
> target app is launched if there an aedt resource is detected.  Then
> an Apple Event is sent to get the resource data, which should include
> any plugins.  So this should not be a problem.

If this is in fact how the logic works, then it is incorrect.

You need to look at the appropriate information in the scripting size
'scsz' resource.

The first byte of the resource contains the boolean value.

- -- 
Jim Correia                                Bare Bones Software, Inc.
correia@barebones.com                     <http://web.barebones.com>



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

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

Date: Mon, 15 Mar 1999 20:00:56 -0500
From: Chris Nandor <pudge@pobox.com>
Subject: Re: [MacPerl] Glue

At 19.23 -0500 1999.03.15, Jim Correia wrote:
>On 3/15/99 at 4:20 PM, Chris Nandor <pudge@pobox.com> wrote:
>
>> With the latest release of Mac::Glue (from November, I think), the
>> target app is launched if there an aedt resource is detected.  Then
>> an Apple Event is sent to get the resource data, which should include
>> any plugins.  So this should not be a problem.
>
>If this is in fact how the logic works, then it is incorrect.
>
>You need to look at the appropriate information in the scripting size
>'scsz' resource.

I did not write the AETE code ... I just remembered some discussion on it.
It appears the scsz resource is used.  Although, actually, it just checks
if the resource has a value at all instead of checking just the first byte.
One more thing for the TODO list.

- --
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: Mon, 15 Mar 1999 22:46:35 -0500
From: Allan Greenier <agreenier@snet.net>
Subject: Re: [MacPerl] personal web sharing

Actually I just did this tonite! You of course get a different address
every time you dial up, but other than that I pointed at the CGI, it
launched MacPerl and then itself.
Worked like a charm right "out of the box".


Allan Greenier
AutoScript Applications

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

> Since personal web sharing sets up your mac as a server is there a way
> to test cgi scripts using this feature?  If there is how do you do it? 
> My ISP has a site I can put my uploaded files but I would like a way to
> test them out locally any ideas?

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

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

Date: Tue, 16 Mar 99 06:48:13 -0500
From: Scott Prince <saprince@earthlink.net>
Subject: Re: [MacPerl] personal web sharing

on 3/15/99 5:52 PM, jrough@nanospace.com wrote...
>Since personal web sharing sets up your mac as a server is there a way
>to test cgi scripts using this feature?  If there is how do you do it? 
>My ISP has a site I can put my uploaded files but I would like a way to
>test them out locally any ideas?  I keep downloading Webstar but they
>only give you one free trial registration number.

Just save your perl script as a 'cgi script' (not plain text) and Web 
Sharing will execute it. Be warned that Web Sharing is not Apache, in 
fact it's slow as molases, but aside from that and a few annoying little 
bugs it's fully functional.


Scott

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

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

Date: Tue, 16 Mar 1999 09:51:42 +0000
From: Chris Sansom <chris@highway57.co.uk>
Subject: Re: [MacPerl] personal web sharing

At 14:52 -0800 15/3/99, jrough@nanospace.com spoke thusly:
>Since personal web sharing sets up your mac as a server is there a way
>to test cgi scripts using this feature?  If there is how do you do it?
>My ISP has a site I can put my uploaded files but I would like a way to
>test them out locally any ideas?  I keep downloading Webstar but they
>only give you one free trial registration number.

I do this with Quid Pro Quo which, at the time I downloaded it (?a year
ago), existed in a freeware version at http://www.socialeng.com. If you
need details of how to set up your TCP/IP control panel, let me know
privately.

 Cheers ... Chris
 ======================================================================
 Chris Sansom    -    Highway 57   -   Designs for the World Wide Web |
 chris@highway57.co.uk                     http://www.highway57.co.uk |
 ======================================================================



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

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

Date: Tue, 16 Mar 1999 07:42:32 -0600 (CST)
From: w e b s l a v e <PPRODOEHL@qgraph.com>
Subject: Re: [MacPerl] personal web sharing

I've got a simple little guide to using Personal Web Sharing while offline,
I use it all the time to develop cgi's

   http://www.zymm.com/raster/code/localweb.html


Pete


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

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

Date: Tue, 16 Mar 1999 09:01:24 -0500
From: "Quentin Smith" <macmania@bit-net.com>
Subject: Re: [MacPerl] personal web sharing

I should point out that you can always use the special address 127.0.0.1 to
mean your own computer

- -----BEGIN GEEK CODE BLOCK----
Version: 3.12
GCS d s:+ !a C++++ U*+++ P++++ L+ E-- W+++ N++ o+ K- w--- O? M++ V? PS PE-
Y-- PGP++ t+ 5 X R tv++ b+++ D I- D? G! e h! r
- -----END GEEK CODE BLOCK-----

- ----------
>From: Allan Greenier <agreenier@snet.net>
>To: jrough@nanospace.com
>Cc: mac-perl@iis.ee.ethz.ch
>Subject: Re: [MacPerl] personal web sharing
>Date: Mon, Mar 15, 1999, 10:46 PM
>

> Actually I just did this tonite! You of course get a different address
> every time you dial up, but other than that I pointed at the CGI, it
> launched MacPerl and then itself.
> Worked like a charm right "out of the box".
>
>
> Allan Greenier
> AutoScript Applications
>
> agreenier@snet.net
> http://www.geocities.com/~autoscript
>
>> Since personal web sharing sets up your mac as a server is there a way
>> to test cgi scripts using this feature?  If there is how do you do it?
>> My ISP has a site I can put my uploaded files but I would like a way to
>> test them out locally any ideas?
>
> ===== Want to unsubscribe from this list?
> ===== Send mail with body "unsubscribe" to macperl-request@macperl.org
>
> 

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

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

Date: Tue, 16 Mar 1999 09:43:23 -0500
From: Morbus Iff <morbus@disobey.com>
Subject: [MacPerl] Personal Web Sharing? Problem?

I just installed the Personal Web Sharing off the 8.5 CD, since the posts
about it piqued my interest. I have been using Quid Pro Quo. Anyways, after
installing it right out of the box, and then running a saved as CGI script
from MacPerl, I got a 400 Bad Request...

Any ideas? I've tried adding a Mime type, although I'm not that positive
what I'm doing...

- ------- <http://www.disobey.com/> ----------- ICQ: 2927491 ----

  CALL ME: Chico's Groove
  FIND ME: <http://www.disobey.com/text/chico's_groove/>
  READ ME: Everything new with Disobey and our lives. From 
          updates of one minor sentence to what movies were
         watched, this is punishment at its finest. Released
        every two weeks, available through email subscription. 
  
- -12------------<\/>-------------- Disobey Section 08 of 10 ----

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

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

Date: Thu, 11 Mar 1999 08:45:20 -0800
From: Greg Bartlett <gbartlett@metapath.com>
Subject: RE: [MacPerl] How do I find the day of the week from a given date (NOT today)

I think that this can be simplified to:

- -----
#!perl -w 
use Date::Manip;

my $date = ParseDateString("15 Mar 1999");
print UnixDate($date, "%A");
- -----

This is a useful module.

Greg

> -----Original Message-----
> From:	Arved Sandstrom [SMTP:Arved_37@chebucto.ns.ca]
> Sent:	Thursday, March 11, 1999 4:50 AM
> To:	Lars G. Skjellerup
> Cc:	MacPerl - List
> Subject:	Re: [MacPerl] How do I find the day of the week from a given
> date (NOT today)
> 
> On Thu, 11 Mar 1999, Lars G. Skjellerup wrote:
> 
> > I have a small problem (Yet again). How can I find the day of the week
> > from a given date, which is not the date today. If it was the date now
> > it is real easy.
> > 
> > Are there some pearl functions other than localtime(),time() - that
> > might be helpful ? Or do I have to construct my own ?
> > 
> There is always the monolithic, all-capable Date::Manip module. :-)
> 
> I don't use it myself, so the following is a cobble, and parts may be
> round-about, but it works:
> 
> #!perl -w
> 
> use Date::Manip; 
> 
> $date=&ParseDateString("15 Mar 1999");
> $unixdate = &UnixDate($date, "%m %d %y");
> ($m, $d, $y) = split(/ /,$unixdate);
> $day=&Date_DayOfWeek($m,$d,$y); 
> 
> @daynames = ("","Mon","Tue","Wed","Thu","Fri","Sat","Sun"); 
> print "Day = $daynames[$day]\n";
> 
> __END__
> 
> 
> 
> ===== Want to unsubscribe from this list?
> ===== Send mail with body "unsubscribe" to macperl-request@macperl.org

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

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

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


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