[11312] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4912 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 17 03:07:26 1999

Date: Wed, 17 Feb 99 00:00:28 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 17 Feb 1999     Volume: 8 Number: 4912

Today's topics:
        @files = <*.*>; doesn't work (Steven Lee)
        A simple question from a Perl newbie <tangd@ctcdist.com>
    Re: Can anyone convert this VB script to Perl? (win32:: <jcounts@voicenet.com>
        content-type: application/pdf (Jeanne)
        delete line? <nospam-seallama@mailcity.com>
    Re: Discuss index/search algorithms which allow flexibl <ebohlman@netcom.com>
    Re: getting full path of program name <xah@bpower.com>
    Re: getting full path of program name (Randal L. Schwartz)
    Re: good code vs code that works (Tad McClellan)
    Re: greedy operators - help! (Ronald J Kimball)
    Re: Help,Perl Script doesn't work! (Tad McClellan)
        How do you copy a text file to the body of an e-mail no <no@not.net>
    Re: How do you copy a text file to the body of an e-mai <morrowc@his.com>
    Re: How do you copy a text file to the body of an e-mai <morrowc@his.com>
    Re: Opening and printing textfiles containing variables (Tad McClellan)
    Re: People Needed For Site <ebohlman@netcom.com>
    Re: perl cgi nntp question <ebohlman@netcom.com>
        Perl email program julzrulz@my-dejanews.com
    Re: Perl evangelism <bill@fccj.org>
    Re: PFR: UTC_to_Epoch (Larry Rosler)
    Re: print "Content-type: text/html\n\n"; <ebohlman@netcom.com>
    Re: Problem With Output of HTML Headers - Interesting (Ronald J Kimball)
    Re: Regular expression for Currency ??? (Tad McClellan)
    Re: skipping header in file when doing formated printin (Tad McClellan)
        Solved: system call works in command line mode but not  <bwlang@nospam.genome.wi.mit.edu>
    Re: y2k problems with perl <gustavo@niemeyer.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 17 Feb 99 07:31:24 GMT
From: stlee@cisco.com (Steven Lee)
Subject: @files = <*.*>; doesn't work
Message-Id: <stlee.36ca704c@stlee-ss20.cisco.com>

I am running Perl version 5.005_02, build 509 with 1 registered patch
by ActiveState.  The filename glob operator does not seem to work on
Windows 95.

@files = <*.*>;

I get back an empty array even though there are files in the current
directory.  This works on my Sun workstation.

-Steven
stlee@cisco.com


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

Date: Tue, 16 Feb 1999 22:30:29 -0600
From: "Dong Tang" <tangd@ctcdist.com>
Subject: A simple question from a Perl newbie
Message-Id: <PEry2.1916$k22.96192@ptah.visi.com>

Hi:

Here is a simple question.
Can I test if a file handle is open or not.

If you know the answer, please email to tangd@ctcdist.com1

Thank you ahead

Don Tang




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

Date: Wed, 17 Feb 1999 02:12:49 -0500
From: "John Counts" <jcounts@voicenet.com>
Subject: Re: Can anyone convert this VB script to Perl? (win32::ole)
Message-Id: <7adqke$nm6$1@news1.fast.net>

I'm only guessing because we don't have an exchange server, but I use
Win32::OLE to use ADO objects so the syntax should be similar. I'm sure
there are plenty of mistakes, but it might help you get started.

#! c:/perl/bin/perl.exe -w

use Win32::OLE;

$objSession = CreateObject OLE ("MAPI.Session") ;
$objSession->Logon (profileName:="Princess Leia");
$objMessages = CreateObject OLE("MAPI.[Messages Collection]);
$objMessages -> Open ([Messages Collection]); # I'm guessing that there is
an open member
$retval = &Util_CountUnread();
print "Unread messages = $retval\n";


sub Util_CountUnread {
    $cUnread = 0;
     if ( ! defined ($objMessages)){
        print "must select a messages collection\n";
        return (0);
    }
    $objMessages->GetFirst;
    while (defined($objMessages)) {
        if  ($objMessage->Unread) {
            $cUnread++;
        }
        $objMessages->GetNext;
    }
return ($cUnread);
}






Richard.Mayston@mfat.govt.nz wrote in message
<7ad59g$qjj$1@nnrp1.dejanews.com>...
>We have an Exchange4.0 server with a couple of mailboxes that do automatic
>document conversions, and occasionally the the process dies & the messages
>bank up in the mailbox. I'd like a Perl script the checks for unread
messages
>& alerts the HelpDesk if necessary. Technet has an article Programmer's
>Guide: MS OLE Messaging with a Visual Basic example.
>
>Can anyone help convert the following VB script to Perl?
>I've got as far as:
>use Win32::OLE;
>





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

Date: Wed, 17 Feb 1999 05:32:00 GMT
From: jeanne@NOSPAMjacy.com (Jeanne)
Subject: content-type: application/pdf
Message-Id: <36ca5261.57687987@corp.supernews.com>

I am trying to serve a password-protected PDF document and instead of
the plug-in loading, the PDF code appears in the browser window.

This is the excerpt in the script which calls the PDF file:

#My add-on for PDF
elsif ($inputfile ne "" && isElementInArray($extension,
@protect_pdf_ext) && $is_group_filter_passed) {
    print "Content-type: application/pdf\n\n";
    open(PDFFILE, "<$protect_pdf_dir/$filename") ||
       &CgiDie("Could not open $protect_pdf_dir/$filename");
    while (<PDFFILE>) {
		print $_;
	}
	close (PDFFILE);
}

I am a newbie, obviously <g>, and this is a hack of a free script set
to protect html, gifs, and jpgs. I'm actually shocked I got this far
successfully on my own.

What have I done wrong that the plug-in won't load? Many thanks for
any tips.

Jeanne


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

Date: Tue, 16 Feb 1999 21:40:13 -0800
From: dan <nospam-seallama@mailcity.com>
Subject: delete line?
Message-Id: <36CA563C.19CE6D95@mailcity.com>

lets say i have the following in a file:

a
b
c
d

and i pass a variable through. the variable contains "b", how do i get
rid of the line that b is on instead of replacing it with ""? so the
file contains:

a
c
d

thanks




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

Date: Wed, 17 Feb 1999 05:56:01 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Discuss index/search algorithms which allow flexible search syntax
Message-Id: <ebohlmanF7AB5D.F77@netcom.com>

Matthew.Wickline@usa.net wrote:
: How does Altavista do it? (or any of those other big name engines)

: suppose we want a search engine that allows you to search for phrases like
: "Jolly Green Giant" or "in the middle" or whatever... what's a Good way to do
: it that? What if we also want to allow stemming? ... using oncolog* to match
: oncology oncologist or oncological

: Has an optimal solution already been found by folks? If not, anyone care to
: start a thread and figure it out here for future posterity?

You might want to do a Web search, and look for some textbooks on, 
"information retrieval."  This sort of thing is the bread and butter of IR.

: I'm thinking that an index is of course good to start with, as it will speed
: up bareword searches. For phrases, would it be best to manually open each
: file which the index lists as having every component word in the phrase and
: see if it matches? Or maybe it would be better to have the index be
: conceptually like the following where a record of word location is stored
: with each matching file...

Almost certainly the latter.

: Doing something like that would potentially mess up stop word optimizations
: unless both the indexed text and the query phrases are purged of stop words
: (indexed text purged just prior to indexing).

Probably the best way is to treat stop words in phrases as "always 
present."  If your query is "foo and bar" you'd treat it as "find all 
files that have 'foo' in position N and 'bar' in position N+2.  Of 
course, files with "foo or bar" would also match, so you'd have to do 
some post-screening once you got a list of candidates.


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

Date: Tue, 16 Feb 1999 21:53:55 -0800
From: "Xah Lee" <xah@bpower.com>
Subject: Re: getting full path of program name
Message-Id: <7adl8u$ph9$1@remarQ.com>

> "Xah" <xah@best.com> wrote:
> 
> Xah> What is a reliable and portable way of getting the absolute path of the
> Xah> running script?


merlyn@stonehenge.com (Randal L. Schwartz) wrote:
> See FindBin in the standard distribution.
>
> And beware... it can be spoofed.  There's no absolutely reliable way
> to do this.

Can you explain why it's not reliable?

Thanks.

Xah
xah@best.com
http://www.best.com/~xah/PageTwo_dir/more.html


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

Date: 16 Feb 1999 22:34:06 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: getting full path of program name
Message-Id: <m1yalx5yjl.fsf@halfdome.holdit.com>

>>>>> "Xah" == Xah Lee <xah@bpower.com> writes:

Xah> merlyn@stonehenge.com (Randal L. Schwartz) wrote:
>> See FindBin in the standard distribution.
>> 
>> And beware... it can be spoofed.  There's no absolutely reliable way
>> to do this.

Xah> Can you explain why it's not reliable?

Well, from Perl, I can do this:

	exec { "/real/path/to/your/prog" } "/fake/path/I/cheat", @args;

And all you get in $0 is "/fake/path/I/cheat", with your @ARGV equal
to @args.  There is absolutely *no* way to know where in the entire
file tree you are being executed from at this point.

So... $0 is just a hint.  It's not reliable.

print "Just another Perl hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Tue, 16 Feb 1999 23:16:34 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: good code vs code that works
Message-Id: <ibjda7.ej7.ln@magna.metronet.com>

23_skidoo (23_skidoo@geocities.com) wrote:
: is it considered bad practice to use return to jump out of a foreach
: loop in a subroutine? my reason for asking:


   Not generally.

   It kinda depends on what it is that you are looping over though.

   while ( /(\d+)/g ) {
     return if $1 eq 666; # leaving a //g match before it gets to
                          # the end can sometimes cause problems
   }



: foreach local $user (@badusers)

: doesn't work, are variables local by default when used in a foreach
: loop? 


   Well, since the Fine Manual says they are, then I would tend
   to believe that they in fact are local.

   :-)

   'perlsyn.pod' (syntax) describes foreach:

---------------------
=head2 Foreach Loops

The C<foreach> loop iterates over a normal list value and sets the
variable VAR to be each element of the list in turn.  If the variable
is preceded with the keyword C<my>, then it is lexically scoped, and
is therefore visible only within the loop.  Otherwise, the variable is
implicitly local to the loop and regains its former value upon exiting
the loop. 
---------------------



: if not, how can i localise them so that i can cut and paste subs
: into other programs without worrying that i might corrupt a global
: variable?


   You should always prefer my() over local().

   It is both faster and safer.

   s/local/my/ on all of your programs.



: if (&banned($input{'email'})) {
: 	print "Sorry, this email address has been banned for the following
: reason:<br>\n";
: 	print "$ban_reason<br>\n";
: 	print "<a href=\"$homepage\" target=\"_top\">back</a><br>\n";


   Yuk!

   That is pretty hard to read.

   The next person that has to figure out what that does is going
   to spend several seconds pondering that line, when you could
   have written it the "one second to understand" way.

   That next person may even be you!

      print qq(<a href="$homepage" target="_top">back</a><br>\n);

   Easier to read, and less characters to type to boot.

   A win-win approach.


: }

: sub banned {
: 	local $checker = "@_";
                         ^  ^
                         ^  ^ not needed and serve no purpose


: 	open (BANNED, "$banlist") || print "can't open $banlist on line " .
                      ^        ^
                      ^        ^ not needed and serve no purpose



: bill@microsoft.com	You are the antichrist!

   Atta boy, 23.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 16 Feb 1999 23:24:04 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: greedy operators - help!
Message-Id: <1dncd5w.ep9a1x1pohx6oN@bay2-562.quincy.ziplink.net>

Asterix <usenet@arix.com> wrote:

>     $fn =~ s/\..*$//;

$fn =~ s/\.[^.]*$//;

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Tue, 16 Feb 1999 23:34:21 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Help,Perl Script doesn't work!
Message-Id: <tckda7.ds7.ln@magna.metronet.com>

Simon Roulstone (Webmaster@KILL-MEquorndon-mag.org.uk) wrote:

: Sorry, I forgot to mention the server is an NT System.


   Good that you added that, since it is likely to be your problem.


      perldoc -f binmode


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 17 Feb 99 05:14:51 GMT
From: "Bob Flanagan" <no@not.net>
Subject: How do you copy a text file to the body of an e-mail note?
Message-Id: <01be86f3$96f70aa0$635bb7cc@flanagrwhome>

I have a text file called reginfo.txt and want to copy it to the body of a
e-mail note and mail it.  I haven't been able to get this to work.  I can
sometimes get a single line to be sent, but no more.  The following is the
code that I am using:

sub mailadd{
open(TXT,"reginfo.txt");
my $body = <TXT>;
close(TXT);

   open (MAIL, "|$mailprog $in{'address'}") || die "Can't open
$mailprog!\n";
   print MAIL "From: $admin_email\n";
   print MAIL "Subject: The Office Sentinel Mailing List\n";
   print MAIL "$body\n";
   close (MAIL);
}

I'm uploading both the txt file and the cgi using WS FPS if that makes any
different.  The txt file was created using an ascii editor (kedit).

Any help would be appreciated.

Bob Flanagan


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

Date: Wed, 17 Feb 1999 00:51:36 -0500
From: Chris Morrow <morrowc@his.com>
To: Bob Flanagan <no@not.net>
Subject: Re: How do you copy a text file to the body of an e-mail note?
Message-Id: <36CA58E7.80D6A2A6@his.com>

Bob,
Why shell out to a mail program? Why not use the nifty Net::SMTP module?
(in Libnet I believe)

There is a great example of creating a message in the documentation, so
I'll forgo putting one in here.

Caution: for some reason, the perl Net::SMTP seems to be able to sendout
messages faster then some MTA's can handle them... if you have to send
out many messages try a 1 second sleep or something between messages.  I
killed a remote mailhost this way one day :( 

-Chris

Bob Flanagan wrote:
> 
> I have a text file called reginfo.txt and want to copy it to the body of a
> e-mail note and mail it.  I haven't been able to get this to work.  I can
> sometimes get a single line to be sent, but no more.  The following is the
> code that I am using:
> 
> sub mailadd{
> open(TXT,"reginfo.txt");
> my $body = <TXT>;
> close(TXT);
> 
>    open (MAIL, "|$mailprog $in{'address'}") || die "Can't open
> $mailprog!\n";
>    print MAIL "From: $admin_email\n";
>    print MAIL "Subject: The Office Sentinel Mailing List\n";
>    print MAIL "$body\n";
>    close (MAIL);
> }
> 
> I'm uploading both the txt file and the cgi using WS FPS if that makes any
> different.  The txt file was created using an ascii editor (kedit).
> 
> Any help would be appreciated.
> 
> Bob Flanagan


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

Date: Wed, 17 Feb 1999 00:53:40 -0500
From: Chris Morrow <morrowc@his.com>
To: Bob Flanagan <no@not.net>
Subject: Re: How do you copy a text file to the body of an e-mail note?
Message-Id: <36CA5964.6DDCA134@his.com>

DOH!
 and your line:
	my $body=<TXT>;
should MOST LIKELY be:
	my @body=<TXT>;
unless your file is only one line long :
Scalar context for file handles gives you a line at a time, ARRAY
context gives you the entire file (Slurping this is sometimes called)

-Chris

Bob Flanagan wrote:
> 
> I have a text file called reginfo.txt and want to copy it to the body of a
> e-mail note and mail it.  I haven't been able to get this to work.  I can
> sometimes get a single line to be sent, but no more.  The following is the
> code that I am using:
> 
> sub mailadd{
> open(TXT,"reginfo.txt");
> my $body = <TXT>;
> close(TXT);
> 
>    open (MAIL, "|$mailprog $in{'address'}") || die "Can't open
> $mailprog!\n";
>    print MAIL "From: $admin_email\n";
>    print MAIL "Subject: The Office Sentinel Mailing List\n";
>    print MAIL "$body\n";
>    close (MAIL);
> }
> 
> I'm uploading both the txt file and the cgi using WS FPS if that makes any
> different.  The txt file was created using an ascii editor (kedit).
> 
> Any help would be appreciated.
> 
> Bob Flanagan


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

Date: Tue, 16 Feb 1999 22:42:28 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Opening and printing textfiles containing variables
Message-Id: <kbhda7.2e7.ln@magna.metronet.com>

arno_22@hotmail.com wrote:
: I've got this code:

: $var = "Even more blabla";


   You should not ask for variable interpolation and/or backslash
   escapes unless you _have_ some variables to be interpolated
   or escape sequences.

   When you use double quotes, you are asking for those things.

      $var = 'Even more blabla';   # write easily maintainable code


: open (FILE, "text.txt");


   You should *always* check the return value from open() calls.

   What if the file does not exist? If you don't have permission
   to open it?


: while (<FILE>) {
:    print "$_";
: }
: close (FILE);

: And a textfile containing:

: Hi everybody,
: This is line 2 with variable: $var
: Closing file...

: The output of the code is exactly the same as the textfile. 


   Yes. 

   I guess you were expecting something else?

: Why doens't perl
: change $var in 'Even more blabla'. 


   Because perl doesn't muck with your data unless you _ask_ it to.

   Stuff read from a file is _data_ not a program that the
   compiler compiles.


: What do I have to do to solve this problem?


   Read the Perl FAQ, part 4, like everybody else does:

      "How can I expand variables in text strings?"


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 17 Feb 1999 06:28:34 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: People Needed For Site
Message-Id: <ebohlmanF7ACnn.GH0@netcom.com>

brian d foy <comdog@computerdog.com> wrote:
: what happens when you post a loss for the first year?  you're
: dreaming if you think you'll be in the black that quickly,
: especially with much better established auction services getting
: almost daily news cycles.

Furthermore, with many startups it's in the interest of the founders *not* 
to show a profit for as long as they legally can, because they can get 
tax breaks (on income from other ventures) by showing a loss.  Most tax 
codes have a limit on how long you can do this; I think in the US it's 5 
years (after that, costs of the startup can only be deducted from income 
from the startup, not income from other sources).

Anyone who is tempted to do spec work (as this sort of thing is called) 
should make an informed estimate of the probability that they'll actually 
get paid and, if the probability is acceptably high, divide the normal 
hourly rate or flat fee that they'd charge by the probability.  For 
example, if you believe that you have a 50% chance of getting paid and 
that the chance is worth taking, and you'd normally quote $1000 for that 
much work, you should take it on only if it's capable of generating $2000 
in payments.  If you believe it has only a 10% chance of succeeding, you 
should require it to be capable of generating $10,000.  Needless to say, 
you shouldn't take on spec work unless you can afford a project that 
winds up not paying.  You should regard spec work as an investment of 
money, the amount being the market value of your time.  If you put in 
$1000 worth of time into a spec-work project, you should expect to get 
paid quite a bit more than $1000, just as if you had put $1000 into 
stocks or lent a business $1000 you would expect to get more than $1000 back.

Also note that spec work should never be done for a fixed or limited fee 
(e.g. "the first $1000 of profits").



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

Date: Wed, 17 Feb 1999 05:35:21 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: perl cgi nntp question
Message-Id: <ebohlmanF7AA6x.E3x@netcom.com>

J W <NOSPAM@somewhere.else.com> wrote:
: I want to use a perl script to process a form and send an email and a
: message to a newsgroup.  I can do all apart from the newsgroup bit. 
: Normally one would use sendmail to send an email, but since there is no
: equivalent 'sendnews', what is the best approach.  I am using Perl 5.003
: under Unix.  I don't have root privileges either.

Use Net::NNTP.  If that's not satisfactory, look for other news-related 
modules on CPAN.  If your first reaction is "I can't install modules 
because I don't have root access," read perlfaq8 first.



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

Date: Wed, 17 Feb 1999 04:36:27 GMT
From: julzrulz@my-dejanews.com
Subject: Perl email program
Message-Id: <7adh0b$4ip$1@nnrp1.dejanews.com>

I program perl using UNIX.
I am looking for a good example of a simple
email html form that runs on Windows NT.
I'm not sure of the syntax differences between the
two operating systems.
Thanks!

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Tue, 16 Feb 1999 20:18:35 -0500
From: "Bill Jones" <bill@fccj.org>
Subject: Re: Perl evangelism
Message-Id: <36ca1856.0@usenet.fccj.cc.fl.us>

In article <7acmjk$dku$1@nnrp1.dejanews.com>, aixgod@ix.netcom.com wrote:


> Currently, one of the companies I work for is on a kick to reduce everything
> to one platform (NT) and one set of programming "frameworks" (Visual Studio -
> VB primarily ... some J++).  The idea being that the company is already a
> "Microsoft Shop" (because it uses Office...yeah, I know, I have no idea why
> that makes a difference).  The argument goes that reducing the # of platforms
> and development environments makes long-term support and hiring cheaper.

I've found that without Political Support, there are no
business models that will help.  They will probably go thru
a migration process, like many others before, and MAYBE,
just MAYBE, they will realize that one platform cannot do
all that they will need done in the coming future.

The best that you can hope for is to learn to evolve,
adapt and wait - yes wait - for either the migration back
to a multi-platform environment or you find another environment.

I've been there, have that t-shirt so to speak; no I am
not saying give up in what you believe, but if you have
the desire to continued success, then you should at least
look like you are playing along, otherwise they will feel
that you are on 'the other-side' and you may no longer
have a choice or a voice.

These sites may help you in your endeavors:
http://www.perl.com
http://www.apache.org

As well as a search at AltaVista of "Why perl?"
(I got over 12 Thousand hits to this question...)

Also, after asking http://www.askjeeves.com about
"Perl evangelism", I got referred to about 40 sources.

Hmmm, maybe the fact that there are roughly 250
questions asked here a day may be significant -
but ignore the fact that 200 are the same questions -
over and over...

Choose your battles well.

HTH,
-Sneex-  :]
______________________________________________________________________
Bill Jones  | FCCJ Webmaster |  http://www.fccj.org/cgi/mail?webmaster
 Join the Jax, Fl  Perl Mongers Chapter - http://jacksonville.pm.org/
 http://certserver.pgp.com:11371/pks/lookup?op=get&search=0x37EFC00F
 http://rs.internic.net/cgi-bin/whois?BJ1936

    "Be not the first by whom the new are tried,
     nor yet the last to lay the old aside..."


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

Date: Tue, 16 Feb 1999 14:19:41 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: PFR: UTC_to_Epoch
Message-Id: <MPG.11338ed794e064b7989a4d@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <36C9C604.96D44FCB@silk.gsfc.nasa.gov> on Tue, 16 Feb 1999 
14:24:52 -0500, Tom McGlynn <tam@silk.gsfc.nasa.gov> says...
> Shouldn't this code at least mention that it
> does not address leap-seconds?

The Unix-epoch time scale does not address leap-seconds.  gmtime() and 
localtime() do not address leap seconds, but their documentation doesn't 
bother to say so.

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


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

Date: Wed, 17 Feb 1999 05:48:23 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: print "Content-type: text/html\n\n";
Message-Id: <ebohlmanF7AAsn.EtM@netcom.com>

Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at> wrote:
: Only output where and when it is needed.  Once the
: header is "out there" it's too late.

: You could output into a buffer/temp. file I suppose
: instead of stdout and go back and edit the header
: out if necessary, but that's not very nice.

Data::Locations might be helpful here.



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

Date: Tue, 16 Feb 1999 23:24:04 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Problem With Output of HTML Headers - Interesting
Message-Id: <1dncdpw.dd2iu6ffbu3tN@bay2-562.quincy.ziplink.net>

Tasslhoff Burrfoot <tasslehoff@vt.edu> wrote:

>  sub PrintHeader
>  {
>    print "<HTML> ";
>    print "<HEAD> ";
>    print "</HEAD> ";
>    print "<BODY> ";
>  }

You forgot to print the HTTP header(s).  The browser interprets your
HTML as the HTTP headers, leaving it with an empty document.

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

Note that the HTTP headers are separated from the document contents by a
pair of newlines.

-- 
 _ / '  _      /         - aka -          rjk@linguist.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Tue, 16 Feb 1999 22:26:34 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Regular expression for Currency ???
Message-Id: <qdgda7.2e7.ln@magna.metronet.com>

bill_mcintyre@my-dejanews.com wrote:

: For example $123,234.00 (I want to ensure 2 decimal places and a comma every
: thousand)


   /^\d{1,3}(?:,\d{3})*\.\d\d$/


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 16 Feb 1999 22:33:15 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: skipping header in file when doing formated printing
Message-Id: <bqgda7.2e7.ln@magna.metronet.com>

jocke1s@earthling.net wrote:

: I am sorry if this seems like very basic question but I am having
: a bit of a hard time getting started.

: I guess this is very simple and I would really appreciate some advice
: in how I do this. Part of the problem is something easily done with the
: getline function in awk. And the problem itself is perfect for awk but
: since I want to get it into some more general use I really would like to
: do it in perl.


   So write it in awk and run it through the awk-to-perl (a2p)
   translator that came with your perl distribution.

   Examine the resulting code.


: Here is what I like to do.

: print STDOUT "What file should be read: ";
: #
: open(FILE, <STDIN>)|| die "Can't open file \n


   STDIN is already open. It is set up for you before control
   is passed to your code.

   The angle brackets are the Input Operator. You cannot read
   at the same time that you are opening.


      chomp($file = <STDIN>); # read a line. Lose the open() above.


: # opening a ascii file with data

   open(IN, $file) || die "could not open '$file'  $!";


: * I now want to skip the first 10 lines
: This is done 1 time to get rid of the file header


   foreach (1..10) { <IN> }  # read and discard 10 lines


: A  * get the column 1 value of line 11(the first line after the header)

   $col1 = $1 if /^(\S+)/;


:    * skip 1 line

   <IN>;  # discard another line


:    * get the column one value of the next line
: B  * get the column one value of the next line

: the 3 values (text,numers etc separated by space) should be printed and


   print "$col1   $col2   $col3\n";


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Tue, 16 Feb 1999 16:49:38 -0500
From: "Bradley W. Langhorst" <bwlang@nospam.genome.wi.mit.edu>
Subject: Solved: system call works in command line mode but not from web
Message-Id: <36C9E7F2.51009724@nospam.genome.wi.mit.edu>



the problem was that the lp_solve executable
would run under one version of our digital unix but not under the version that was running on
the web server - missing some library or another

thanks

brad



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

Date: Wed, 17 Feb 1999 01:23:37 -0300
From: "Gustavo Niemeyer" <gustavo@niemeyer.net>
Subject: Re: y2k problems with perl
Message-Id: <7adco4$do0$1@srv4-poa.nutecnet.com.br>

>Functions gmtime and localtime seems to have problems with year >= 2000.
>For example the time corresponding to year 2000, the year is returned as
>100 instead of 00.

So, if you add 1900 to this!?!? How much do you have?? Good boy!!


:-)

Gustavo Niemeyer
Niemeyer Network
Solutions in high tecnology
http://www.niemeyer.net





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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 4912
**************************************

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