[31561] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2820 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 16 16:09:29 2010

Date: Tue, 16 Feb 2010 13:09:11 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 16 Feb 2010     Volume: 11 Number: 2820

Today's topics:
    Re: a defense of ad hoc software development <dr.mtarver@ukonline.co.uk>
        Anyone willing to modify 3rd party perl code? <buck@private.mil>
    Re: How to get offset position from unpack()? <jl_post@hotmail.com>
        moving applications to Windows, database and all <cartercc@gmail.com>
    Re: readdir: is there a way to reset cursor to beginnin <Peter@PSDT.com>
    Re: readdir: is there a way to reset cursor to beginnin <uri@StemSystems.com>
        saving old versions of file <jampe@darkbusstop.com>
    Re: saving old versions of file <RedGrittyBrick@spamweary.invalid>
    Re: saving old versions of file <cartercc@gmail.com>
    Re: saving old versions of file <uri@StemSystems.com>
    Re: saving old versions of file <jurgenex@hotmail.com>
    Re: saving old versions of file <sreservoir@gmail.com>
    Re: saving old versions of file <devnull4711@web.de>
    Re: saving old versions of file <hhr-m@web.de>
    Re: saving old versions of file <cartercc@gmail.com>
    Re: saving old versions of file <uri@StemSystems.com>
    Re: saving old versions of file <jampe@darkbusstop.com>
    Re: saving old versions of file <devnull4711@web.de>
    Re: saving old versions of file <jampe@darkbusstop.com>
    Re: saving old versions of file <jampe@darkbusstop.com>
    Re: saving old versions of file <hjp-usenet2@hjp.at>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 16 Feb 2010 12:50:00 -0800 (PST)
From: Mark Tarver <dr.mtarver@ukonline.co.uk>
Subject: Re: a defense of ad hoc software development
Message-Id: <2f580d01-8f4c-4c08-a6a6-8fc84dd4658e@15g2000yqa.googlegroups.com>

On 14 Jan, 14:46, ccc31807 <carte...@gmail.com> wrote:
> On page 229 of Paul Graham's 'ANSI Common Lisp' he writes:
>
> =A0<quote>
> =A0 =A0 =A0If programming were an entirely mechanical process -- a matter=
 of
> simply translating specifications into code -- it would be reasonable
> to do everything in a single step. But programming is never like that.
> No matter how precise the specifications, programming always involves
> a certain amount of exploration -- usually a lot more than anyone had
> anticipated.
> =A0 =A0 =A0It might seem that if the specifications wee good, programming
> would simply be a matter of translating them into code. This is a
> widespread misconception. Programming necessarily involves
> exploration, because specifications are necessarily vague. If they
> weren't vague, they wouldn't be specifications.
> =A0 =A0 =A0In other fields, it may be desirable for specifications to be =
as
> precise as possible. If you're asking for a piece of metal to be cut
> into a certain shape, it's probably best to say exactly what you want.
> But this rule does not extend to software, because programs and
> specifications are made out of the same thing: text. You can't write
> specifications that say exactly what you want. If the specification
> were that precise, then they would be the program.
> </quote>
>
> In a footnote, Graham writes:
>
> <quote>
> =A0 =A0 =A0The difference between specifications and programs is a
> difference in degree, not a difference in kind. Once we realize this,
> it seems strange to require that one write specifications for a
> program before beginning to implement it. If the program has to be
> written in a low-level language, then it would be reasonable to
> require that it be described in high-level terms first. But as the
> programming language becomes more abstract, the need for
> specifications begins to evaporate. Or rather, the implementation and
> the specifications can become the same thing.
> =A0 =A0 =A0If the high-level language is going to be re-implemented in a
> lower-level language, it starts to look even more like specifications.
> What Section 13l.7 is saying, in other words, is that the
> specifications for C programs could be written in Lisp.
> </quote>
>
> In my SwE classes, we spent a lot of time looking at process and
> processes, including MIL STD 498 and IEEE Std 830-1984, etc. My
> professors were both ex-military, one who spent his career in the USAF
> developing software and writing Ada, and both were firmly in the
> 'heavy' camp (as opposed to the lightweight/agile camp).
>
> In my own job, which requires writing software for lay users, all I
> ever get is abbreviated English language requests, and I have learned
> better than to ask users for their requirements because they have no
> idea what requirements are. (As a joke, I have sent a couple a copy of
> IEEE Std 830-1984 and told them that I needed something like that, but
> the joke went over like a lead balloon -- not funny at all.) Of
> necessity I have learned to expect to write a number of versions of
> the same script before the user accepts it.
>
> I understand that Graham isn't talking about requirements, and to many
> people specifications and requirements amount to the same thing. I
> also understand the necessity for planning. However, the Graham quote
> seems to me a reasonable articulation for ad hoc development. (It's
> something I wanted to say to jue in particular but couldn't find the
> words.)
>
> Comments?
>
> CC

QUOTE
You can't write specifications that say exactly what you want. If the
specification
were that precise, then they would be the program.
UNQUOTE

That's a very clever and profound observation from Paul Graham. The
formal methods people might disagree though.

I think the obvious counterexample comes from constructive type
theory, where the specification is a type designed to determine the
program.  But the specification is nevertheless not itself a program.
The program emerges as a byproduct of an attempt to prove that the
specification can be met (that the type is inhabited).  That's not the
end of the argument; its just pawn to e4, pawn to e5 in this debate.

Mark


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

Date: 16 Feb 2010 20:20:39 GMT
From: buck <buck@private.mil>
Subject: Anyone willing to modify 3rd party perl code?
Message-Id: <hleumn01gjj@news2.newsguy.com>

I have a perl script written by Christian Mock obtained from 
http://www.tahina.priv.at/~cm/spam/ .  The purpose of this code is to 
ask SMTP servers not already whitelisted in greylist,sqlite DB to wait a 
while and then retry sending to my Postfix SMTP server (selective SPAM 
control).  The script does not work as I'd like, so I'd like for it to 
be thoroughly commented and modified so that it does what I want.  I am 
not capable of doing that.

If anyone is willing to comment and/or modify the code, it can be 
downloaded from ftp://andthatsjazz.org/pub/meta-greylist and uploaded to 
ftp://andthatsjazz.org/incoming.

Alternatively, if anyone knows of an existing script that is better, a 
link to it would be welcome.
--
buck


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

Date: Tue, 16 Feb 2010 08:33:33 -0800 (PST)
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: How to get offset position from unpack()?
Message-Id: <87430f0f-ff0a-4d24-9db8-d4dd1fdb1015@k2g2000pro.googlegroups.com>

> Quoth "jl_p...@hotmail.com" <jl_p...@hotmail.com>:
>
> However, there's something I want to do with unpack() that I
> haven't figured out how to do: =A0I'd like to unpack part of a
> string, but keep track of where the unpacking ended, so I can
> resume unpacking the string (at a later time) where I left off.


On Feb 15, 1:48=A0pm, Ben Morrow <b...@morrow.me.uk> replied:
> =A0 =A0 ~% perl -E'my $x =3D "aaa"; say for unpack "a2.", $x'
> =A0 =A0 aa
> =A0 =A0 2
> =A0 =A0 ~%


   Wow, thanks!  The '.' character was exactly what I was looking for!

   (I notice it's new in Perl 5.10, so if I'm working for platforms
that have an older version of Perl I'll just have to just the old "a*"
trick.)

   I tried searching for "."'s behavior in "perldoc -f unpack",
"perldoc -f pack", and even "perldoc perlpacktut", but I couldn't find
where it mentions that it returns the offset when used with unpack().
Is there a place that explains this with a little more depth?

   Anyway, thanks for your help, Ben.  I really appreciate it.

   -- Jean-Luc


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

Date: Tue, 16 Feb 2010 11:26:50 -0800 (PST)
From: ccc31807 <cartercc@gmail.com>
Subject: moving applications to Windows, database and all
Message-Id: <51cf235a-9402-4ef2-8fca-0114f9648e3d@l19g2000yqb.googlegroups.com>

Several years ago, I wrote a web interface to a database using Linux,
Apache, Postgres, and Perl. It has proven useful several times, and as
a result I have moved the application to new Linux machines. It's not
too difficult to do by hand: create a new user and tar the content of
the old home directory to the new one, create a sym link in the
document root pointing to the web content, configure httpd.conf and
start Apache, import the schema into the database and start the
database server, and it's done.

Recently I've had the experience of moving the application to a
Windows server (using Apache and MySQL) it it was difficult enough for
me to wish for some kind of installer file. I have to actually install
Apache and MySQL on the server since they don't come natively with
Windows Since I anticipate having to do this again in the near future,
I'm wondering how I could create an automated solution to install and
configure Apache and MySQL, copy the files, and do the configuration
in one step.

Is this possible with Perl?

Also, this is beginning to be a commercial enterprise (i.e., I will
charge for the application) so does this have any implications for
MySQL?

Thanks, CC.


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

Date: Tue, 16 Feb 2010 14:20:31 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: readdir: is there a way to reset cursor to beginning?
Message-Id: <PQxen.35673$aU4.25457@newsfe13.iad>

On Tue, 16 Feb 2010 02:48:23 -0500, Uri Guttman wrote:
> i hate all the duplicate pushes. try this on for size (untested :):
> 
> use File::Slurp ;
> push( @{ -d "$folder/$_" ? \@folders : \@files }, $_ ) for read_dir(
> 'C:' );
> 
> that assumes if it ain't a dir, it is a file.

As long as we're trying to reduce duplication and maintain clarity and 
semantics, how about:

use File::Slurp;
my (@files, @folders);
my $folder = 'C:';  
for ( map { "$folder/$_" } read_dir $folder )
{
  my $dest = -d ? \@folders : -f ? \@files : '';
  push @$dest, $_ if $dest;
}

or (equally untested, don't know if the glob pattern is right for a 
Windows box, am not near one):

my (@files, @folders);
for ( glob 'C:/*.*' )
{
  my $dest = -d ? \@folders : -f ? \@files : '';
  push @$dest, $_ if $dest;
}

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=0137001274


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

Date: Tue, 16 Feb 2010 11:06:02 -0500
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: readdir: is there a way to reset cursor to beginning?
Message-Id: <87fx51go7p.fsf@quad.sysarch.com>

>>>>> "b" == bugbear  <bugbear@trim_papermule.co.uk_trim> writes:

  b> Uri Guttman wrote:
  >>>>>>> "JWK" == John W Krahn <someone@example.com> writes:
  >> 
  JWK> Patrick H. wrote:
  >> >> Hi, I am toying around with the directory operations chapter of
  >> >> "Learning Perl" and ran into a bit of a snag.
  >> >>   >> I am trying to open a directory, output all the -f files
  >> to a @files
  >> >> array and all the -d files to a @folders array. The problem is it
  >> >> seems to only work for the first instance of readdir I use; they both
  >> >> work individually when I comment the other out, but when I have them
  >> >> both only the first array is populated. Do I need to closedir and then
  >> >> opendir again, or is there a way for me to reset the cursor (if that
  >> >> is even the right terminology)?
  >> 
  JWK> perldoc -f rewinddir
  >> 
  >> i recalled that was in there. but it isn't needed as you note below
  >> 
  JWK> my ( @files, @folders );
  JWK> while ( my $file = readdir C_DRIVE ) {
  JWK> push @files   if -f "$folder/$file";
  JWK> push @folders if -d "$folder/$file";
  JWK> }
  >> 
  >> i hate all the duplicate pushes. try this on for size (untested :):
  >> 
  >> use File::Slurp ;
  >> push( @{ -d "$folder/$_" ? \@folders : \@files }, $_ ) for read_dir( 'C:' );

  b> Yikes. That's a triumph of ingenuity over clarity IMHO.

hence the :) before it. :)

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Tue, 16 Feb 2010 10:29:27 -0500
From: Jarmo <jampe@darkbusstop.com>
Subject: saving old versions of file
Message-Id: <n7qq47-gfj.ln1@news.darkbusstop.com>

I have a problem and I was hoping someone could help me. I have a program
that every time it runs it saves a log file with same name about the changes
it did on that particular run. Result is that old file gets overwritten and
lost. I would like to create "virtual file" so that every time foobar.log is
written I actually end up with a file that has date and time added to it.

In other words:
I run application that writes to "foobar.log" and I want the file actually
go to "~/foobarlogs/foobarYYYY-MM-DD-HH-MM-SS.log" instead. 

I know I did something similar years ago with perl but my
programming/scripting skills are too rusty to accomplish it anymore on my
own. I would greatly appreciate the help.

  Jarmo


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

Date: Tue, 16 Feb 2010 16:26:24 +0000
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: saving old versions of file
Message-Id: <4b7ac730$0$2525$da0feed9@news.zen.co.uk>

On 16/02/2010 15:29, Jarmo wrote:
> I have a problem and I was hoping someone could help me. I have a program
> that every time it runs it saves a log file with same name about the changes
> it did on that particular run. Result is that old file gets overwritten and
> lost. I would like to create "virtual file" so that every time foobar.log is
> written I actually end up with a file that has date and time added to it.
>
> In other words:
> I run application that writes to "foobar.log" and I want the file actually
> go to "~/foobarlogs/foobarYYYY-MM-DD-HH-MM-SS.log" instead.
>
> I know I did something similar years ago with perl but my
> programming/scripting skills are too rusty to accomplish it anymore on my
> own. I would greatly appreciate the help.

The obvious (to me) answer is not to run the program directly but run it 
from a script. The script can rename the logfile after the program exits.

For a Perl solution, the following might be a useful starting point.
   perldoc -f system
   perldoc -f localtime
   perldoc -f rename

You could also do this quite easily in any of the popular Unix shells.
   man date


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

Date: Tue, 16 Feb 2010 10:11:44 -0800 (PST)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: saving old versions of file
Message-Id: <1066c2bf-3a98-4d7b-a82f-fc9e38dc6cf8@e1g2000yqh.googlegroups.com>

On Feb 16, 10:29=A0am, Jarmo <ja...@darkbusstop.com> wrote:
> lost. I would like to create "virtual file" so that every time foobar.log=
 is
> written I actually end up with a file that has date and time added to it.

#make log file name with time string
my ($s, $m, $h, $d, $m, $y, @r) =3D localtime();
my $timestring =3D sprintf ("%d-%02d-%02d-%02d-%02d-%02s", $y + 1900, $m
+ 1, $d, $h, $m, $s);
my $logfile =3D "log_${timestring}.txt";
#open log file
open LOG, '>', $logfile;
#write to log
close LOG;

Better, in my opinion, is to use the append operator ('>>') and write
to the same file daily, but this depends on the quantity of logging
you do.

CC


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

Date: Tue, 16 Feb 2010 13:27:31 -0500
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: saving old versions of file
Message-Id: <87r5olc9yk.fsf@quad.sysarch.com>

>>>>> "c" == ccc31807  <cartercc@gmail.com> writes:

  c> On Feb 16, 10:29 am, Jarmo <ja...@darkbusstop.com> wrote:
  >> lost. I would like to create "virtual file" so that every time foobar.log is
  >> written I actually end up with a file that has date and time added to it.

  c> #make log file name with time string
  c> my ($s, $m, $h, $d, $m, $y, @r) = localtime();
  c> my $timestring = sprintf ("%d-%02d-%02d-%02d-%02d-%02s", $y + 1900, $m
  c> + 1, $d, $h, $m, $s);

GACK!! please use POSIX::strftime. i hate seeing hand made date
formatting. all you need is in that one sub and with less cruft and
noise and chance for errors.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Tue, 16 Feb 2010 10:27:31 -0800
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: saving old versions of file
Message-Id: <fooln5ln3kejpf7d0g7nq9o8vuk7sbrgok@4ax.com>

Jarmo <jampe@darkbusstop.com> wrote:
>I have a problem and I was hoping someone could help me. I have a program
>that every time it runs it saves a log file with same name about the changes
>it did on that particular run. Result is that old file gets overwritten and
>lost. I would like to create "virtual file" so that every time foobar.log is
>written I actually end up with a file that has date and time added to it.
>
>In other words:
>I run application that writes to "foobar.log" and I want the file actually
>go to "~/foobarlogs/foobarYYYY-MM-DD-HH-MM-SS.log" instead. 

Not a Perl solution but what about running a cron job at midnight which
does a 
	ln -s foobar.log foobar[whateverthenewdayis]

jue


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

Date: Tue, 16 Feb 2010 13:46:00 -0500
From: sreservoir <sreservoir@gmail.com>
Subject: Re: saving old versions of file
Message-Id: <hlep5h$jk$1@speranza.aioe.org>

On 2/16/2010 10:29 AM, Jarmo wrote:
> I have a problem and I was hoping someone could help me. I have a program
> that every time it runs it saves a log file with same name about the changes
> it did on that particular run. Result is that old file gets overwritten and
> lost. I would like to create "virtual file" so that every time foobar.log is
> written I actually end up with a file that has date and time added to it.
>
> In other words:
> I run application that writes to "foobar.log" and I want the file actually
> go to "~/foobarlogs/foobarYYYY-MM-DD-HH-MM-SS.log" instead.
>
> I know I did something similar years ago with perl but my
> programming/scripting skills are too rusty to accomplish it anymore on my
> own. I would greatly appreciate the help.

strftime("~/foobarlogs/foobar%Y-%m-%d-%H-%M-%S.log", gmtime);

though I doubt what you want is a directory named ~.

-- 

   "Six by nine. Forty two."
   "That's it. That's all there is."
   "I always thought something was fundamentally wrong with the universe"


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

Date: Tue, 16 Feb 2010 20:09:23 +0100
From: Frank Seitz <devnull4711@web.de>
Subject: Re: saving old versions of file
Message-Id: <7u08r3FrbpU1@mid.individual.net>

Jürgen Exner wrote:
> Jarmo <jampe@darkbusstop.com> wrote:
>> I have a problem and I was hoping someone could help me. I have a program
>> that every time it runs it saves a log file with same name about the changes
>> it did on that particular run. Result is that old file gets overwritten and
>> lost. I would like to create "virtual file" so that every time foobar.log is
>> written I actually end up with a file that has date and time added to it.
>>
>> In other words:
>> I run application that writes to "foobar.log" and I want the file actually
>> go to "~/foobarlogs/foobarYYYY-MM-DD-HH-MM-SS.log" instead. 
> 
> Not a Perl solution but what about running a cron job at midnight which
> does a 
> 	ln -s foobar.log foobar[whateverthenewdayis]

A symlink is obviously not a solution, because the file
gets overwritten with every run.

Frank
-- 
Dipl.-Inform. Frank Seitz
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel

Blog: http://www.fseitz.de/blog
XING-Profil: http://www.xing.com/profile/Frank_Seitz2


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

Date: Tue, 16 Feb 2010 20:16:51 +0100
From: Helmut Richter <hhr-m@web.de>
Subject: Re: saving old versions of file
Message-Id: <Pine.LNX.4.64.1002162012490.8739@lxhri01.lrz.lrz-muenchen.de>

On Tue, 16 Feb 2010, Frank Seitz wrote:

> > 	ln -s foobar.log foobar[whateverthenewdayis]
> 
> A symlink is obviously not a solution, because the file
> gets overwritten with every run.

The other way would work:

Every night:
  rm foobar.log
  ln -s foobar[whateverthenewdayis] foobar.log

-- 
Helmut Richter


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

Date: Tue, 16 Feb 2010 11:29:50 -0800 (PST)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: saving old versions of file
Message-Id: <2908b0c3-0abd-467c-8ca7-e26612e78a49@b2g2000yqi.googlegroups.com>

On Feb 16, 1:27=A0pm, "Uri Guttman" <u...@StemSystems.com> wrote:
>
> GACK!! please use POSIX::strftime. i hate seeing hand made date
> formatting. all you need is in that one sub and with less cruft and
> noise and chance for errors.

I have to create these kinds of file names and directory names in just
about every script I write, so I wrote a utility library to make it
easy. It's not any cruft, at least not in the executable script, but I
wasn't aware that POSIX::strftime existed. I'll try it and see if it's
any easier. Thanks for the pointer.

CC.


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

Date: Tue, 16 Feb 2010 14:31:30 -0500
From: "Uri Guttman" <uri@StemSystems.com>
Subject: Re: saving old versions of file
Message-Id: <87ocjp9dv1.fsf@quad.sysarch.com>

>>>>> "c" == ccc31807  <cartercc@gmail.com> writes:

  c> On Feb 16, 1:27 pm, "Uri Guttman" <u...@StemSystems.com> wrote:
  >> 
  >> GACK!! please use POSIX::strftime. i hate seeing hand made date
  >> formatting. all you need is in that one sub and with less cruft and
  >> noise and chance for errors.

  c> I have to create these kinds of file names and directory names in just
  c> about every script I write, so I wrote a utility library to make it
  c> easy. It's not any cruft, at least not in the executable script, but I
  c> wasn't aware that POSIX::strftime existed. I'll try it and see if it's
  c> any easier. Thanks for the pointer.

it has to be easier as it already supports all the common date/time
formats and parts you want. it requires no temp variables, no need to
mung the values (+1900, etc), and it is stable. you can change the
format easily unlike a hand written version.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------


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

Date: Tue, 16 Feb 2010 14:56:44 -0500
From: Jarmo <jampe@darkbusstop.com>
Subject: Re: saving old versions of file
Message-Id: <ss9r47-67k.ln1@news.darkbusstop.com>

sreservoir <sreservoir@gmail.com> wrote:

> strftime("~/foobarlogs/foobar%Y-%m-%d-%H-%M-%S.log", gmtime);

That is a nice and simple way to get the date and time compared to monster
I was working on...

> though I doubt what you want is a directory named ~.

No, I don't. Not sure how that got there in the first place as ~ isn't even
close to " or / on my keyboard.

-- 
  Jampe
----------------------------------------------------------------
Things are getting worse. Please send chocolate.
----------------------------------------------------------------


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

Date: Tue, 16 Feb 2010 21:01:19 +0100
From: Frank Seitz <devnull4711@web.de>
Subject: Re: saving old versions of file
Message-Id: <7u0bsfFrbpU2@mid.individual.net>

Helmut Richter wrote:
> On Tue, 16 Feb 2010, Frank Seitz wrote:

>>> 	ln -s foobar.log foobar[whateverthenewdayis]
>>
>> A symlink is obviously not a solution, because the file
>> gets overwritten with every run.
> 
> The other way would work:
> 
> Every night:
>   rm foobar.log
>   ln -s foobar[whateverthenewdayis] foobar.log

No, but a hardlink (ln without -s) or cp would do it.

Frank
-- 
Dipl.-Inform. Frank Seitz
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel

Blog: http://www.fseitz.de/blog
XING-Profil: http://www.xing.com/profile/Frank_Seitz2


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

Date: Tue, 16 Feb 2010 15:19:20 -0500
From: Jarmo Sillanpaa <jampe@darkbusstop.com>
Subject: Re: saving old versions of file
Message-Id: <87br47-kck.ln1@news.darkbusstop.com>

RedGrittyBrick <RedGrittyBrick@spamweary.invalid> wrote:

> The obvious (to me) answer is not to run the program directly but run it 
> from a script. The script can rename the logfile after the program exits.

I didn't consider that an option at first because I have several different
people running the program at random times and I didn't think I could count
on them remembering to start using a new command to start it. Now reading
this I had an idea that I could rename the original executable and make the
script with the original name. I think that is what I will do. 

-- 
  Jampe
----------------------------------------------------------------
Things are getting worse. Please send chocolate.
----------------------------------------------------------------


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

Date: Tue, 16 Feb 2010 15:22:20 -0500
From: Jarmo Sillanpaa <jampe@darkbusstop.com>
Subject: Re: saving old versions of file
Message-Id: <scbr47-kck.ln1@news.darkbusstop.com>

Thanks for answers. I went with a different implementation although I am
still curious if it is possible to do what I was thinking about first. 
-- 
  Jampe
----------------------------------------------------------------
Things are getting worse. Please send chocolate.
----------------------------------------------------------------


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

Date: Tue, 16 Feb 2010 21:15:31 +0100
From: "Peter J. Holzer" <hjp-usenet2@hjp.at>
Subject: Re: saving old versions of file
Message-Id: <slrnhnlv73.qja.hjp-usenet2@hrunkner.hjp.at>

On 2010-02-16 19:56, Jarmo <jampe@darkbusstop.com> wrote:
> sreservoir <sreservoir@gmail.com> wrote:
>
>> strftime("~/foobarlogs/foobar%Y-%m-%d-%H-%M-%S.log", gmtime);
>
> That is a nice and simple way to get the date and time compared to monster
> I was working on...
>
>> though I doubt what you want is a directory named ~.
>
> No, I don't. Not sure how that got there in the first place as ~ isn't even
> close to " or / on my keyboard.

~ is an abbreviation for the home directory in most shells. So in Perl
that would be:

 $ENV{HOME} . strftime("/foobarlogs/foobar%Y-%m-%d-%H-%M-%S.log", gmtime);

	hp


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

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


Administrivia:

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

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 V11 Issue 2820
***************************************


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