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

MacPerl-Digest V1 #13




MacPerl-Digest         Monday, March 15 1999         Volume 01 : Number 013



[MacPerl] Netscape::History
Re: [MacPerl] Netscape::History
[MacPerl] Strengthen your marriage or relationship
Re: [MacPerl] Another elementary question
Re: [MacPerl] Another elementary question
Re: [MacPerl] AppleScript front end to MacPerl

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

Date: Sat, 13 Mar 1999 16:41:39 -0800 (PST)
From: Chris Seidel <seidel@pangloss.com>
Subject: [MacPerl] Netscape::History

Has anyone used the Netscape::History module? I downloaded History.pm and
HistoryURL.pm and placed them in: MacPerl Ÿ:lib:Netscape:

when I try the script below, none of the values of seconds returned make
any sense.
- ---------------------------------------------
use Netscape::History;

my $history;
my $url;

   while (defined($url = $history->next_url() )){
        print "$url :\n";
        print "    First  : ", $url->first_visit_time();
        print "    Last   : ", $url->last_visit_time();
        print "    Count  : ", $url->visit_count(), "\n";
        print "    Expire : ", $url->expire(), "\n";
        print "    Title  : ", $url->title(), "\n";
   }
   $history->close();
- ---------------------------------------------
Sample Output:
http://www.pangloss.com/seidel/MTandem/ :
    First  : 1179901494    Last   : 24570422    Count  : 1728053248
    Expire : 16777216
    Title  : Tandem Story

i.e. I know I visited the link above *today* and none of values of seconds
make any sense.

Has anyone else used this module and had luck with it? I was thinking of
writing a script to run at start up that parses my history file and makes a
small probability tree of links I'm likely to need/go to based on my
history, which would then be incorporated into my browser start up page.

- -Chris Seidel

Dept of Molecular and Cell Biology      "Information wants to be free."
UC Berkeley  * Kane Lab 614 Barker Hall



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

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

Date: Sat, 13 Mar 1999 21:05:39 -0500
From: "Paul J. Schinder" <schinder@pobox.com>
Subject: Re: [MacPerl] Netscape::History

At 4:41 PM -0800 3/13/99, Chris Seidel wrote:

} Has anyone used the Netscape::History module? I downloaded History.pm and
} HistoryURL.pm and placed them in: MacPerl Ÿ:lib:Netscape:
}
} when I try the script below, none of the values of seconds returned make
} any sense.
} ---------------------------------------------
} use Netscape::History;
}
} my $history;
} my $url;
}
}    while (defined($url = $history->next_url() )){
}         print "$url :\n";
}         print "    First  : ", $url->first_visit_time();
}         print "    Last   : ", $url->last_visit_time();
}         print "    Count  : ", $url->visit_count(), "\n";
}         print "    Expire : ", $url->expire(), "\n";
}         print "    Title  : ", $url->title(), "\n";
}    }
}    $history->close();
} ---------------------------------------------
} Sample Output:
} http://www.pangloss.com/seidel/MTandem/ :
}     First  : 1179901494    Last   : 24570422    Count  : 1728053248
}     Expire : 16777216
}     Title  : Tandem Story
}
} i.e. I know I visited the link above *today* and none of values of seconds
} make any sense.

The problem is that Netscape counts time in Unix time.  You have to make
the proper conversion in order to get the Mac time right.

I don't have any interest in porting this, but there is a HTTP::Cookies
module that's part of libwww-perl-5 that I did port.  You can see what to
do there (search for "MacOS" and $offset).  It's very straightforward, a
simple offset which can be computed by Time::Local::timelocal(),
complicated only because the Mac zero of time is in the local time while
Unix is GMT.  Go to http://pudge.net/mmp for the location of the port.

}
} Has anyone else used this module and had luck with it? I was thinking of
} writing a script to run at start up that parses my history file and makes a
} small probability tree of links I'm likely to need/go to based on my
} history, which would then be incorporated into my browser start up page.
}
} -Chris Seidel
}
} Dept of Molecular and Cell Biology      "Information wants to be free."
} UC Berkeley  * Kane Lab 614 Barker Hall
}
}



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

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

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

Date: Sun, 14 Mar 1999 01:01:11 EST
From: FPaxtonjr@aol.com
Subject: [MacPerl] Strengthen your marriage or relationship

- ------------------------------------------------------------------------------
- ---------------------------
- -Increase your sexual potential

- -Strengthen your marriage or relationship

- -Increase lust and romance

- -Better foreplay

- -Exercises anyone can do

- -Increase passion and desire

- -Be able to have sex more times a day

- -Satisfy your partners needs

Its time to put futher enjoyment into your life, time is limited so use it to
its full pleasure.
Order our informational guide to Strengthen your marriage or relationship for
our print value of $9.00.  We will rush your guide to you within days of
receiving your payment.  Ordering instructions are below.

Order by mail send payment to:

K.C. Smith
10 East Louisiana
Evansville, IN  47711

Make sure to write your address twice to ensure delivery.








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

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

Date: Sun, 14 Mar 1999 09:25:17 -0600
From: Greenblatt & Seay <g-s@navix.net>
Subject: Re: [MacPerl] Another elementary question

>>Replace the unwanted newlines before giving the file to your script.
>
>That gets me wondering.  What if he doesn't want to have to run two
>scripts?  What's the easiest way to perform
>
>  cr_filter < infile | analysis_program
>
>under MacPerl?  Winners, if any, by concensus...
>

I don't see how the pure MacPerl solutions submitted so far would simplify
Noe's life. They would require extra code for his Macperl program if it
must "know what is in the file".

I really think two scripts would be best. A Hypertalk script is most likely
what created Noe's text file in the first place. Nevertheless, here are a
couple of unlikely possibilities...

 - A MacPerl program could read the original Hypercard stack (file) and if
you knew or could determine its file structure you could weed out any
Hypertalk stack code, background(s) code, card code, card and background
field and button code and name, location, size, etc., etc., etc. so you
could retrieve the data for each field for each record.

 - One could use Hypercard's "Save a Copy..." menu item and by selecting
"Custom File Type" save the Hypertalk text as well as code. You have to
deal with similar problems as mentioned in the first possibility.

A pure MacPerl approach could be achieved but would require considerable
more code than it would if a MacPerl script cooperated with a Hypertalk
script. Maybe Hypercard's file formats are available publically. If anyone
knows of such please email me of how I can obtain them and hopefully I'll
find time to create a module to allow MacPerl easy access to Hypercard's
treasures without getting Hypercard involved.

My suggested two script (one Hypertalk, one MacPerl) solution...

A Hypertalk program could selectively gather data from each of a Hypercard
card's fields and write something unique like 'XZX' after writing the
field's data and something like 'ZXZ' after writing all data for Hypercard
card.

  open file FILENAME
    write bkgnd fld "whatever1" & "XZX" to file FILENAME
    write bkgnd fld "whatever2" & "XZX" to file FILENAME
    write "ZXZ" to file FILENAME
  close file FILENAME


If the file is not too large your MacPerl program can read the resulting
text file all at once and then split on 'ZXZ' to create an array of record
and then split each record on 'XZX' to create an array with each
Hypercard's field.

  open(FILEDATA, "$file_path") || die "No $file_path: $!";
    $file_data_fork_size = -s $file_path;
    $buffer = read(FILEDATA, $read_results, $file_data_fork_size, 0);
  close(FILEDATA);
  @records = split("ZXZ", $read_results);

  for($i=0;$i<@file_lines;$i++){
    @fields = split("XZX", $records[$i]);
    # DO SOMETHING
  }


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

Later,
David Seay
http://www.mastercall.com/g-s




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

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

Date: Sun, 14 Mar 1999 10:52:40 -0500
From: Chris Nandor <pudge@pobox.com>
Subject: Re: [MacPerl] Another elementary question

At 10.25 -0500 1999.03.14, Greenblatt & Seay wrote:
>A pure MacPerl approach could be achieved but would require considerable
>more code than it would if a MacPerl script cooperated with a Hypertalk
>script.

I don't see this as a problem.  Stick it in a module, "use MyModule", and
then you're set.

- --
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 08:35:53 +0000
From: "Jay Bedsole" <rwdd30@email.sps.mot.com>
Subject: Re: [MacPerl] AppleScript front end to MacPerl

To all who've asked and those who didn't...

Quentin Smith has graciously agreed to put my AppleScript front
end to MacPerl (cli4mp) on his site. You can download a zipped
version from:

    http://members.tripod.com/ComClub/cli4mp.zip

Thanks Quentin!


One caveat. Over the weekend, I seemed to have found a bug.
Or maybe it's a limitation...

I haven't been able to investigate very thoroughly, but the
problem seems to be with larger MacPerl scripts. When I try
to run cli4mp with a larger perl script, AppleScript quits
unexpectedly with error type 2. Not before, however it sends
a mutated version of the script to MacPerl (well I think it's
mutated). In this particular script, there are some messages
that print out from a subroutine at the end of the file and
these print OK, but the script never terminates... it just
keeps on chugging, doing God knows what. I haven't tried to
debug it yet.

I haven't figured out what the boundary conditions are, but I
ran a number of perl scripts in the half a K range with no
problem and one that was about 4K which caused the problem.
When I run this same script from Alpha (with it's command line
arg interface) it works just fine, so I'm reasonably sure
there's not a problem with the script, per se.

Still, it seems to work for smaller test scripts, which is
what I designed it for in the first place... (he said,
rationalizing in a feeble attempt to preserve his ego...)


jay

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

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

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


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