[13773] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1183 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 27 22:02:26 1999

Date: Wed, 27 Oct 1999 19:02:14 -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: <941076134-v9-i1183@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 27 Oct 1999     Volume: 9 Number: 1183

Today's topics:
        How can I read a line character by character? <Jing.Shi@usa.alcatel.com>
    Re: How can I read a line character by character? (Abigail)
    Re: How can I read a line character by character? <dchristensen@california.com>
    Re: How can I read a line character by character? (Craig Berry)
    Re: How can I read a line character by character? (Michael Budash)
    Re: How can I read a line character by character? <arthur.haas@westgeo.com>
    Re: How can I read a line character by character? (Brett W. McCoy)
    Re: How can I read a line character by character? <r28629@email.sps.mot.com>
        How can I send an email attachment, not a message with  <speter@ford.com>
    Re: How can I send an email attachment, not a message w (Jenda Krynicky)
    Re: How can I send an email attachment, not a message w (I.J. Garlick)
    Re: How can I send an email attachment, not a message w (Michael Budash)
    Re: How can I send an email attachment, not a message w (Michael Budash)
        How do I run a Perl script on an NT server? <inettgc@boat.bt.com>
    Re: How do I run a Perl script on an NT server? <gellyfish@gellyfish.com>
    Re: How do I run a Perl script on an NT server? (A.J. Norman)
    Re: How do I run a Perl script on an NT server? <2bunnyhop@home.com>
        How do i sort by date? <poohba@io.com>
    Re: How do i sort by date? <lr@hpl.hp.com>
    Re: How do i sort by date? (Eric Bohlman)
    Re: How do i sort by date? (David Annis)
    Re: How do i sort by date? <lr@hpl.hp.com>
        How do you create pop-up box in browser? tmcandr@sears.com
    Re: How do you create pop-up box in browser? (Philip 'Yes, that's my address' Newton)
    Re: How do you create pop-up box in browser? (Bart Lateur)
    Re: How do you create pop-up box in browser? damonmiller@my-deja.com
    Re: How do you create pop-up box in browser? (Michael Budash)
    Re: How do you create pop-up box in browser? <AgitatorsBand@yahoo.com>
        how to emulate Java's byte array? ()
        How to get numeric timezone offset ??? (Todd Olson)
    Re: How to get numeric timezone offset ??? <lr@hpl.hp.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Mon, 25 Oct 1999 15:10:56 -0400
From: Jing Shi <Jing.Shi@usa.alcatel.com>
Subject: How can I read a line character by character?
Message-Id: <3814AB40.7A2FC4A3@usa.alcatel.com>

Is there a way I can read in a line from a file character by character?
For example, get the first 20 characters from each line?

Thanks







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

Date: 25 Oct 1999 22:10:56 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: How can I read a line character by character?
Message-Id: <slrn81a6t7.fji.abigail@alexandra.delanet.com>

Jing Shi (Jing.Shi@usa.alcatel.com) wrote on MMCCXLVI September MCMXCIII
in <URL:news:3814AB40.7A2FC4A3@usa.alcatel.com>:
{} Is there a way I can read in a line from a file character by character?
{} For example, get the first 20 characters from each line?


Nah, I don't think Perl has anything resembling `read', or would it?

Better look it up to be sure!


Abigail
-- 
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
         ${qq$\x5F$} = q 97265646f9 and s g..g;
         qq e\x63\x68\x72\x20\x30\x78$&eggee;
         {eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'


  -----------== 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: Mon, 25 Oct 1999 16:25:14 -0700
From: "David Christensen" <dchristensen@california.com>
Subject: Re: How can I read a line character by character?
Message-Id: <7v2o04$bkn$1@pollux.dnai.com>

>> Is there a way I can read in a line from a file character by
>> character?

> my $substring = substr($_,0,20);


The standard trick for breaking the substring into characters is:

    my @chars = split //, $substring;

--
David Christensen
dchristensen@california.com





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

Date: Mon, 25 Oct 1999 23:54:34 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How can I read a line character by character?
Message-Id: <s19rdqmlgbb60@corp.supernews.com>

Jing Shi (Jing.Shi@usa.alcatel.com) wrote:
: Is there a way I can read in a line from a file character by character?
: For example, get the first 20 characters from each line?

Almost always, it's more efficient to read line by line, then takes the
lines apart as needed.  For example:

  while (<>) {
    my $first20 = substr $_, 0, 20;
    # do something with first 20 characters of this line...
  }

-- 
   |   Craig Berry - cberry@cinenet.net
 --*--  http://www.cinenet.net/users/cberry/home.html
   |   "They do not preach that their God will rouse them
      a little before the nuts work loose." - Kipling


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

Date: Mon, 25 Oct 1999 13:01:25 -0700
From: mbudash@wcws.com (Michael Budash)
Subject: Re: How can I read a line character by character?
Message-Id: <mbudash-2510991301250001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>

In article <3814AB40.7A2FC4A3@usa.alcatel.com>, Jing Shi
<Jing.Shi@usa.alcatel.com> wrote:

> Is there a way I can read in a line from a file character by character?
> For example, get the first 20 characters from each line?
> 
> Thanks

open (FILE, $file) or die;
while ($first20 = substr(<FILE>, 0, 20)) {
 # do something with $first20
 }
close (FILE);

hth-
-- 
Michael Budash ~~~~~~~~~~ mbudash@wcws.com


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

Date: 25 Oct 1999 15:04:54 -0500
From: Art Haas <arthur.haas@westgeo.com>
Subject: Re: How can I read a line character by character?
Message-Id: <lrd7u3nr4p.fsf@yoda.wg.waii.com>

Jing Shi <Jing.Shi@usa.alcatel.com> writes:

> Is there a way I can read in a line from a file character by character?
> For example, get the first 20 characters from each line?
> 
> Thanks

#!/usr/local/bin/perl

use strict;

my $file = '/your/file/here';
open(FILE,"<$file") || die "Can't open '$file'! $!\n";
while(<FILE>) {
	my $substring = substr($_,0,20);
        ... do neat stuff ...
}
close(FILE);

-- 
###############################
# Art Haas
# (713) 689-2417
###############################


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

Date: Mon, 25 Oct 1999 20:34:50 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: How can I read a line character by character?
Message-Id: <slrn819g06.vi9.bmccoy@moebius.foiservices.com>

Also Sprach Jing Shi <Jing.Shi@usa.alcatel.com>:

>Is there a way I can read in a line from a file character by character?
>For example, get the first 20 characters from each line?

use the substr() function:

open(INPUT, "inputfile");
while <INPUT> {
	$first_20 = substr($_, 0, 20);
	#do stuff
}


-- 
Brett W. McCoy                             bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek)   http://www.foiservices.com
FOI Services, Inc./DIOGENES                301-975-0110
---------------------------------------------------------------------------


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

Date: Mon, 25 Oct 1999 15:38:24 -0500
From: Tk Soh <r28629@email.sps.mot.com>
Subject: Re: How can I read a line character by character?
Message-Id: <3814BFC0.86A062BB@email.sps.mot.com>

Jing Shi wrote:
> 
> Is there a way I can read in a line from a file character by character?
> For example, get the first 20 characters from each line?
> 
> Thanks

if you really mean character by character:

    perldoc -f split

-TK


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

Date: Mon, 25 Oct 1999 14:36:45 -0400
From: SarAna Peter <speter@ford.com>
Subject: How can I send an email attachment, not a message with sendmail?
Message-Id: <3814A33D.A01B39F3@ford.com>

The following piece of perl script works fine for taking form fields and
emailing the results in the body.  However, I want to send an email
attachment (HTML formatted) and not a message.  I've tried opening a
file and sending it but it reads it with tags literally into the body. 
I can't find any answers in the Camel Book or Cookbooks.  Any ideas?
(I'm using SENDMAIL)

  open (MAIL, "|$mailprog") || die "Can't open $mailprog!\n";
  print MAIL "To: $mail_to\n";
  print MAIL "Subject:  $subject\n";
  print MAIL "From: $nominator_email\n";
  print MAIL "The following employee nomination was generated:\n";
   
  foreach $name ($query->param()) {
      $value = $query->param($name);
      print MAIL "$name = $value \n";
  }
  close (MAIL);


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

Date: Tue, 26 Oct 1999 20:48:06 GMT
From: Jenda@Krynicky.cz (Jenda Krynicky)
Subject: Re: How can I send an email attachment, not a message with sendmail?
Message-Id: <1105_940970886@prague_main>

On Mon, 25 Oct 1999 14:36:45 -0400, SarAna Peter <speter@ford.com> wrote:
> The following piece of perl script works fine for taking form fields and
> emailing the results in the body.  However, I want to send an email
> attachment (HTML formatted) and not a message.  I've tried opening a
> file and sending it but it reads it with tags literally into the body. 
> I can't find any answers in the Camel Book or Cookbooks.  Any ideas?
> (I'm using SENDMAIL)

You may use either Mail::Sender (http://jenda.krynicky.cz or CPAN)
or MIME-lite (CPAN)

Jenda
http://Jenda.Krynicky.cz



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

Date: Tue, 26 Oct 1999 08:04:46 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: How can I send an email attachment, not a message with sendmail?
Message-Id: <FK7AFy.AzJ@csc.liv.ac.uk>

In article <mbudash-2510991329040001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>,
mbudash@wcws.com (Michael Budash) writes:
>     print MAIL "Content-type: text/html\n\n";

You were doing great upto this point.

> if you really want a blank message with an attachment, an alternative
> would be use use a module such as MIME::Lite.

Then you went and spoilt it by claiming she wanted to send a blank message
with an attachment. The above message would make it a text/html, that's
all. I suppose if you really want to split hairs it is an attachment but
by that deffinition so is a text/plain message. Just because you don't
usually put the text/plain in because it's a default doesn't mean it's not
there.

I think most people think of attachments as some kind of multipart
message, wrongly I agree, but then saying something is a blank message
with an attachment is wrong as well.

-- 
Ian J. Garlick
ijg@csc.liv.ac.uk

senility, n.:
	The state of mind of elderly persons with whom one happens to disagree.



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

Date: Tue, 26 Oct 1999 01:51:11 -0700
From: mbudash@wcws.com (Michael Budash)
Subject: Re: How can I send an email attachment, not a message with sendmail?
Message-Id: <mbudash-2610990151120001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>

In article <FK7AFy.AzJ@csc.liv.ac.uk>, ijg@connect.org.uk (I.J. Garlick) wrote:

> In article
<mbudash-2510991329040001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>,
> mbudash@wcws.com (Michael Budash) writes:
> >     print MAIL "Content-type: text/html\n\n";
> 
> You were doing great upto this point.
> 

gee thanks

> > if you really want a blank message with an attachment, an alternative
> > would be use use a module such as MIME::Lite.
> 
> Then you went and spoilt it by claiming she wanted to send a blank message
> with an attachment. 

"claiming"? well, she did say:

>>> However, I want to send an email
>>> attachment (HTML formatted) and not a message.

not that i know what the heck that even means!

> The above message

you mean "the above header"?

> would make it a text/html, that's
> all. I suppose if you really want to split hairs it is an attachment but
> by that deffinition so is a text/plain message.

uh, yeah... ok... where you goin' here?

> Just because you don't
> usually put the text/plain in because it's a default doesn't mean it's not
> there.
> 

uh, yeah...

> I think most people think of attachments as some kind of multipart
> message, wrongly I agree,

not sure i agree with that, but let's go on...

> but then saying something is a blank message
> with an attachment is wrong as well.
> 

look - afaict, she at the very least wanted to send a message that an
html-savvy mailreader can understand. so she needs a "Content-type:
text/html" header, in *whatever* complete message is sent, be it one part
or multipart. i simply couldn't really tell from her post which it was she
was talking about (single- or multi-part), so i mentioned a module i
thought might be of further help in case it really was multi-part.

are you happy yet?
-- 
Michael Budash ~~~~~~~~~~ mbudash@wcws.com


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

Date: Mon, 25 Oct 1999 13:29:04 -0700
From: mbudash@wcws.com (Michael Budash)
Subject: Re: How can I send an email attachment, not a message with sendmail?
Message-Id: <mbudash-2510991329040001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>

In article <3814A33D.A01B39F3@ford.com>, SarAna Peter <speter@ford.com> wrote:

> The following piece of perl script works fine for taking form fields and
> emailing the results in the body. 

no it doesn't (see below)

> However, I want to send an email
> attachment (HTML formatted) and not a message.  I've tried opening a
> file and sending it but it reads it with tags literally into the body. 
> I can't find any answers in the Camel Book or Cookbooks.  Any ideas?
> (I'm using SENDMAIL)
> 
>   open (MAIL, "|$mailprog") || die "Can't open $mailprog!\n";
>   print MAIL "To: $mail_to\n";
>   print MAIL "Subject:  $subject\n";
>   print MAIL "From: $nominator_email\n";
                                        ^
you need another newline here...........^ just to make *this* work. if you
want the message to be interpreted as html, you could leave that line
as-is, and add this one after it:

    print MAIL "Content-type: text/html\n\n";

[snip]

if you really want a blank message with an attachment, an alternative
would be use use a module such as MIME::Lite.

hth-
-- 
Michael Budash ~~~~~~~~~~ mbudash@wcws.com


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

Date: Tue, 26 Oct 1999 11:50:06 +0100
From: "Roy Orbison" <inettgc@boat.bt.com>
Subject: How do I run a Perl script on an NT server?
Message-Id: <7v4134$3ae$1@pheidippides.axion.bt.co.uk>

I've only used Unix servers before and have no idea how to get a Perl script
to run on an NT server. I've no access to the server other than for putting
stuff on it. I assume that there are standard places where a Perl
interpreter is put. Also I guess the first line of the script will no longer
be

#!/usr/local/bin/perl

What sh(c)ould it be? Anything else I need to know? Anywhere to look?

Thanks






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

Date: 26 Oct 1999 20:52:07 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How do I run a Perl script on an NT server?
Message-Id: <7v549n$ip0$1@gellyfish.btinternet.com>

On Tue, 26 Oct 1999 11:39:28 GMT Craig Vincent wrote:
>> I've only used Unix servers before and have no idea how to get a Perl
> script
>> to run on an NT server. I've no access to the server other than for
> putting
>> stuff on it. I assume that there are standard places where a Perl
>> interpreter is put. Also I guess the first line of the script will no
> longer
>> be
>>
>> #!/usr/local/bin/perl
>>
>> What sh(c)ould it be? Anything else I need to know? Anywhere to look?
> 
> Although some might beg to differ with me...there is no shebang line needed
> at the beginning of an NT perl script.
> 

Whilst it might not be *needed* perl is sufficiently clever to look for it
nonetheless - from the perlrun manpage:

       The #! line is always examined for switches as the line is
       being parsed.  Thus, if you're on a machine that allows
       only one argument with the #! line, or worse, doesn't even
       recognize the #! line, you still can get consistent switch
       behavior regardless of how Perl was invoked, even if -x
       was used to find the beginning of the script.

This behaviour is the same on Win32 as it is on Unix.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>


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

Date: 26 Oct 1999 13:06:46 +0100
From: nja@le.ac.uk (A.J. Norman)
Subject: Re: How do I run a Perl script on an NT server?
Message-Id: <7v45gm$2mfsf@harrier.le.ac.uk>

 In article <QpgR3.15669$Ua7.534661@news2.rdc1.on.home.com>, Craig 
 Vincent <2bunnyhop@home.com> wrote: 
 > Although some might beg to differ with me...there is no shebang line 
 > needed at the beginning of an NT perl script.  If you have the web 
 > server configured properly it will associate the extention .pl (or 
 > .cgi whichever you choose) with the perl interpreter.  

 Depends on the server.  Xitami requires the shebang to give the path to
 the interpreter, and ignores any file extension.

-- 
Andrew Norman, Leicester, England
nja@le.ac.uk || andrew.norman@le.ac.uk
http://www.le.ac.uk/engineering/nja/


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

Date: Tue, 26 Oct 1999 11:39:28 GMT
From: "Craig Vincent" <2bunnyhop@home.com>
Subject: Re: How do I run a Perl script on an NT server?
Message-Id: <QpgR3.15669$Ua7.534661@news2.rdc1.on.home.com>

> I've only used Unix servers before and have no idea how to get a Perl
script
> to run on an NT server. I've no access to the server other than for
putting
> stuff on it. I assume that there are standard places where a Perl
> interpreter is put. Also I guess the first line of the script will no
longer
> be
>
> #!/usr/local/bin/perl
>
> What sh(c)ould it be? Anything else I need to know? Anywhere to look?

Although some might beg to differ with me...there is no shebang line needed
at the beginning of an NT perl script.
If you have the web server configured properly it will associate the
extention .pl (or .cgi whichever you choose) with the perl interpreter.

Sincerely,

Craig Vincent




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

Date: Mon, 25 Oct 1999 17:42:47 -0500
From: Poohba <poohba@io.com>
Subject: How do i sort by date?
Message-Id: <Pine.LNX.4.10.9910251711350.30916-100000@fnord.io.com>

i am sorting files to be displayed in date order?  now i m using:
@files = sort {$a cmp $b} @files;  but how do i do it so that i get of
list sorted by date.  please respond by email.

	      *		Web Page Designs	  *
	     / poohba@io.com  |  www.io.com/~poohba\
	     ---------------------------------------
	     \ For info about me send message with /
	      *      subject "send file help"     * 
		




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

Date: Tue, 26 Oct 1999 17:30:07 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How do i sort by date?
Message-Id: <MPG.127fe767cb0dd03398a135@nntp.hpl.hp.com>

In article <7v5e4i$lt1$1@nntp2.atl.mindspring.net> on 26 Oct 1999 
23:40:02 GMT, Eric Bohlman <ebohlman@netcom.com> says...

 ...

> #!/usr/local/bin/perl -w
> use strict;
> 
> opendir(CWD,'.') or die "Open Failed : $!";
> foreach (sort map {sprintf("%010d%s", (stat($_))[10], $_)} readdir(CWD));
                                                             '{' not ';'
>   print substr($_,10),"\n";
> }
> closedir(CWD);      

Hurrah!  Getting closer to the mainstream (even with a syntax error :-).

 ...

> There's one pathological case where using the Schwartzian transform
> *might* be faster than the Guttman-Rosler prefix method: the case where
> there are large numbers of files with identical dates and names with very
> long identical prefixes.  In that case sort() is going to spend much of
> its time comparing long keys that differ only at the end.

Pathological, indeed!  First, 'identical dates' means to the second.  
And then, 'names with very long identical prefixes'.  I'd wager that the 
extra overhead of calling a sortsub to compare the dates would far 
outweigh the longer comparisons in this method.

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


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

Date: 26 Oct 1999 23:40:02 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: How do i sort by date?
Message-Id: <7v5e4i$lt1$1@nntp2.atl.mindspring.net>

David Annis (dave.annis@kohlerco.com) wrote:
: I know this is crude, but I was in a hurry. It takes all the files in
: the current directory, sorts them in ascending date sequence (32 bit
: date/time), puts names to stdout. I call this "lsts":
: 
: #!/usr/local/bin/perl
: $currdir = $ENV{PWD};
: opendir(CWD, "$currdir") or die "Open Failed $currdir : $!";
: while ( defined ( $filename = readdir(CWD)) ) {
:         $CTIME = (stat($filename))[10];
:         push(@worklist, "$CTIME:$filename");
: }
: @sortlist =     map  { $_->[1] }
:                 sort { $a->[0] <=> $b->[0] }
:                 map  { [ (split /:/)[0], $_ ] }
:                 @worklist;
: foreach $item (@sortlist) {
: ($ptime, $pfile) = split(/:/, $item);
: print($pfile, "\n");
: }
: closedir(CWD);      

Better:

#!/usr/local/bin/perl -w
use strict;

opendir(CWD,'.') or die "Open Failed : $!";
foreach (sort map {sprintf("%010d%s", (stat($_))[10], $_)} readdir(CWD));
  print substr($_,10),"\n";
}
closedir(CWD);      

This takes advantage of the facts that

1) sort runs a *lot* faster if you don't need to specify an explicit 
comparison block.

2) The lexicographic sort order for zero-padded, fixed-width numbers is 
the same as their numeric sort order.

3) sort isn't guaranteed stable, so the result of sorting the entire 
strings is just as good as the result of sorting on only the first 10 
characters.

There's one pathological case where using the Schwartzian transform
*might* be faster than the Guttman-Rosler prefix method: the case where
there are large numbers of files with identical dates and names with very
long identical prefixes.  In that case sort() is going to spend much of
its time comparing long keys that differ only at the end.




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

Date: Tue, 26 Oct 1999 21:47:20 GMT
From: dave.annis@kohlerco.com (David Annis)
Subject: Re: How do i sort by date?
Message-Id: <3816205e.626966139@news1.norlight.net>

On Mon, 25 Oct 1999 17:42:47 -0500, Poohba <poohba@io.com> wrote:

>i am sorting files to be displayed in date order?  now i m using:
>@files = sort {$a cmp $b} @files;  but how do i do it so that i get of
>list sorted by date.  please respond by email.
>
>	      *		Web Page Designs	  *
>	     / poohba@io.com  |  www.io.com/~poohba\
>	     ---------------------------------------
>	     \ For info about me send message with /
>	      *      subject "send file help"     * 
>		
>
I know this is crude, but I was in a hurry. It takes all the files in
the current directory, sorts them in ascending date sequence (32 bit
date/time), puts names to stdout. I call this "lsts":

#!/usr/local/bin/perl
$currdir = $ENV{PWD};
opendir(CWD, "$currdir") or die "Open Failed $currdir : $!";
while ( defined ( $filename = readdir(CWD)) ) {
        $CTIME = (stat($filename))[10];
        push(@worklist, "$CTIME:$filename");
}
@sortlist =     map  { $_->[1] }
                sort { $a->[0] <=> $b->[0] }
                map  { [ (split /:/)[0], $_ ] }
                @worklist;
foreach $item (@sortlist) {
($ptime, $pfile) = split(/:/, $item);
print($pfile, "\n");
}
closedir(CWD);      
***************************************************************
** Dave Annis            *  With age comes wisdom,           ** 
** Kohler Co.            *  if you stay awake along the way. **
***************************************************************


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

Date: Mon, 25 Oct 1999 17:15:51 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How do i sort by date?
Message-Id: <MPG.127e929610e8f73398a127@nntp.hpl.hp.com>

In article <Pine.LNX.4.10.9910251711350.30916-100000@fnord.io.com> on 
Mon, 25 Oct 1999 17:42:47 -0500, Poohba <poohba@io.com> says...
> i am sorting files to be displayed in date order?  now i m using:
> @files = sort {$a cmp $b} @files;  but how do i do it so that i get of
> list sorted by date.

This subject comes up quite frequently.  Search this newsgroup on 
deja.com with the obvious keywords.

> please respond by email.

Not this time.

Please use a proper sigdash ("\n-- \n") ahead of your (up-to-four-line) 
signature.  (But it's now a lot better than it used to be,IIRC.  :-)

> 	      *		Web Page Designs	  *
> 	     / poohba@io.com  |  www.io.com/~poohba\
> 	     ---------------------------------------
> 	     \ For info about me send message with /
> 	      *      subject "send file help"     * 

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


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

Date: Mon, 25 Oct 1999 20:32:31 GMT
From: tmcandr@sears.com
Subject: How do you create pop-up box in browser?
Message-Id: <7v2ep0$mcn$1@nnrp1.deja.com>

Is there a way in Perl to open a second window in the browser (a pop-up
box, if you will)? Without using Javascript.

For example, say I perform a database action , then I want to let the
user know the action has been successful with a smaller, pop-up box.

Thanks.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 26 Oct 1999 17:28:02 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: How do you create pop-up box in browser?
Message-Id: <3815dff8.213138934@news.nikoma.de>

On Tue, 26 Oct 1999 07:34:29 GMT, bart.lateur@skynet.be (Bart Lateur)
wrote:

>tmcandr@sears.com wrote:
>
>>Is there a way in Perl to open a second window in the browser (a pop-up
>>box, if you will)? Without using Javascript.
>
>I think not.
>
>This is precisely why a lot of people disable Javascript on their
>browser.

My reason has more to do with stupid scrollytext in the status line
and unhelpful OnMouseOvers on links that put the same text as the link
text into the status line.

Status lines are for telling me whether the browser has finished
loading the page or not, and for showing me the URL that a link points
to, OK? So don't go around obscuring it.

(Sometimes I wish the status line would also give me the target of a
link, so that I can tell in advance whether another browser window
will pop up or not.)

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>


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

Date: Tue, 26 Oct 1999 07:34:29 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: How do you create pop-up box in browser?
Message-Id: <38175959.3450827@news.skynet.be>

tmcandr@sears.com wrote:

>Is there a way in Perl to open a second window in the browser (a pop-up
>box, if you will)? Without using Javascript.

I think not.

This is precisely why a lot of people disable Javascript on their
browser.

-- 
	Bart.


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

Date: Mon, 25 Oct 1999 21:01:29 GMT
From: damonmiller@my-deja.com
Subject: Re: How do you create pop-up box in browser?
Message-Id: <7v2gf7$no2$1@nnrp1.deja.com>

No, there's not. That's what javascript is there for.


In article <7v2ep0$mcn$1@nnrp1.deja.com>,
  tmcandr@sears.com wrote:
> Is there a way in Perl to open a second window in the browser (a
pop-up
> box, if you will)? Without using Javascript.
>
> For example, say I perform a database action , then I want to let the
> user know the action has been successful with a smaller, pop-up box.
>
> Thanks.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 25 Oct 1999 13:51:23 -0700
From: mbudash@wcws.com (Michael Budash)
Subject: Re: How do you create pop-up box in browser?
Message-Id: <mbudash-2510991351230001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>

In article <7v2ep0$mcn$1@nnrp1.deja.com>, tmcandr@sears.com wrote:

> Is there a way in Perl to open a second window in the browser (a pop-up
> box, if you will)? Without using Javascript.
> 

specify a Window-target header *may* work in some or most cases...

> For example, say I perform a database action , then I want to let the
> user know the action has been successful with a smaller, pop-up box.
> 

whoah now, *sizing* the new window is a client-side issue...

hth-
-- 
Michael Budash ~~~~~~~~~~ mbudash@wcws.com


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

Date: Mon, 25 Oct 1999 21:04:09 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: How do you create pop-up box in browser?
Message-Id: <dB3R3.1461$LR3.253904@news.shore.net>

tmcandr@sears.com wrote:
: Is there a way in Perl to open a second window in the browser (a pop-up
: box, if you will)? Without using Javascript.

In a web browser? I wouldn't think so. Perl generally runs on the server
side when it's used in web applications, and only something on the client
side (e.g. JavaScript) can affect the user's web browser.

--Art
-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: 26 Oct 1999 02:37:01 GMT
From: les@rooslin.bio.upenn.edu ()
Subject: how to emulate Java's byte array?
Message-Id: <7v344d$j96$1@netnews.upenn.edu>

        I am trying to talk to a Java stored procedure (in Oracle) that
takes a byte array as argument. I want to call this procedure from Perl
via DBD:ODBC. I've succeeded to pass single bytes by filling in a
placeholder in a prepared statement containing {call TABLE.procedure(?)}
by e.g. $sth->execute(65), but I cannot pass more than one, as Perl's
arrays don't seem to work here. My experiments with pack have been
unsuccessful.
        Any tips?

        Les

_____________________________________________________________________
Dr. Les Klimczak              |  mailto:lklimcza@sas.upenn.edu
Senior Scientist              |  http://www.sas.upenn.edu/~lklimcza
Akkadix Corporation, S. 160   |  http://www.akkadix.com/lkl.html
11099 N. Torrey Pines Rd.     |  Tel.:     (619) 646 8241
La Jolla, CA 92037            |  FAX:      (619) 452 6653
_____________________________________________________________________





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

Date: Wed, 27 Oct 1999 15:52:31 -0400
From: tco2@cornell.edu (Todd Olson)
Subject: How to get numeric timezone offset ???
Message-Id: <tco2-2710991552310001@murmer.cit.cornell.edu>

Hi

Is there a simple way to find the *numeric* offset between
localtime and gmtime  ?????

Most email messages today are dated like

       Mon, 25 Oct 1999 18:58:34 -0400
or
       Mon, 25 Oct 1999 18:58:20 -0400 (EDT)


with strftime it is easy to get  

       Mon, 25 Oct 1999 18:58:20 (EDT)

But there does not seem to be an easy way to get the "-0400"

Am I overlooking something ?????

If not, then I'd advocate this be added as a part of the standard
perl time utilities.

Regards,
Todd


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

Date: Wed, 27 Oct 1999 13:30:24 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: How to get numeric timezone offset ???
Message-Id: <MPG.128100bd30a958ee98a143@nntp.hpl.hp.com>

In article <tco2-2710991552310001@murmer.cit.cornell.edu> on Wed, 27 Oct 
1999 15:52:31 -0400, Todd Olson <tco2@cornell.edu> says...
> Is there a simple way to find the *numeric* offset between
> localtime and gmtime  ?????

Yes.  You compute them each, and convert the difference to hours.  See 
below.

> Most email messages today are dated like
> 
>        Mon, 25 Oct 1999 18:58:34 -0400
> or
>        Mon, 25 Oct 1999 18:58:20 -0400 (EDT)
> 
> with strftime it is easy to get  
> 
>        Mon, 25 Oct 1999 18:58:20 (EDT)
> 
> But there does not seem to be an easy way to get the "-0400"
> 
> Am I overlooking something ?????

You might have considered searching this newsgroup in Deja.com for 
'timezone offset'.  Other than that, I don't think so.

> If not, then I'd advocate this be added as a part of the standard
> perl time utilities.

That is out of my control.  Why not send a request to p5p?  If I had the 
time or inclination, I might make a module Time::Offset or such.  
Perhaps someone else would like to do that.  Right now, it is just a 
function.

I originally posted this function to the Perl Function Repository, which 
seems now to be defunct as Daniel Grisinger has switched jobs (and 
timezones :-).  I retrieved it from Deja.com and updated it slightly.

As documented, the value returned is in hours.  Converting that to a 
form such as '-0400' is left as an exercise for the user.


#!/usr/local/bin/perl -w
use strict;
 
# tz_offset: Compute the offset of the local timezone from UTC.
# Larry Rosler, February 13, 1999
 
# tz_offset() returns the offset of the local timezone from UTC,
# in hours (and fractions).  For example, (North American) Eastern
# Standard Time is -5, India Time is +5.5.  This convention conforms
# to international usage, but has the opposite sign of that used by
# the Unix TZ environment variable.

# The argument, if any, is the Unix-epoch time (in seconds) for
# which the offset is desired.  (The offset varies according to
# Summer Time.)  The default is the current time.
 
sub tz_offset {
    my $now = defined $_[0] ? $_[0] : time;
    my ($l_min, $l_hour, $l_year, $l_yday) =
                            (localtime $now)[1, 2, 5, 7];
    my ($g_min, $g_hour, $g_year, $g_yday) =
                               (gmtime $now)[1, 2, 5, 7];
    ($l_min - $g_min)/60 + $l_hour - $g_hour +
        24 * ($l_year - $g_year || $l_yday - $g_yday)
}
 
-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

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 1183
**************************************


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