[13617] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1027 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 9 01:05:41 1999

Date: Fri, 8 Oct 1999 22:05:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <939445518-v9-i1027@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 8 Oct 1999     Volume: 9 Number: 1027

Today's topics:
    Re: Bug with localtime() in Perl 5.004 and 5.005 <rick.delaney@home.com>
    Re: Bug with localtime() in Perl 5.004 and 5.005 (Ilya Zakharevich)
        Coprocesses anyone? <kumfert@cs.odu.edu>
    Re: Coprocesses anyone? <uri@sysarch.com>
    Re: Easy way to emulate Unix's "sort" command? (Martien Verbruggen)
    Re: Help - Perl regular expression question! (Charles DeRykus)
    Re: Help - Perl regular expression question! <ltl@rgsun40.viasystems.com>
    Re: Help - Perl regular expression question! (Ilya Zakharevich)
    Re: Hosts running Mason and ImageMagic (Martien Verbruggen)
    Re: parenthesizing arguments to grep - BLOCK form (Abigail)
    Re: parenthesizing arguments to grep - BLOCK form (Larry Rosler)
        Perl CGI on windows <cshirash@epri.com>
    Re: Perl CGI on windows <ron@savage.net.au>
    Re: Perl CGI on windows <jeff@vpservices.com>
    Re: Receiving e-Mail Messages via Mail::POP3Client, wit (Paul J. Schinder)
    Re: Sending mail with Perl? <ron@savage.net.au>
    Re: sendmail problem <ltl@rgsun40.viasystems.com>
    Re: set startup page (Kragen Sitaker)
    Re: Spreadsheets. (Kragen Sitaker)
    Re: tool to convert BMPs to GIFs programatically? <tgl@netcom.com>
    Re: Ubi nil vales...  1603   [1/2] <syeates@manuka.cs.waikato.ac.nz>
        while(loop) question.. <amen@hotbacon.com>
    Re: while(loop) question.. <rick.delaney@home.com>
    Re: Wrong?  s/\n\n/#/g; (Kragen Sitaker)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 09 Oct 1999 04:42:58 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Bug with localtime() in Perl 5.004 and 5.005
Message-Id: <37FEC7DB.6018C01A@home.com>

[posted & mailed]

Ilya Zakharevich wrote:
> 
> [A complimentary Cc of this posting was sent to Rick Delaney
> <rick.delaney@home.com>],
> who wrote in article <37FE5F8C.2FE2D568@home.com>:
> >
> > Leap seconds are periodically added to a standard atomic clock 
> > (which I shall call SAC) because there are less than 86400 SAC 
> > seconds in one Earth rotation.
> 
> You probably mean *more*, not *less*.

You are left, er, I mean right.
 
> Now *why* there are less than ??? seconds in one Earth rotation?
> Because the notion of the second was settled down with necessary
> precision some time ago.  That time (50's?) there was exactly 86400
> seconds *on average*.

The standards were being decided in the 50's and 60's but the mean solar
day was actually exactly 86400 seconds in the 1800's.  Or at least, so
some quick web research reveals.

   http://tycho.usno.navy.mil/leapsec.html

> IIRC, There is a predictable part of the drift, and weather-related
> deviations.  IIRC, nowadays on a span of 6 months the total
> unpredictable deviation has the same order of magnitude as the
> predicitable one.  This is why one cannot announce in advance when
> leap seconds will be added.

Links (http://hpiers.obspm.fr/webiers/general/earthor/utlod/UT1.html)
from the above url led me to this bit of info:

    Universal time and length of day are subject to variations due
    to the zonal tides (smaller than 2.5 ms in absolute value), to
    oceanic tides (smaller than 0.03 ms in absolute value), to
    atmospheric circulation, to internal effects and to transfer of
    angular momentum to the Moon orbital motion. 

so it seems you are correct that weather is a factor.  This isn't clear
to me how big a factor, but whatever.
 
> Of course, when earth rotation slows down more and more, the
> predictable part will become larger and larger.  When one Earth
> rotation becomes slower than 86424 IAC seconds in a solar day, you
> will need more than 1 leap second in at least one hour a day.  ;-)

Yes, but by then we will have figured out how to adjust Earth's rotation
to conform to our notion of time, rather than adjust our clocks.  :-0

-- 
Rick Delaney
rick.delaney@home.com


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

Date: 9 Oct 1999 04:56:16 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Bug with localtime() in Perl 5.004 and 5.005
Message-Id: <7tmhtg$fd4$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to Rick Delaney 
<rick.delaney@home.com>],
who wrote in article <37FEC7DB.6018C01A@home.com>:
> > Now *why* there are less than ??? seconds in one Earth rotation?
> > Because the notion of the second was settled down with necessary
> > precision some time ago.  That time (50's?) there was exactly 86400
> > seconds *on average*.
> 
> The standards were being decided in the 50's and 60's but the mean solar
> day was actually exactly 86400 seconds in the 1800's.  Or at least, so
> some quick web research reveals.

>    http://tycho.usno.navy.mil/leapsec.html

Aha, it now becomes "because the tables on which the decision was done
were based on astronomical observations which covered period from 1750
to 1892".  Now it looks almost as stupid as having Perl's time-related
function to have year offset by 1900.  ;-)

If only they waited 10 years so that they would be able to tie the
second to the average earth rotation around 1960, then we would have
leap seconds once a decade, so that these events could be well
predicted...

> > Of course, when earth rotation slows down more and more, the
> > predictable part will become larger and larger.  When one Earth
> > rotation becomes slower than 86424 IAC seconds in a solar day, you
> > will need more than 1 leap second in at least one hour a day.  ;-)
> 
> Yes, but by then we will have figured out how to adjust Earth's rotation
> to conform to our notion of time, rather than adjust our clocks.  :-0

In fact, if *they* can put DST on us, then I wonder whether they could
wait until one accumulates a leap hour to adjust discrepancies.  ;-)

Ilya


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

Date: Fri, 8 Oct 1999 19:27:31 -0400
From: Gary Kumfert <kumfert@cs.odu.edu>
Subject: Coprocesses anyone?
Message-Id: <Pine.SOL.4.05.9910081838220.28709-100000@oxygen.cs.odu.edu>


Hi, 

I'm looking to implement coprocesses 
(see "Advanced Programming in the UNIX Environment"
 by Richard Stevens, Section 14.4, page 441.  (1992)).

Conceptually, I want to run a (non-perl) child process
and redirect its stdin and stdout to my perl script
so I can steer its execution.
What I'd like to write is something like 

	open ( PIPEIN, " | bc | ", PIPEOUT ); #not real perl
	print PIPEIN ("7 + 5\n");
	$result = <PIPEOUT>;
	chop $result;

Note that I can write:
	
	open ( MYPIPE, "| bc > temp.out" );
	print MYPIPE ("7 + 5\n");
	close (MYPIPE); 
	open ( TEMP, "temp.out" );
	$result = <TEMP>;
	
Which is functionally close... However, I want 
my perl script to pump information in and test 
the responses from the program interactively.  Killing the pipe
(ergo the process) to be able to open the output
file is not acceptable.

So I'm stuck in Rich Steven's example using two pipes, 
fork(), and fnctl.  Unfortunately I can't get the
fnctl to work correctly in perl either.
(perl 5.004, Sun Solaris 2.7, sparc processor)

Suggestions anyone?

I just need enough to get the following working.

	your_special_open ( PIPEIN, PIPEOUT, "bc" );
	print PIPEIN ("7 + 5\n");
	$result = <PIPEOUT>;
	chop $result;
	print PIPEIN ("$result *2\n");
	$new_result = <PIPEOUT>;

I should be able to take the rest from there.

Thanks, 

Gary

------------------------------------------------------------------------
	Gary Kumfert,				  <kumfert@cs.odu.edu>
	Dept. of Computer Science	http://www.cs.odu.edu/~kumfert
	Education Bldg. Room 248		office: (757) 683-6064
	Old Dominion University			dept:   (757) 683-3915
	Norfolk, Va 23529			fax:    (757) 683-4900



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

Date: 08 Oct 1999 23:34:10 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Coprocesses anyone?
Message-Id: <x7u2o1mclp.fsf@home.sysarch.com>


IPC::Open2
IPC::Open3

perldoc perlipc

it's not as if no one in the perl world has ever thought about this before you.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: 9 Oct 1999 04:05:14 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Easy way to emulate Unix's "sort" command?
Message-Id: <slrn7vtfj1.12n.mgjv@wobbie.heliotrope.home>

On Fri, 08 Oct 1999 15:43:41 GMT,
	Ilya <ilya@speakeasy.org> wrote:

> You might find it amazing that the FAQs don't satisfy the needs of
> every user - that's why they post here. Quite obvious, don't you
> think?

No, it is not obvious. What is obvious is that many, many questions
posted to this group are in fact answered in the FAQ documentation, or
other parts of the documentation, oftimes literally. Questions that
can not be answered with the FAQ or documentation, don't invoke
referrals to the FAQ. They get answered.

If you're not happy with the FAQs, feel free to contribute to them.

If I thought you knew what it meant, I'd call you a troll.

Martien
-- 
Martien Verbruggen                  | 
Interactive Media Division          | That's funny, that plane's dustin'
Commercial Dynamics Pty. Ltd.       | crops where there ain't no crops.
NSW, Australia                      | 


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

Date: Sat, 9 Oct 1999 01:39:39 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Help - Perl regular expression question!
Message-Id: <FJBBA3.Hvy@news.boeing.com>

In article <7tgon1$m3s$1@nnrp1.deja.com>,  <jennyng@my-deja.com> wrote:
>Hi,
>
>I've spent days to try to get the following w/ no success.  I was
>wondering if anyone knows how to do the following w/ Perl regular
>expression (or any other way w/ Perl):
>
>if (( $pattern in $line ) && ( $pattern in $line is not w/in [bigger
>pattern] )) {
>  replace $pattern w/ $replacement
>}
>
>Example:
>$pattern = "bcd";
>[bigger pattern] is "abcde"
>$line = "lllbcdlllabcdelllbcd";
>$replacement = "wyz";
>The above will change $line to "lllwyzlllabcdelllwyz".
>
>Any help or suggestion is greatly appreciated.  Thank you very much in
>advance.

One trick is hiding the unwanted pattern:   

$line =~ s/$bigger/\0/g;  #something not in the line
$line =~ s/$pattern/$replacement/g;
$line =~ s/\0/$bigger/g;

--
Charles DeRykus


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

Date: 9 Oct 1999 02:44:42 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: Help - Perl regular expression question!
Message-Id: <7tma6q$6kt$1@rguxd.viasystems.com>

Charles DeRykus <ced@bcstec.ca.boeing.com> wrote:
:>In article <7tgon1$m3s$1@nnrp1.deja.com>,  <jennyng@my-deja.com> wrote:
:>>Hi,
:>>
:>>I've spent days to try to get the following w/ no success.  I was
:>>wondering if anyone knows how to do the following w/ Perl regular
:>>expression (or any other way w/ Perl):
:>>
:>>if (( $pattern in $line ) && ( $pattern in $line is not w/in [bigger
:>>pattern] )) {
:>>  replace $pattern w/ $replacement
:>>}
:>>
:>>Example:
:>>$pattern = "bcd";
:>>[bigger pattern] is "abcde"
:>>$line = "lllbcdlllabcdelllbcd";
:>>$replacement = "wyz";
:>>The above will change $line to "lllwyzlllabcdelllwyz".
:>>
:>>Any help or suggestion is greatly appreciated.  Thank you very much in
:>>advance.

:>One trick is hiding the unwanted pattern:   

:>$line =~ s/$bigger/\0/g;  #something not in the line
:>$line =~ s/$pattern/$replacement/g;
:>$line =~ s/\0/$bigger/g;

Arrgggg.  An answer that works but doesn't use the best regexp engine
tools that are available. Your answer is admiribal. I hope the
question is adequatly answered.


-- 
// Lee.Lindley   /// I used to think that being right was everything.
// @bigfoot.com  ///  Then I matured into the realization that getting
////////////////////   along was more important.  Except on usenet.


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

Date: 9 Oct 1999 04:44:33 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Help - Perl regular expression question!
Message-Id: <7tmh7h$f81$1@charm.magnus.acs.ohio-state.edu>

[A complimentary Cc of this posting was sent to lt lindley 
<lee.lindley@bigfoot.com>],
who wrote in article <7tma6q$6kt$1@rguxd.viasystems.com>:
> Arrgggg.  An answer that works but doesn't use the best regexp engine
> tools that are available. Your answer is admiribal. I hope the
> question is adequatly answered.

I always ask myself whether (very much optimized)

  /foo(?<!kfoo(?=d))/;	    # Match foo not inside kfood

can be written more readable and less error-prone.

Ilya


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

Date: 9 Oct 1999 03:57:39 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: Hosts running Mason and ImageMagic
Message-Id: <slrn7vtf4q.12n.mgjv@wobbie.heliotrope.home>

On Fri, 08 Oct 1999 16:21:09 GMT,
	Norman Bunn <norman.bunn@mci.com> wrote:

> Well, let's see.  HTML::MASON is a perl module for component-based
> pages (www.masonhq.com and Web Techniques 10/99) and PerlMagick is a
> perl specific interface to ImageMagick, an image manipulation
> program.  So if I can find a web host that is running the Apache
> extensions that support HTML::MASON and allow execution of
> ImageMagick, then I could run cgi-based perl programs that use
> these.
> 
> I guess that's what this has to do with Perl. :)

Did you read your original post?

Let me quote:

> Does anyone know of a web hosting company running Mason and/or 
> ImageMagic?

No mention of HTML::MASON, No mention of PerlMagick. You mention Mason
(which probably no one here even knows), even though the modules
listen on CPAn (which I just looked up) are listed as Apache::mason
and HTML::Mason. ImageMagick has nothing to do with Perl. PerlMagick
is a module for perl to interface with ImageMagick. Following your
logic, HTML is perl, because there are various modules that Interface
with HTML. CGI is Perl, because of the CGI module. Many forms of
encryption are Perl, because there are modules that do encryption.

Furthermore: You do _not_ ask anything about perl, Perl, Perl modules,
or anything else related to Perl. You ask about the availability of a
'web hosting company' that runs some pieces of software. The fact that
this software has a tangential relationship to perl is irrelevant. 

I'm sorry to be so blunt, but you protest too much.

Martien
-- 
Martien Verbruggen                      |
Interactive Media Division              | "In a world without fences,
Commercial Dynamics Pty. Ltd.           |  who needs Gates?"
NSW, Australia                          |


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

Date: 8 Oct 1999 21:08:42 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: parenthesizing arguments to grep - BLOCK form
Message-Id: <slrn7vt8sh.25u.abigail@alexandra.delanet.com>

Larry Rosler (lr@hpl.hp.com) wrote on MMCCXXIX September MCMXCIII in
<URL:news:MPG.126810c9a73f062c98a064@nntp.hpl.hp.com>:
[] 
[] There are situations where one must disambiguate an anonymous hashref 
[] from a block by prefixing the former with unary plus.  I don't know any 
[] syntax to do the opposite, to designate a block.  


  {;


Abigail
-- 
tie $" => A; $, = " "; $\ = "\n"; @a = ("") x 2; print map {"@a"} 1 .. 4;
sub A::TIESCALAR {bless \my $A => A} #  Yet Another silly JAPH by Abigail
sub A::FETCH     {@q = qw /Just Another Perl Hacker/ unless @q; shift @q}


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: Fri, 8 Oct 1999 21:44:06 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: parenthesizing arguments to grep - BLOCK form
Message-Id: <MPG.126867ddf1a96fde98a065@nntp.hpl.hp.com>

In article <slrn7vt8sh.25u.abigail@alexandra.delanet.com> on 8 Oct 1999 
21:08:42 -0500, Abigail <abigail@delanet.com> says...
> Larry Rosler (lr@hpl.hp.com) wrote on MMCCXXIX September MCMXCIII in
> <URL:news:MPG.126810c9a73f062c98a064@nntp.hpl.hp.com>:
> [] 
> [] There are situations where one must disambiguate an anonymous hashref 
> [] from a block by prefixing the former with unary plus.  I don't know any 
> [] syntax to do the opposite, to designate a block.  
> 
> 
>   {;

So now I know.  Very cool.  That must be the most trenchant two-
character answer ever!

I just found both of these in perlref:

Note how the leading +{ and {; always serve to disambiguate the 
expression to mean either the HASH reference, or the BLOCK. 

So you could have answered 'RTFM', but your answer was half as long as 
that.  :-)

Thanks.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 08 Oct 1999 19:41:09 -0700
From: Chandra Shirashyad <cshirash@epri.com>
Subject: Perl CGI on windows
Message-Id: <37FEAB45.1DBD8EF8@epri.com>

I just installed apache1.4 on Windows but I am unable to get perl cgi to
work. I have set handler as follows:
AddHandler cgi-script .pl
and set the scriptAlias to appropriate directory.

I am getting an error "Could not run script Interpreter: /usr/bin/perl
 ...". Looks like it is looking for a /usr/bin/perl directory just like
on Unix. I have my perl installation on E:\Perl directory. I tried
several things which did not work. Do anyone know how to get this to
work?

Thanks for your help.
Chandra (cshirash@epri.com)



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

Date: Sat, 9 Oct 1999 13:32:56 +1000
From: "Ron Savage" <ron@savage.net.au>
Subject: Re: Perl CGI on windows
Message-Id: <6MyL3.352$D33.1384@ozemail.com.au>

If Perl is or the PATH, the first line of your script can be
    #!perl -w
at least for Apache 1.3.9.

--
Cheers
Ron & Pen Savage
ron@savage.net.au    pen@savage.net.au
http://savage.net.au/index.html
Chandra Shirashyad <cshirash@epri.com> wrote in message
news:37FEAB45.1DBD8EF8@epri.com...
> I just installed apache1.4 on Windows but I am unable to get perl cgi to
> work. I have set handler as follows:
> AddHandler cgi-script .pl
> and set the scriptAlias to appropriate directory.
>
> I am getting an error "Could not run script Interpreter: /usr/bin/perl
> ...". Looks like it is looking for a /usr/bin/perl directory just like
> on Unix. I have my perl installation on E:\Perl directory. I tried
> several things which did not work. Do anyone know how to get this to
> work?
>
> Thanks for your help.
> Chandra (cshirash@epri.com)
>




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

Date: 9 Oct 1999 03:43:24 GMT
From: Jeff Zucker <jeff@vpservices.com>
To: Chandra Shirashyad <cshirash@epri.com>
Subject: Re: Perl CGI on windows
Message-Id: <37FEB98D.5663A4B6@vpservices.com>

[posted and emailed]

Chandra Shirashyad wrote:
> 
> I just installed apache1.4 on Windows but I am unable to get perl cgi to
> work...
>
> I am getting an error "Could not run script Interpreter: /usr/bin/perl
> ...". Looks like it is looking for a /usr/bin/perl directory just like
> on Unix. I have my perl installation on E:\Perl directory.

Change the shebang (first) line in your cgi scripts to show the actual
location of the Perl executbale.  It can be something like this:

	#!e:/perl/5.005/bin/mswin32-x86-object/perl -wT

Or, if it is in your path (and the path of the user the apache server
runs as):

	#!perl -wT

-- 
Jeff


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

Date: Sat, 09 Oct 1999 02:15:58 GMT
From: schinder@leprss.gsfc.nasa.gov (Paul J. Schinder)
Subject: Re: Receiving e-Mail Messages via Mail::POP3Client, with MacPerl.
Message-Id: <yzxL3.1761$N64.48858@dfw-read.news.verio.net>

In <1dzch5f.1yzenb928za4iN@dialup0225-pri.voicenet.com> sleidy_keinSpam_@_bitte_voicencet.com (Samuel) writes:

>I have written the followoing:

>----- Code starts here -----

>#!perl #-w              # the Hash is purposely added before '-w'

># First Time attemp to use Mail::POP3 Object Methods.
># 08.10.1999 Samuel J. W. Leidy

>use strict;
>use Mail::POP3Client;

Last time I looked, Mail::POP3Client wasn't platform portable.  There are
end-of-line issues; the author doesn't seem to know that there's a difference
between "\r\n" and "\015\012".

You'll be much happier using Net::POP3, which comes with MacPerl and
is platform portable.  It's part of the libnet package. An old version
comes with MacPerl; you'll probably be happier using the latest
version, which you can get from any CPAN archive.

[snip]

>-----
> 
>Any guidance is appreciated, 

>Samuel
--
Paul J. Schinder 
NASA Goddard Space Flight Center 
schinder@leprss.gsfc.nasa.gov 


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

Date: Sat, 9 Oct 1999 13:35:15 +1000
From: "Ron Savage" <ron@savage.net.au>
Subject: Re: Sending mail with Perl?
Message-Id: <gOyL3.353$D33.1576@ozemail.com.au>

There's a mail tutorial on my web site.

--
Cheers
Ron & Pen Savage
ron@savage.net.au    pen@savage.net.au
http://savage.net.au/index.html





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

Date: 9 Oct 1999 02:29:17 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: sendmail problem
Message-Id: <7tm99t$6a0$1@rguxd.viasystems.com>

Kragen Sitaker <kragen@dnaco.net> wrote:
:>In article <7tm2eu$4f3$1@rguxd.viasystems.com>,
:>lt lindley  <lee.lindley@bigfoot.com> wrote:
:>>Welcome back Kragen.  Been on holiday?

:>Rather the reverse -- been busy at work, got a new dog, and just busy
:>all around.  Thanks for asking!

Love of a new dog is something almost everyone can relate to.
I have an old dog and he is still complex in his requirements.  :-)

:>>// Lee.Lindley   /// I used to think that being right was everything.
:>>// @bigfoot.com  ///  Then I matured into the realization that getting
:>>////////////////////   along was more important.  Except on usenet.

:>Heh.  :)

Thanks for being the first to notice.  I thought it was pretty clever,
but now you have put the pressure on me to think of a better one.

Hmmm.  I fail for now.  That was my best shot.  I may be doomedd
to "sig mediocracy" for a while.

Manana.

-- 
// Lee.Lindley   /// I used to think that being right was everything.
// @bigfoot.com  ///  Then I matured into the realization that getting
////////////////////   along was more important.  Except on usenet.


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

Date: Sat, 09 Oct 1999 02:47:29 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: set startup page
Message-Id: <51yL3.10163$eM4.674763@typ11.nn.bcandid.com>

In article <37FD18E6.7B092625@mail.cor.epa.gov>,
David Cassell  <cassell@mail.cor.epa.gov> wrote:
>a1234_ec@yahoo.com wrote:
>> Is it possible to write a perl script to automatically set a browser's
>> startup page?
>
>No, it is not.  Perl works on the server side, not the client
>side.  You would have to do this via something like JavaScript.

You can run Perl scripts on the client side just as easily as you can
on the server side.  On a Unix machine running Netscape 4.06, you can
use a script something like this:

#!/usr/bin/perl -w
use strict;
my $homedir = $ENV{HOME};
die "no homedir\n" unless $homedir;
my $prefsfile = "$homedir/.netscape/liprefs.js";
if (not -e $prefsfile) {
	die "$prefsfile doesn't exist; maybe you don't run Netscape 4.06?\n";
}

open OLDPREFS, "<$prefsfile" or die "Can't open $prefsfile: $!\n";
# warning: race condition here.  don't run two copies of this script at once.
open NEWPREFS, ">$prefsfile.new" or die "Can't open $prefsfile.new: $!\n";

my $newhomepage = "http://pobox.com/~kragen/hotlist.html";

while (<OLDPREFS>) {
	if (m#^(user_pref\("browser\.startup\.homepage",\s*").*"\);$#) {
		print NEWPREFS qq[$1$newhomepage");\n] or die "write error on $prefsfile.new: $!\n";
	} else {
		print NEWPREFS $_ or die "write error on $prefsfile.new: $!\n";
	}
}

close OLDPREFS;
close NEWPREFS or die "write error on $prefsfile.new: $!\n";

rename "$prefsfile.new", $prefsfile or die "Can't rename $prefsfile.new to $prefsfile: $!\n";

This doesn't check for the file not having the expected format, though;
it'll happily not make any changes if the format is funky, and print no
error message.

>If you're doing this to the unwary, then I'm glad I have
>JavaScript turned off in all my JavaScript-capable browsers.

Ditto.  (See the JavaScript code in the page I set as the homepage URL
above.)
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: Sat, 09 Oct 1999 02:15:25 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Spreadsheets.
Message-Id: <1zxL3.10115$eM4.669118@typ11.nn.bcandid.com>

In article <37FE3E59.4FEFCB7F@mail.cor.epa.gov>,
David Cassell  <cassell@mail.cor.epa.gov> wrote:
>Kangas wrote:
>> Other than Excel what spreadsheets can perl connect with??
>
>Any win32 spreadsheet which speaks OLE .  Which means almost any
>modern version of a win32 spreadsheet.  I dunno about MacPerl
>and Mac spreadsheets.  I have yet to find a need to make Perl
>speak with a unix spreadsheet, but YMMV.

It can externally control any win32 spreadsheet that speaks OLE.  It
can exchange data with any spreadsheet you please, because essentially
all spreadsheets can read and write CSV, and so can Perl.  (If Tom were
still around, he'd tell you it's not really CSV, and he'd be right, but
it wouldn't matter.)


-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: 09 Oct 1999 00:14:37 -0400
From: Tom Lane <tgl@netcom.com>
Subject: Re: tool to convert BMPs to GIFs programatically?
Message-Id: <uo9wvsxcgr6.fsf@netcom3.netcom.com>

xxxxx@cris.com (J. A. Mc.) writes:
> My thought was thay perhaps he could use the .jpg form instead, and
> explained one such usage.

> No, it's NOT a party trick, just because _you_ have no use for it.

Alan was making the entirely correct point that if you want to go
from BMP to GIF, JPEG is a horrible choice of waystation.

I take it _you_ have no use for actually knowing anything about the
strengths and weaknesses of the image formats you use?

			regards, tom lane
			organizer, Independent JPEG Group


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

Date: 9 Oct 1999 02:26:43 GMT
From: Stuart Yeates <syeates@manuka.cs.waikato.ac.nz>
Subject: Re: Ubi nil vales...  1603   [1/2]
Message-Id: <939436002.124092@clint.waikato.ac.nz>

Uri Guttman <uri@sysarch.com> wrote:

: anyone else notice this new breed of usenet spam? the subjects all seem
: to have a integer in them which changes from group to group. also the
: body always contains some gibberish string which changes. fortunaetly
: many don't even have real content. it feels like someone is marketing a
: counter spam operation given the past history of spam filters on
: usenet. i bet the usenet masters know about this but some are still
: getting thru like this one. if anyone knows the usenet masters please
: relay this to them.

it's a classic case of a technical fix (anti-spaming) failing
to fix a social problem (different ideas on what usenet is 
`for'). now the two are locked into a darwinesque struggle
as increasingly complex spam generators fight increasingly
complex spam blockers. 

generally speaking the spam blockers are hampered by being 
in the right and needing to maintain the high moral ground.

stuart
--    stuart yeates <s.yeates@cs.waikato.ac.nz> aka `loam'
                       carpe noctem
X-no-archive:yes


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

Date: Fri, 08 Oct 1999 21:24:47 -0700
From: Alex Menendez <amen@hotbacon.com>
Subject: while(loop) question..
Message-Id: <37FEC38E.F165120F@hotbacon.com>

Hello, all

I am currently trying to write a database module that uses DBI. I am
trying to create a  method that returns a list of arrays much like
fetchrow_array in this DBI example:

         while (($name, $phone) = $sth->fetchrow_array) {
             print "$name: $phone\n";
         }

Although I am returning an undef list (I have tried to just explicitly
return undef as well!), my while loop gets stuck in an infinite loop
after the first results set. What am I missing about terminating a while
loop? Here is the sample cgi code:

my $hot    = new HOT(DB, USER, PASSWD);
my $schema = $hot->get_schema || print $hot->get_error;
for($hot->get_tables($schema)) {
    print "<B>${_}</B><BR>\n"
    while(($field,$type)=$hot->get_fields($schema,$_)) {
        print "${field} ${type}<BR>\n";
    }
    print "<P>\n";
}

Here is the get_fields method in the HOT package:
Note: $schema is a pointer to a 2 D hash{db_name}{table_name} whose
values are pointers two a 1 D hash{field_name} whose value is the field
type.

sub get_fields {
    my($hot)    = shift;
    my($schema) = shift;
    my($table)  = shift;

    if(!$hot->{'cursor'}) {
        $hot->{'cursor'} =
$#{[keys(%{$$schema{$schema->get_db}{$table}})]};
    } else {
        $hot->{'cursor'}--;
    }

    return
@{[keys(%{$$schema{$schema->get_db}{$table}})]}[$hot->{'cursor'}],
${$$schema{$schema->get_db}{$table}}{@{[keys(%{$$schema{$schema->get_db}{$table}})]}[$hot->{'cursor'}]};

}

thanx, amen





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

Date: Sat, 09 Oct 1999 05:04:14 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: while(loop) question..
Message-Id: <37FECCD7.199D7935@home.com>

[posted & mailed]

Alex Menendez wrote:
> 
>          while (($name, $phone) = $sth->fetchrow_array) {
>              print "$name: $phone\n";
>          }
> 
> Although I am returning an undef list (I have tried to just explicitly
> return undef as well!), my while loop gets stuck in an infinite loop
> after the first results set. What am I missing about terminating a while
> loop? 

That (undef, undef) is not false.  You want to return an empty list in
list context, not a list of undefs.
 
>     return
> @{[keys(%{$$schema{$schema->get_db}{$table}})]}[$hot->{'cursor'}],

This is an array slice of one element, and will always return one
element, even if undef.

> ${$$schema{$schema->get_db}{$table}}..........

This is a scalar and so will always return one item, even if undef. 
Thus you will always be returning a two item list here.

You should set the sub up so that it returns () in list context when it
should return false.  A bare

    return;

is usually best for this since then it will do the right thing in scalar
context also.

perldoc -f return

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Sat, 09 Oct 1999 02:25:01 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Wrong?  s/\n\n/#/g;
Message-Id: <1IxL3.10133$eM4.671268@typ11.nn.bcandid.com>

In article <glrit7.a5m.ln@magna.metronet.com>,
Tad McClellan <tadmc@metronet.com> wrote:
>   If the file is not too large, you can slurp the entire thing
>   into memory, do the substitution, and print it out:
>
>      perl -007pe 's/\n\n/#/g' data       # same as setting $/=undef;

This will probably work, but the comment is wrong; \007 is the BEL
character, which beeps when printed.  ITYM -0777, not -007.
-- 
<kragen@pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
Fri Oct 08 1999
32 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 1027
**************************************


home help back first fref pref prev next nref lref last post