[17152] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4564 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 9 18:10:44 2000

Date: Mon, 9 Oct 2000 15:10:21 -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: <971129420-v9-i4564@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 9 Oct 2000     Volume: 9 Number: 4564

Today's topics:
    Re: macros (was Re: why it's called a "hash" (and a who <elijah@workspot.net>
    Re: Newbie -> ini file to hash table? (Gwyn Judd)
    Re: Numeric processing problem. <01031149@3web.net>
    Re: Numeric processing problem. <harrisr@bignet.net>
    Re: Numeric processing problem. <iltzu@sci.invalid>
        Parallel port functions in Perl?? varias2@my-deja.com
        re-start problem <ejw@windsor.igs.net>
    Re: re-start problem (Gwyn Judd)
    Re: regex <xs@korekom.com>
    Re: system command <john@eagleinfosystems.com>
    Re: system command (Chris Fedde)
    Re: the fastest way to test String A included by String (Reini Urban)
    Re: the fastest way to test String A included by String <tim@ipac.caltech.edu>
    Re: the fastest way to test String A included by String <mak@imakhno.freeserve.co.uk>
        UltraNewbie: grepping weblog <jamesN0@5PAM.young.net>
    Re: UltraNewbie: grepping weblog michaeljgardner@my-deja.com
        Using SSI in perl program <rrao@unf.edu>
    Re: Windows system tray <jdb@wcoil.com>
        Writing to log files <jstone211@my-deja.com>
    Re: Writing to log files (Chris Fedde)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 9 Oct 2000 20:44:01 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: macros (was Re: why it's called a "hash" (and a whole lot more))
Message-Id: <eli$0010091609@qz.little-neck.ny.us>

In comp.lang.perl.misc, David Combs <dkcombs@panix.com> wrote:
> Eli the Bearded  <elijah@workspot.net> wrote:
[discussion of macros via -P for perl]
> >That can be generalized with source filters (Filter::*) to include
> >perl or shell scripts to find and expand macros, thus removing the
> >need for a C preprocessor on the system.
> Please show an example or two, just to make
> it "concrete" in my (and others'?) head(s).

!/usr/bin/perl -w
BEGIN{
  $main::macro__script = <<'ScriptEnd';
  if (/^\s*##\s*:macro:\s*(\w+)\s+(.+)/) {
    $_ = "#macro $1 defined\n";
    $main::macro__defs{$1} = $2;
    if(defined($main::macro__re)) {
      $main::macro__re .= "|$1";
    } else {
      $main::macro__re .= $1;
    }
  } elsif (defined($main::macro__re)) {
    1 while s/\b($main::macro__re)\b/$main::macro__defs{$1}/g;
  }
ScriptEnd
}
use Filter::sh qq!perl -Mstrict -wpe '$main::macro__script'!;
use strict;


##:macro: MEANING_OF_LIFE 42
##:macro: japh            BEGIN{print JAPH if MEANING_OF_LIFE}
##:macro: JAPH            "Just another perl hacker.\n"

japh

##:macro: JAPH            "See, wasn't that fun?\n"

japh

__END__

:r! perl -wx %
Just another perl hacker.
See, wasn't that fun?

Elijah
------
thinks a macro language should properly be it's own Filter:: module


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

Date: Mon, 09 Oct 2000 20:40:39 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Newbie -> ini file to hash table?
Message-Id: <slrn8u4818.4h0.tjla@thislove.dyndns.org>

I was shocked! How could Edmond Nolan <edmond.nolan@debitel.net>
say such a terrible thing:
>Hi Gwyn,
>
>thanks for the reply, that's exactly what I was looking for!

You're welcome

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
"May the forces of evil become confused on the way to your house."
-- George Carlin


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

Date: Mon, 9 Oct 2000 09:18:18 -0600
From: "Duke Normandin" <01031149@3web.net>
Subject: Re: Numeric processing problem.
Message-Id: <5opE5.3522$Jd4.40248@jekyl.ab.tac.net>

Godzilla! wrote in message <39E140B3.A9D51C5A@stomp.stomp.tokyo>...

>Shall I give Ollie another smack on his forehead
>with my Duncan yo-yo?
>
>Godzilla!
>
>--
>
>#!/usr/local/bin/perl
>
>print "Content-Type: text/plain\n\n";
>
>for ($iterate = 1; $iterate <= 6; $iterate++)
> { $number = int(rand(10)); $numbers = "$numbers$number"; }
>
>print "Number: $numbers";
>
>exit;

Hi...

Please contact me via email -- nothing negative forthcoming from me!
tia....

-duke



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

Date: Mon, 9 Oct 2000 16:22:08 -0400
From: "Randy Harris" <harrisr@bignet.net>
Subject: Re: Numeric processing problem.
Message-Id: <su4a6chbof7f49@corp.supernews.com>


Jon DeCamp <jondecamp@home.com> wrote in message
news:39E1F0DE.F8B3D614@home.com...
> I have 99 11/6 digit pairs.  I was not given the entire list of 11
digit
> numbers that need to be converted until I say it can be done.  There
are
> well over 3000 of them (That's why Perl comes in handy.)
>
> -Jon DeCamp
>

3000 isn't so bad (as compared to the 100 billion possible, anyway),
providing you can get the list in an electronic format (otherwise you'll
be typing them in for the next two months.)

> Bart Lateur wrote:
>
> > Jon DeCamp wrote:
> >
> > > All I can offer further are more 11/6 digit pairs, because I have
> > >plenty.
> >
> > Do you have *all* of them? Because, then, all you need is a lookup
> > table.
> >
> > --
> >         Bart.
>

With only 3000, the lookup table could easily be loaded into memory.




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

Date: 9 Oct 2000 20:28:18 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Numeric processing problem.
Message-Id: <971121668.16520@itz.pp.sci.fi>

[Jeopardectomy performed -- see below.]

In article <39E1F0DE.F8B3D614@home.com>, Jon DeCamp wrote:
>Bart Lateur wrote:
>> Jon DeCamp wrote:
>>
>> > All I can offer further are more 11/6 digit pairs, because I have
>> >plenty.
>>
>> Do you have *all* of them? Because, then, all you need is a lookup
>> table.
>
>I have 99 11/6 digit pairs.  I was not given the entire list of 11 digit
>numbers that need to be converted until I say it can be done.  There are
>well over 3000 of them (That's why Perl comes in handy.)

Ok, then you're all set.  Read the pairs into a hash and use s///eg:

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

  my %pairs;
  while (<DATA>) {
      $pairs{$1} = $2 if /^(\d{11})\s+(\d{6})$/
  }

  while (<>) {
      s/(\d+)/$pairs{$1} || $1/eg;
      print;
  }

  __DATA__
  15902621045     928649
  15902677941     135373
  15902684952     925768
  15902712318     276640

Reading in 3000 lines shouldn't take too long, and once you've got
them in a hash you can do all the substitutions quickly.  The perl -i
switch can be useful for this.


[Please put your replies _after_ the relevant parts or the original
 message, and remove any irrelevant quoted text.  This makes it easier
 to follow the discussion, and is the convention in most established
 Usenet newsgroup heirarchies.  Thank you.]

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla  | "By promoting postconditions to
and its pseudonyms -    |  preconditions, algorithms become
do not feed the troll.  |  remarkably simple."  -- Abigail



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

Date: Mon, 09 Oct 2000 18:54:18 GMT
From: varias2@my-deja.com
Subject: Parallel port functions in Perl??
Message-Id: <8rt48m$dt7$1@nnrp1.deja.com>

Hi,

I'm trying to rewrite some C++ code that communicates with a PC's
parallel port (in Linux).  I've used stuff like IOPERM, inb, and outb,
to get access to the port - then send or retrieve the data at the port.

My question is this:  Can I get similar functionality in Perl?

Thanks,
-ted


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


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

Date: Mon, 9 Oct 2000 15:47:01 -0400
From: "theomats" <ejw@windsor.igs.net>
Subject: re-start problem
Message-Id: <8rt7el$9rt$1@news.igs.net>

Hi,
Can someone volunteer to answer why my site "Bishops, A Chess Variant" needs
to  be re-started quite often. My ISP has done all they can and the original
programmer also has done what is needed to get the program (applet) running.
The command I have been told to use is : perl5 bishops.cgi &

This after logging in by EWAN and entering my ID, PW etc.

I do not know the answer. (not a Java or Perl programmer)

Or is this a common problem with Java and Perl that needs to have the
"program" re-started often?

It causes the game to be "unavailable" most of the time.

Answers here or email sales@bishopsthegame.com

Thanks.




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

Date: Mon, 09 Oct 2000 20:58:46 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: re-start problem
Message-Id: <slrn8u4938.4h0.tjla@thislove.dyndns.org>

I was shocked! How could theomats <ejw@windsor.igs.net>
say such a terrible thing:
>Hi,
>Can someone volunteer to answer why my site "Bishops, A Chess Variant" needs
>to  be re-started quite often. My ISP has done all they can and the original
>programmer also has done what is needed to get the program (applet) running.
>The command I have been told to use is : perl5 bishops.cgi &

You have a bug in line 17

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
Humor in the Court:
Q: ...any suggestions as to what prevented this from being a murder trial 
   instead of an attempted murder trial?
A: The victim lived.


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

Date: Mon, 09 Oct 2000 21:02:02 GMT
From: Somniculosus <xs@korekom.com>
Subject: Re: regex
Message-Id: <8rtbo4$kl0$1@nnrp1.deja.com>

I thank you graciously for your help and advice.

Cheers,

Peter (somniculosus)


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


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

Date: Mon, 9 Oct 2000 14:07:10 -0400
From: "John Menke" <john@eagleinfosystems.com>
Subject: Re: system command
Message-Id: <39e2094a_2@news.eclipse.net>

I'm answering my own question:

to capture output to a file i just use backticks...

`perl rss2html.pl $urlsource > myfile.html`;

this does the trick instead of using the system command


John Menke <john@eagleinfosystems.com> wrote in message
news:39e1f97f_2@news.eclipse.net...
> > Use '>' rather than '|'.  The second symbol is a
> > pipe symbol which is meant to feed input to another
> > program.  For example, "rss2html | more"
> >
>
> doh...   I have tried to use '>' and that is still not writing the file.
>
> here is what I have:
>
>    my $progpath = "f:/rss2/";
>     @args = ("rss2html > myfile.html", $urlsource);
>     system $progpath (@args) == 0
>       or print "not working";
>
> It doesn't return an error, but the file never gets' written.  when I run
> this on the command line it will write the file:
>
> rss2html.pl http://slashdot.org/slashdot.rdf > myfile.html
>
> how do I do this via system and pass  variables instead of the url and the
> actual file?
>
>
>
>
>
>




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

Date: Mon, 09 Oct 2000 21:39:48 GMT
From: cfedde@u.i.sl3d.com (Chris Fedde)
Subject: Re: system command
Message-Id: <EWqE5.41$7J6.170565632@news.frii.net>

In article <39e1f97f_2@news.eclipse.net>,
John Menke <john@eagleinfosystems.com> wrote:
>> Use '>' rather than '|'.  The second symbol is a
>> pipe symbol which is meant to feed input to another
>> program.  For example, "rss2html | more"
>>
>
>doh...   I have tried to use '>' and that is still not writing the file.
>
>here is what I have:
>
>   my $progpath = "f:/rss2/";
>    @args = ("rss2html > myfile.html", $urlsource);
>    system $progpath (@args) == 0
>      or print "not working";
>
>It doesn't return an error, but the file never gets' written.  when I run
>this on the command line it will write the file:
>
>rss2html.pl http://slashdot.org/slashdot.rdf > myfile.html
>

Now I'm not a windows programmer by any measure but it looks to me
like there is a basic misunderstanding here.

System() executes a command line.  That means that you need to
construct the command for perl just as you would on the command
line.  If 

    rss2html.pl http://slashdot.org/slashdot.rdf > myfile.html

works from the dos prompt then

    system ("rss2html.pl http://slashdot.org/slashdot.rdf > myfile.html");

should work from inside perl.  It seems to me that your code does
not come even close to constructing that command line.

chris
-- 
    This space intentionally left blank


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

Date: Mon, 09 Oct 2000 18:09:02 GMT
From: rurban@xarch.tu-graz.ac.at (Reini Urban)
Subject: Re: the fastest way to test String A included by String B
Message-Id: <39e1fd10.790378604@judy>

[comp.lang.perl removed]

Lucas wrote:
>I got two strings,
>@A = ("apple", "banana", "cherry", "cocount", "pear", "peach", "mango");
>@B = ("cherry", "banana", "pear");

you've got two arrays. for strings the answer would be index().

>what is the fastest way to test whether B is a subset of A?

I don't know the fastest way. say it depends on the data. 
sometimes trees are best to implement a fast MEMBER. sometimes a simple
sorting of both lists is sufficient also. 
I'll show only the trivial implementation.

subsets are usually are defined like this: True if every element of B is
member of A.
Usually you would do a simple grep for membership, though grep doesn't
stop when found. faster is an explicit inner for loop.

# arrayref subset of array?
# subsetp(\@@) => 1|undef
sub subsetp {             # unsorted arrays
  my $B = shift;
  B: for my $b (@$B) { 
    for my $a (@_) {      # faster grep
      next B if $a eq $b; # the test function should really be a subref
    }
    return undef;         # not found, fail
  }
  return 1;
}

subsetp ([1,0,3],(0,1,2,3,4))  => 1
subsetp ([-1,0,3],(0,1,2,3,4)) => undef

a better subsetp would be:
              
# two arrayrefs and an optional coderef
# subsetf(\@\@;&) => 1|undef
# unfortunately \@ prototypes are still "broken"
# and builtin operators cannot be used as coderef, 
# like \eq instead of the sub
sub subsetf {		# unsorted arrays with funarg
  my $B = shift;
  my $A = shift;
  my $test = shift || sub {$_[0] eq $_[1]};
  B: for my $b (@$B) { 
    for my $a (@$A) {
      next B if &$test($a,$b);
    }
    return undef;
  }
  return 1;
}

print subsetf([0,2],[0,1,2]);
print subsetf([0,2],[0,1,2],sub {$_[0] eq $_[1]}); # string test
print subsetf([0,2],[0..20],sub {$_[0] == $_[1]}); # numeric test
print subsetf([0,-2],[0..20],sub {$_[0] == $_[1]}); # numeric test

-- 
Reini Urban
http://xarch.tu-graz.ac.at/autocad/news/faq/autolisp.html


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

Date: Mon, 09 Oct 2000 12:09:30 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: the fastest way to test String A included by String B
Message-Id: <39E217EA.1997EB2B@ipac.caltech.edu>

Lucas wrote:
> I got two strings,

    s/strings/lists/

> @A = ("apple", "banana", "cherry", "cocount", "pear", "peach", "mango");
> @B = ("cherry", "banana", "pear");
> 
> what is the fastest way to test whether B is a subset of A?

Fastest to run or fastest to write? I make no claims of optimacy, but varients
of this will be pretty fast by both measures:

my %tmp;
@tmp{@A}=();
print "yup, a subset\n" if grep(exists $A{$_},@B) == @B;

If @A can be kept in a hash to begin with, you'll skip the overhead of hash
(re)creation. Is order unimportant for @A? Is it OK to keep only unique
elements? If the answer to both of these is "yes", consider using a hash. 

--

-- Tim Conrow         tim@ipac.caltech.edu                           |


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

Date: Mon, 9 Oct 2000 20:22:58 +0100
From: "Makhno" <mak@imakhno.freeserve.co.uk>
Subject: Re: the fastest way to test String A included by String B
Message-Id: <8rt670$aqp$1@newsg3.svr.pol.co.uk>

>@A = ("apple", "banana", "cherry", "cocount", "pear", "peach", "mango");
>@B = ("cherry", "banana", "pear");

This might do what you're after, if I understand you correctly.

sub A_in_B
{
my %hash;
foreach (@A){$hash{$_}=0}
foreach (@B){$hash{$_}=0}
my @c=%hash;
return @c!=scalar(@A)+scalar(@B);
}






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

Date: 9 Oct 2000 20:25:09 GMT
From: James Young <jamesN0@5PAM.young.net>
Subject: UltraNewbie: grepping weblog
Message-Id: <8rt9j5$klr$1@news.panix.com>

Hi guys - Still in the early stages of learning perl.  I'm trying to write a
script to do the following:  

1) examine a web log and return the number of hits per each particular
category in my log. I'm currently using:

cat /tmp/logfile.tmp | grep "cat=1" | wc -l 
cat /tmp/logfile.tmp | grep "cat=2" | wc -l 
cat /tmp/logfile.tmp | grep "cat=3" | wc -l 
etc...

but I think perl would be the preferred solution if I knew what I was
doing.

2) Once I get the total number of hits per category, I woul also like to get
total number of hits per category in each individual language (also defined
in my web logs).  For this, I am using:

cat access_log | grep -i "cat=2" | grep -i "lang=EN" | wc -l >> result
etc...

I would love to be able to define 12 categories in perl (cat = 1, 2, 3, etc.)
and five languages (EN, SP, FR, TU, PR) and have perl generate a simple
report with both total hits per category, as well as hits per category, per
language (each language would have hits for 12 categories).  

This is what I have so far - I know its bad, but at least I'm trying....

Can anyone help give me a jump start?
Thanks! --Jim
===========================================
#! /usr/bin/perl -w

@langs = ('EN', 'SP', 'FR', 'TU', 'PR');

@cats = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);

% hit = ();

foreach $lang (@langs) {
  chomp($key=<STDIN>);
  @hits = grep /$lang/, $key;
    while () {
    chomp;
    $totalhits++;
    }

   print "Total hits of $lang = $totalhits";
}

======================
James Young
james at young dot net


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

Date: Mon, 09 Oct 2000 21:32:27 GMT
From: michaeljgardner@my-deja.com
Subject: Re: UltraNewbie: grepping weblog
Message-Id: <8rtdhb$m5r$1@nnrp1.deja.com>

In article <8rt9j5$klr$1@news.panix.com>,
  James Young <jamesN0@5PAM.young.net> wrote:
> Hi guys - Still in the early stages of learning perl.  I'm trying to
write a
> script to do the following:
>
> 1) examine a web log and return the number of hits per each particular
> category in my log. I'm currently using:
>
> cat /tmp/logfile.tmp | grep "cat=1" | wc -l
> cat /tmp/logfile.tmp | grep "cat=2" | wc -l
> cat /tmp/logfile.tmp | grep "cat=3" | wc -l
> etc...
>
> but I think perl would be the preferred solution if I knew what I was
> doing.
>
> 2) Once I get the total number of hits per category, I woul also like
to get
> total number of hits per category in each individual language (also
defined
> in my web logs).  For this, I am using:
>
> cat access_log | grep -i "cat=2" | grep -i "lang=EN" | wc -l >> result
> etc...
>
> I would love to be able to define 12 categories in perl (cat = 1, 2,
3, etc.)
> and five languages (EN, SP, FR, TU, PR) and have perl generate a
simple
> report with both total hits per category, as well as hits per
category, per
> language (each language would have hits for 12 categories).
>
> This is what I have so far - I know its bad, but at least I'm
trying....
>
> Can anyone help give me a jump start?
> Thanks! --Jim
> ===========================================
> #! /usr/bin/perl -w
>
> @langs = ('EN', 'SP', 'FR', 'TU', 'PR');
>
> @cats = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);

So far, so good, you're defining the things you're looking for.
>
> % hit = ();

% refers to a hash, and you're undefining it? why?
>
> foreach $lang (@langs) {

Now you're checking for each language that is in the language array

>   chomp($key=<STDIN>);

This I don't understand, where is your input coming from??  Are you
parsing a file one line at a time???  If so, did you open the file?  The
web log is a log file??  The syntax you have above reads one line from
<stdin>, which in this case would be input from the keyboard.
Additionally, you're reading it into a scalar variable not an array.

>   @hits = grep /$lang/, $key;

The grep function filters an array, and returns another array of items
from the first array that match the condition specificed.  Here you're
grepping a scalar and filtering it to an array.  I don't think you want
to do this.


>     while () {
>     chomp;
>     $totalhits++;
>     }

I'm not sure what this code is,  does each line in the file represent a
hit?  Take a look at hashes and see if you can increment the hash keyed
to a language each time you take a language hit, i.e.

$totalhash{$lang}++;

>
>    print "Total hits of $lang = $totalhits";
> }
>
> ======================
> James Young
> james at young dot net
>

I suggest you look up the grep function and look at using <stdin> from a
file using the open command.  Perhaps then you can make a small log
(say 5 lines) file and try to process it.  If it doesn't work, post the
log file, the program, and the output here, and someone will help.
Also, maybe try to check languages first and get that working, then
worry about total hits, etc.

HTH,
Michael

for(split//,'K=KKO0=<0O0=K0O@=-0OHKK0OOK=KK=KKO=E=0=<=OKA=0KKKO=?=0=<'.
'>O==K0=K=OOK,,<O=HB<OK@E<O<D<<O<J<DOO=KK=KKO==<><=OKK<HKKO==<><>O==K'.
'=K='){if(/O/){$r.=$/;next}vec($d,0,8)=(ord)-44;$r.=unpack('B8',$d)}$r
=~y/10/_ /;print$r


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


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

Date: Mon, 9 Oct 2000 18:00:48 -0400
From: "Rao" <rrao@unf.edu>
Subject: Using SSI in perl program
Message-Id: <39e24037.0@csd-32630.noc.unf.edu>

I would appreciate an example code to include an SSI tag inside a perl
program i.e. how to make something like the following work:
#!usr/bin/perl -w
print "Content-type: text/html\n\n";
print <<THIS;
<HTML><BODY>
<!--#include file="themenu.html"-->
THIS
print "</BODY></HTML>;

Thanks in advance




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

Date: 9 Oct 2000 18:38:49 GMT
From: "Josiah" <jdb@wcoil.com>
Subject: Re: Windows system tray
Message-Id: <8rt3bp$p1m$0@206.230.71.18>

Amir E. Aharoni <amir_e_a@netvision.net.il> wrote in message
news:8rsqj3$qf7$1@news.netvision.net.il...
> Does anyone know how to make Perl use Windows' taskbar system tray?
>
> I tried looking in CPAN and found nada; and MSDN has only Visual Basic
> examples.
>
> Thanks in advance for any help.
>

What you want is Win32::GUI

Look at:
http://dada.perl.it/gui_docs/NotifyIcon.html#new_Win32_GUI_NotifyIcon_PAREN
for docs on what you are looking for

hth,

--
$josiah;




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

Date: Mon, 09 Oct 2000 20:52:10 GMT
From: J. Stone <jstone211@my-deja.com>
Subject: Writing to log files
Message-Id: <8rtb5n$k48$1@nnrp1.deja.com>

I have some code that gives me some odd results.  I want to write to a
log file the time I start executing and the program name, and in the
code after that I want to evaluate the options specified and print what
was selected (if options were selected) to a log file.  The problem is
that the options messages are printed before the message w/ the time
stamp and program name.  WHY?  In the code the options are evaluated
AFTER I open the log file and then print the timestamp/program name to
a file.  Why is this happening and how to I correct this?

Julia Stone


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


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

Date: Mon, 09 Oct 2000 21:20:39 GMT
From: cfedde@u.i.sl3d.com (Chris Fedde)
Subject: Re: Writing to log files
Message-Id: <HEqE5.40$7J6.170565632@news.frii.net>

In article <8rtb5n$k48$1@nnrp1.deja.com>,
J. Stone  <jstone211@my-deja.com> wrote:
>I have some code that gives me some odd results.  I want to write to a
>log file the time I start executing and the program name, and in the
>code after that I want to evaluate the options specified and print what
>was selected (if options were selected) to a log file.  The problem is
>that the options messages are printed before the message w/ the time
>stamp and program name.  WHY?  In the code the options are evaluated
>AFTER I open the log file and then print the timestamp/program name to
>a file.  Why is this happening and how to I correct this?
>

Your description makes it sounds like you are getting hit by some
kind of buffering problem.  See if you can pare down your code to
just a few lines that exibit the problem. If you haven't isolated
the failure by doing that, you can post the sample here so that we
have something to examine.

chris
-- 
    This space intentionally left blank


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

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


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