[7459] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1083 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 26 10:18:09 1997

Date: Fri, 26 Sep 97 07:00:31 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 26 Sep 1997     Volume: 8 Number: 1083

Today's topics:
     Re: ??? TiffInfo or TiffHandle in PERL <rootbeer@teleport.com>
     Re: a2p (newbie question) <rootbeer@teleport.com>
     Re: Can anonymous subroutines also be anonymous methods <ghowland@hotlava.com>
     Re: Changing same line in all HTML pages <afsypng@sphinx.cmc.ec.gc.ca>
     Re: Date Algorithm needed (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: Date Algorithm needed <rootbeer@teleport.com>
     Re: Date Algorithm needed <dennis_sherman@unc.edu>
     Re: DB_File gotchas (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: Display images on specific dates? <rootbeer@teleport.com>
     Re: GD gifs on disk take up memory!!!???!!! <rootbeer@teleport.com>
     Re: Help.Where do Perl users look for a job? (Scott McMahan)
     Re: How do I Find a CGI Programmer? <fp@pmpcs.com>
     how do I read the Time and Date with CGI? (Preferred Client)
     Re: How Filter work ! <seay@absyss.fr>
     How to extract function calls and parameters from sourc <a.keskin@goudengids.nl>
     Re: How to extract function calls and parameters from s (Tad McClellan)
     How to generate a regexp from the strings you want to m (Frederic GARZON)
     Re: Is Perl Year2000 compliant? <seay@absyss.fr>
     Re: Julian Date Routine <Brian.Ewins@dont.spam.me>
     Re: MIME Header "Location:" <rootbeer@teleport.com>
     Re: mmap? <seay@absyss.fr>
     Re: mmap? <qdtcall@esb.ericsson.se>
     Re: oraperl subroutines (Christian Mondrup)
     Re: Perl script is not executed by Web browser <rootbeer@teleport.com>
     Re: Perl to Java Compiler? <mewilcox@unt.edu>
     Re: Perl to Java Compiler? <merlyn@stonehenge.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 26 Sep 1997 06:20:57 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: zizi zhao <ziziz@worldnet.att.net>
Subject: Re: ??? TiffInfo or TiffHandle in PERL
Message-Id: <Pine.GSO.3.96.970926062004.376N-100000@usertest.teleport.com>

On Fri, 26 Sep 1997, zizi zhao wrote:

> Is there any PERL utility to get TiffInfo from an
> image.tiff, or execute shell command
> 
> 	% tiffinfo image.tiff
> 
> to return information of tiff images files like
> what we have
>  
> 	($size, $atime, $mtime, $ctime) = (stat($file))[7, 8, 9, 10];
> 
> for any UNIX file?

Maybe you want a module like Image::Size, which you can find on CPAN.

    http://www.perl.com/CPAN/
    http://www.perl.org/CPAN/

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 26 Sep 1997 06:02:11 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: samdie@ibm.net
Subject: Re: a2p (newbie question)
Message-Id: <Pine.GSO.3.96.970926055730.376J-100000@usertest.teleport.com>

On Thu, 25 Sep 1997 samdie@ibm.net wrote:

> I wanted to convert a bunch of my AWK scripts to Perl and experiment
> with them but I don't get any output. I tried with a number of AWK
> scripts and in all cases, after a second or so, I'm back at the command
> prompt; no error messages, no new files in the directory, nothing to the
> screen. 
> 
> As a specific example, I took a script that I would usually run by
> \awk\gawk32 -f reorg.awk < images.fmt and entered: \perl\emx\bin\a2p
> reorg.awk

That looks right from what I know, although I'd probably redirect the
output to a file. Have you tried using a2p's debugging option?

I've heard that a2p isn't able to deal with all of the features added in
some awk variants, such as gawk. Could you have used some feature that a2p
doesn't understand? (Not that it shouldn't give some diagnostic message in
that case...)

Hope this helps!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 26 Sep 1997 10:23:39 +0200
From: Gary Howland <ghowland@hotlava.com>
To: Mark Nielsen <men2@auto.med.ohio-state.edu>
Subject: Re: Can anonymous subroutines also be anonymous methods?
Message-Id: <342B710B.DA1@hotlava.com>

Mark Nielsen wrote:
> 
> I currenty have a method executing like this
> 
> $Object -> Method ("$Variable");
> 
> With an anonymous subroutine, I can do something like this,
> &{$ReferenceToSubroutine};
> 
> I would like ot be able to do the following
> $Object -> {$ReferenceToMethod} ("$Variable");
> But I cannot. Can you use a reference to a method that is not anonymous?
> If so, how? Can you use anonymous methods?
> 
> The reason is, I would like to be able to make a reference be able to point
> to whatever method I want to point it to.

No need for anonymous subroutines - just use the method name, since they
are evaluated dynamically.  Take a look at this short example, and
notice how the method name is stored in the $method scalar.

	use strict;
	use IO::File;
 
	my $fh = new IO::File "< this-file";
 
	my $method = "getlines";
	print $fh->$method();


Gary
-- 
pub  1024/C001D00D 1996/01/22  Gary Howland <gary@hotlava.com>
Key fingerprint =  0C FB 60 61 4D 3B 24 7D  1C 89 1D BE 1F EE 09 06


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

Date: 26 Sep 1997 08:27:35 -0400
From: Jacques Marcoux <afsypng@sphinx.cmc.ec.gc.ca>
Subject: Re: Changing same line in all HTML pages
Message-Id: <y2eyb4kz2dk.fsf@sphinx.cmc.ec.gc.ca>

>>>>> "Eric" == Eric  <pojo@gte.net.nospam> writes:

    Eric> On 25 Sep 1997 15:29:16 GMT, koos_pol@nl.compuware.com.NO_JUNK_MAIL (Koos Pol)
    Eric> wrote:

    >> Does someone have a script laying around for changing the same line in
    >> all your HTML pages? E.g. a different footer or a specific link.
    >> I know it's not difficult, but why go through the same if someone
    >> already did it, right?

    Eric> You're using a sledgehammer to swat a fly.  Just pick up a decent text
    Eric> editor with multiple file search & replace.  If you're using Win 95, a decent
    Eric> freeware editor is "Super NoteTab":

    Eric> http://www.unige.ch/sciences/terre/geologie/fookes/



   perl -pi -e 's/Ye olde line/Handy dandy new line/g' *.html

-- 
	______                                    ______ 
	___/ /_______________________________________/ /_
	/_  __//_____//_Jacques_//_Marcoux_//_____/_  __/
	 /_/                                       /_/   
	       jmarcoux@ec.gc.ca 514.421.4794



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

Date: Fri, 26 Sep 97 08:25:01 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Date Algorithm needed
Message-Id: <342bae80$1$ofn$mr2ice@speaker>

In <342a8a28.268122589@news.spry.com>, on 09/25/97 at 04:12 PM,
   eqbridges@cbs.com (Ed.Q.Bridges) said:
+-----
| + (this is a speculative question) i'm working on Solaris 2.5, which has an
| environment variable TZ.  If i can reset this value to another timezone,
| then call localtime() will this return the value for that locale?
+--->8

Yes, but only once:  the environment variable is only read once by the C
runtime.  You could instead do something along the lines of:

    # bulletproof timezone against spoofing
    $mytz =~ s/["\\$`]/\\\&/g;
    # the \n in the split() pattern obviates chomp()
    ($yr, $mon, $day, $hr, $min, $sec) = split(/[ \n]/, `TZ="$mytz" date +'%Y
%m %d %H %M %S'`);
    # make compatible with localtime()/gmtime()
    $yr -= 1900;
    $mon -= 1;

-- 
brandon s. allbery              [Team OS/2][Linux]          bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)                 KF8NH
Warpstock '97:  OS/2 for the rest of us!  http://www.warpstock.org
Memo to MLS:  End The Burn Scam --- Doug Logan MUST GO!  FORZA CREW!



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

Date: Fri, 26 Sep 1997 06:28:19 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Ed.Q.Bridges" <eqbridges@cbs.com>
Subject: Re: Date Algorithm needed
Message-Id: <Pine.GSO.3.96.970926062611.376O-100000@usertest.teleport.com>

On Thu, 25 Sep 1997, Ed.Q.Bridges wrote:

> basically i'm looking for somehting like this:
> 
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time,tz);
> 
> which, as you can see, is identical to the perl library function
> "localtime" except it takes an additional parameter for a timezone

If there's a module which does what you want, it should be listed in
the module list on CPAN. If you don't find one to your liking, you're
welcome and encouraged to submit one! :-)  Hope this helps!

    http://www.perl.org/CPAN/
    http://www.perl.com/CPAN/

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 26 Sep 1997 09:05:47 -0400
From: "Dennis R. Sherman" <dennis_sherman@unc.edu>
To: "Ed.Q.Bridges" <eqbridges@cbs.com>
Subject: Re: Date Algorithm needed
Message-Id: <342BB32B.99EE3359@unc.edu>

Ed.Q.Bridges wrote:
> basically i'm looking for somehting like this:
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time,tz);

How about an approach like

ENV{'TZ'}="tz";
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);

wrap it up in subroutine to save the original timezone and restore if
you want.  
--
  Dennis R. Sherman              Triangle Research Libraries Network
  dennis_sherman@unc.edu       Univ. of North Carolina - Chapel Hill
               http://www.unc.edu/~sherman/


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

Date: Fri, 26 Sep 97 08:46:55 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: DB_File gotchas
Message-Id: <342bb0ff$2$ofn$mr2ice@speaker>

In <342A8882.AB1D48C4@eed.ericsson.se>, on 09/25/97 at 05:51 PM,
   Alexander Farber <eedalf@eed.ericsson.se> said:
+-----
|    But i am already knowing the file name, so i tried
|    to skip getting of the file descriptor and got the
|    file handle via         open DB_FH, "+>$file_name"
|    and the flock-ed it (and flushed with sync() at the end).
+--->8

That won't do what you think... you just wiped out the file.  :-)  See the
description of open() in perlfunc.pod.  Opening with "+<" is almost always
what you want to do in that kind of situation.

Also, you haven't locked the database filehandle, you've locked a filehandle
on the same filename.  On a system with mandatory file locking you just locked
yourself out of the database, because the lock isn't on the file descriptor
you're using for database manipulation.  :-)  (Yeah, they're in the same
process.  So?  Think "multithreading".  They're independent file descriptors.) 
And BSD db doesn't guarantee that a lock on the data file is the same as a
lock on the file descriptor returned by dbp->fd(), so you may get into trouble
if C programs also access the database using the documented locking protocol.

-- 
brandon s. allbery              [Team OS/2][Linux]          bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)                 KF8NH
Warpstock '97:  OS/2 for the rest of us!  http://www.warpstock.org
Memo to MLS:  End The Burn Scam --- Doug Logan MUST GO!  FORZA CREW!



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

Date: Fri, 26 Sep 1997 06:06:21 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Thomas Parker <muse@datasync.com>
Subject: Re: Display images on specific dates?
Message-Id: <Pine.GSO.3.96.970926060410.376K-100000@usertest.teleport.com>

On Wed, 24 Sep 1997, Thomas Parker wrote:

> Is there some way that I could edit the following code so that instead
> of random numbers it reads the month, day, and year and displays any
> banner that is associated with it?
> 
> -----------------------
> srand(time ^ $$);
> $num = rand(@images); # Pick a Random Number
> -----------------------

Sure! If you have trouble with determining the current date (or with
finding whether the current date is on a list of dates) check out the many
helpful Date utility modules on CPAN. Good luck with it!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 26 Sep 1997 06:19:25 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: doug@wkp.com
Subject: Re: GD gifs on disk take up memory!!!???!!!
Message-Id: <Pine.GSO.3.96.970926061400.376M-100000@usertest.teleport.com>

On Fri, 26 Sep 1997 doug@wkp.com wrote:

> I've ran into a strange problem while using GD 1.14.  I am running
> perl 5.004_03 on a FreeBSD 2.2.2 P6 200 workstation.

> the script that generates the images (200x200, anywhere from 1x1 to
> 20x20 pixel size) seems to have this strange habit of taking up in
> memory the amount of space they take on the disk. 

> I can watch my memory drip away as the script runs.  Once it's done I
> have a directory full of images and there are no perl processes running. 
> Here's the weird part... once I delete the files, I get all my memory
> back!!??!! 

Sounds like some species of memory leak, possibly associated with file
buffering. Are you closing each file as you're done with it? It looks as
if you are, which makes me suspect that the problem is somehow within the
GD libraries. If you can make a small script which can illustrate the
problem, file a bug report with the author(s) of GD. Thanks! 

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: 26 Sep 1997 12:36:43 GMT
From: scott@lighthouse.softbase.com (Scott McMahan)
Subject: Re: Help.Where do Perl users look for a job?
Message-Id: <60ga8r$8hv$1@mainsrv.main.nc.us>

TRC Staffing - West LA (trcwestla@worldnet.att.net) wrote:

: I'm looking for someone like you, who has sophisticated skills (Perl,
: Visual Basic, HTML), but I'm not sure how to find you.

Sounds like you're in for a long, fruitless search.

Some notes on this issue:

1. Right now, demand for technical people far outstrips the supply, so
you'll have to fight to get anyone at all.  One reason why your search
could be unsuccessful is simply that the big $$$ are putting you out of
the competition. Are you offering a competitive salary and more
importantly benefits package? A good work environment?

2. Perl skills are not really an end in themselves. Perl skills are a
means to an end. Someone with Perl skills is likely to be a system
administrator or a CGI programmer. Both of these types are in big, big
demand. It would be extremely rare to find someone who writes Perl
programs and isn't a network admin of some sort.

3. Perl and Visual Basic skills are going to be *extremely* rare in the
same person. Perl has certainly come to Windows, but is primarily still
a UNIX systems programming language.  People who do that usually are
not VB programmers, and vice versa. (There are exceptions, obviously --
I myself write Visual Basic for Applications programs and know Perl
very well, but we're a minority.)

Scott



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

Date: 26 Sep 97 12:34:26 GMT
From: "Peter Perchansky" <fp@pmpcs.com>
Subject: Re: How do I Find a CGI Programmer?
Message-Id: <01bcca78$7c7a3000$8c592581@pmp>

Greetings JR:

"Does  anyone have any suggestions where to look?"

http://www.cgi-resources.com has a listing of CGI programmers and
companies that do CGI programming.

P.S.  While our company does CGI programming, we do not provide this
service to companies servicing the adult industry.

-- 
===========================================================
Peter Perchansky,  Computer Consultant & Microsoft FrontPage MVP
PMP Computer Solutions
Custom CGI?  Yes, we do that too!
FrontPage Web Hosting at
http://www.pmpcs.com/services/fpwebhosting.htm
FrontPage Support http://www.pmpcs.com/support/frontpage.htm



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

Date: Fri, 26 Sep 1997 08:40:33 -0500
From: johnh@studiopointe.com (Preferred Client)
Subject: how do I read the Time and Date with CGI?
Message-Id: <MPG.e957749e2cc7cab989681@192.168.0.1>

I am writing a cgi script that allows the ADMIN to update mortgage prices
The script is working fine but I would like to have it display
a time and date stamp to the Html file it generates.  This date and time 
stamp would tell the viewer how up to date the information is.

If anyone know of a way to get the time and date information in CGI, or 
Javascript, your help would be appreciated.



-- 
John Hocking
Web Designer
mailto:johnh@studiopointe.com
http://www.studiopointe.com


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

Date: Fri, 26 Sep 1997 11:22:30 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: How Filter work !
Message-Id: <342B7ED6.F4B868B@absyss.fr>

[posted, not mailed due to munged address]

abcunme wrote:
> 
>  hi :
>     I am new to perl , and I come across a script with "Filter" .
> Can anyone give me an brift(a detail one will be even better) explaination.

You are lacking important information like "what is 'Filter'".  Is that
the name of a package that you have?  Is it something you saw inside a
Perl script?  Is it the idea of a "filter" that you don't understand?

Off the top of my head, I'd say it wasn't Perl. There are no statments
called filter.  I don't know of any Filter.pm modules.  If it is the
name of a subroutine in your source, you could look for it with your
editor.

Please rephrase your question.  If you saw it in code, please post the
line (plus five or six lines around it to establish some context).

- doug


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

Date: 26 Sep 97 07:38:17 GMT
From: "ITT World Directories" <a.keskin@goudengids.nl>
Subject: How to extract function calls and parameters from source codes?
Message-Id: <01bcca4e$e183c3a0$110f1fac@H03768.goudengids.nl>

Hello,

In order to do some analysis work, I needed to scan a set of source files
(C, Cobol etc source/headers) and for each file, for a predefined set of
functions (say FncX, FncY...), if there is a call to the function, extract
the function parameters for that call (say ParamA, ParamB... ) I will then
comparare each paramater if a specific table name is referred in the
call...

What I need to do is actually get a source code and locate and process the
function calls inside if function name matches a predefined name...

What is a good/reliable way of doing this in Perl?

I tried a code section like below to locate the function call and split
parameters in multiline-paragraph mode... But there are two problems: i)
since paragraphs are defined to be delimited by blank lines, if two or more
qualified function names follow immediately, the followings will be skipped
and ii) if a function paramater is also a call to another function the
pattern will not work properly...

	# separate the code section into fncname and parameters	
	m/\s*$fnc\s*\(([^)]*)\)/;	

	# split function parameters
	@params = split(/,/, $1);

Thanks in advance,

Ali Keskin
a.keskin@goudengids.nl



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

Date: Fri, 26 Sep 1997 08:14:51 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How to extract function calls and parameters from source codes?
Message-Id: <bgcg06.vq.ln@localhost>

ITT World Directories (a.keskin@goudengids.nl) wrote:

: In order to do some analysis work, I needed to scan a set of source files
: (C, Cobol etc source/headers) and for each file, for a predefined set of
: functions (say FncX, FncY...), if there is a call to the function, extract
: the function parameters for that call (say ParamA, ParamB... ) I will then
: comparare each paramater if a specific table name is referred in the
: call...

: What I need to do is actually get a source code and locate and process the
: function calls inside if function name matches a predefined name...


You have described a compiler there.


: What is a good/reliable way of doing this in Perl?


Write a compiler for each language.

byacc can generate a grammar parser in Perl.

I expect you could find yacc source for C and COBOL somewhere on the 'net...


: I tried a code section like below to locate the function call and split
: parameters in multiline-paragraph mode... But there are two problems: i)
: since paragraphs are defined to be delimited by blank lines, if two or more
: qualified function names follow immediately, the followings will be skipped
: and ii) if a function paramater is also a call to another function the
: pattern will not work properly...

: 	# separate the code section into fncname and parameters	
: 	m/\s*$fnc\s*\(([^)]*)\)/;	

: 	# split function parameters
: 	@params = split(/,/, $1);


If you really meant it when you said 'reliable', then you need to really
parse the grammar. Trying to do it with only regexs will surely lead to
some cases where it breaks.

For example, do you have some code that ensures that the above pattern
match is not attempted if the function call has been commented out?


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Fri, 26 Sep 1997 10:23:40 GMT
From: fgarzon@cern.ch (Frederic GARZON)
Subject: How to generate a regexp from the strings you want to match ?
Message-Id: <EH427G.10n@news.cern.ch>

Is there any program/module to automatically generate regexps from the
strings you want to be matched ? 

Ex :

Larry wall \
larry mall  | --> /[Ll]a(r){1,2}y [mw]all/
lary wall  /


TIA

Fred

-- 
+----------- CERN: European Laboratory for Particle Physics -----------+
|     Frederic Garzon (Frederic.Garzon@cern.ch) Web Office (IT/WO)     |
|   Bat. 53-R008 - CERN - CH 1211 Geneve - Suisse - +41 22 767 91 58   |
|                    http://www.cern.ch/~fgarzon/                      |
+----------------------------------------------------------------------+



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

Date: Fri, 26 Sep 1997 10:52:57 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: Is Perl Year2000 compliant?
Message-Id: <342B77E9.4B918023@absyss.fr>

lvirden@cas.org wrote:
> 
> According to Doug Seay  <seay@absyss.fr>:
> :hint: "perldoc perlfaq4".  If you don't have a properly installed
> :version of Perl, go to http://www.perl.com/ and look around a bit.
> 
> Is there a command parallel to perldoc perhaps called perlgrep someone
> might have written which allows you to say
> 
> perlgrep 2000
> 
> which searches all the docs installed to find references to year 2000
> for instance?

No, but all the standard docs (in pod source form) are stored in

	.../lib/perl5/pod  (path can be system dependant)

so I just do

	grep =head2 /usr/local/lib/perl5/pod/*.pod | grep KEYWORD

=head2 happens to be the pod term for a secondary header line, which is
used for all the questions.  When that doesn't work, I try looking
directly for the keyword with

	grep KEYWORD /usr/local/lib/perl5/pod/*.pod

but this is too verbose for most things.

Another approach would be to look in "man perltoc" for the keyword. 
Personal choice, I guess.

As for your "perlgrep" idea, I think it is a good one, but I don't think
it should be a standalone program.  Look into modifying "perldoc" to
have a new grepping option, or use it as a fall back for when nothing is
found.

- doug


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

Date: Fri, 26 Sep 1997 10:28:04 +0100
From: Brian Ewins <Brian.Ewins@dont.spam.me>
Subject: Re: Julian Date Routine
Message-Id: <342B8023.1B89@dont.spam.me>

Doug Seay wrote:
> 
> Ben Fogarty wrote:
> >
> > Any of you GURUs out there have a Julian date routine in perl?
> > I need it to evaluate a running log and delete prior to a certain
> > date. Julian date works best. I would appreciate same if you
> > have it, or a pointer to it's location if you know of one.
> 
> Did Date::Manip not do what you want?  And you don't truely mean
> "julian" do you?  You most likely mean Gregorian year with days into
> year (yday) instead of month/day.  The Julian calendar starts a long
> time before Christ and is only really used in a few domains (astronomy
> is one IIRC).
> 
> - doug

He probably really does mean Julian dates. This is provided in (eg)
Oracle databases and its the number of days since Jan 1st 4712 BC.
(Of course! ;o) ) It's useful occasionally for timestamping as it
gives a simple integer for date comparisons. The only time I've seen
this used in anger was when someone wrote a SQL statement which ordered
on date or some other (non-date) field based on a parameter;
since the sorting would only work on a single type, Julian date was 
used to convert dates to numbers first. Ugly, but it worked.

In perl, you are much better using unix's internal time format
(seconds since the epoch) as returned from time(); it does the
same job.

And a quick conversion:
$julian = 2440588+int(time/86400);
          ^Julian date for jan 1st 1970
                          ^seconds in a day

	HTH

		Brian.


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

Date: Fri, 26 Sep 1997 05:56:10 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "S. Steven Maese" <smaese@csolutions.net>
Subject: Re: MIME Header "Location:"
Message-Id: <Pine.GSO.3.96.970926055255.376I-100000@usertest.teleport.com>

On 24 Sep 1997, S. Steven Maese wrote:

> Newsgroups: comp.lang.perl, comp.lang.perl.misc

If your news administrator still carries comp.lang.perl, please let him
or her know that that newsgroup has not existed since 1995. If you
have such an outdated newsgroup listing, you are probably missing out
on many other valid newsgroups as well. You'll be doing yourself and
many others a favor to use only comp.lang.perl.misc (and other valid
Perl newsgroups) instead.

> I'm new to PERL, sorry if this is a more than obvious question, but.... 
> 
> sub redir {
> 	print "Location: http://www.csolutions.net/index.html\n\n";
> }

> The above code is intended to redirect a browser to the above listed web
> page.  This works with IE 3.02, but with Navigator 4.01 I get "Document
> contains no data."  Any ideas? 

>From a Perl standpoint, that's just fine. There's no error with that Perl
code. There may be a problem with the information you're printing, of
course, so check the docs and FAQs on the protocol you're using. Good
luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 26 Sep 1997 11:06:27 +0200
From: Doug Seay <seay@absyss.fr>
Subject: Re: mmap?
Message-Id: <342B7B13.54196CE@absyss.fr>

Stuart McDow wrote:
> 
> Pardon me if this is a FAQ.
> 
> Has anyone tried to play around with mmap(2) and get it working?  I
> like to use it for reading files and also for poor man's IPC. It'd be
> nice if there was a module for it.
> 
> Is there any reason *not* to do a mmap via the syscall function?

I've never heard of it, I didn't find it by grepping the FAQs, nor do I
see something with an obvious name at CPAN.  Quoting from the "perlipc"
man page

   SysV IPC
       While System V IPC isn't so widely used as sockets, it still has
some interesting
       uses.  You can't, however, effectively use SysV IPC or Berkeley
mmap() to have
       shared memory so as to share a variable amongst several
processes.  That's because
       Perl would reallocate your string when you weren't wanting it to.

This is why shared memory is (shmread, etc) is done with a
copy-in/copy-out approach.  Look at the shm* family and see if this
works well enough for you.  Otherwise, I'd say to take a different
approach.  Of course, if you feel energetic and want to write a Mmap.pm
that works around these limitations and put that in CPAN, you will earn
the thanks of others who'd like to do the same thing.

- doug


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

Date: 26 Sep 1997 15:34:11 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: mmap?
Message-Id: <isiuvofbcc.fsf@godzilla.kiere.ericsson.se>

smcdow@arlut.utexas.edu (Stuart McDow) writes:

> Pardon me if this is a FAQ.

No. Do your research *first*, then post.

godzilla:~$ perl -MCPAN -e shell
 
cpan shell -- CPAN exploration and modules installation (v1.3101)
ReadLine support enabled
 
cpan> i /mmap/
Going to read /net/gullan/users/qdtcall/.cpan/sources/01mailrc.gz
Going to read /net/gullan/users/qdtcall/.cpan/sources/02packag.gz
Going to read /net/gullan/users/qdtcall/.cpan/sources/03mlist.gz
Distribution    FLETCH/Apache-Mmap-0.04.tar.gz
Distribution    MICB/Mmap-a2.tar.gz
Module          Apache::Mmap    (FLETCH/Apache-Mmap-0.04.tar.gz)
Module          Apache::Mmap::Handle (FLETCH/Apache-Mmap-0.04.tar.gz)
Module          IPC::Mmap       (Contact Author MICB (Malcolm Beattie))
Module          Mmap            (MICB/Mmap-a2.tar.gz)
 
cpan> 

-- 
		    Calle Dybedahl, UNIX Sysadmin
      qdtcall@esb.ericsson.se  http://www.lysator.liu.se/~calle/


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

Date: 26 Sep 1997 06:52:08 GMT
From: scancm@biobase.dk (Christian Mondrup)
Subject: Re: oraperl subroutines
Message-Id: <60fm2o$t5d$1@news.uni-c.dk>

Daniel M Reeves (dreeves3@ford.com) wrote:
: we have an oraperl program that runs fine, but when we turn it into a
: subroutine and try to call it (all in the same file) it won't work.  Is there
: a difference between perl and oraperl as far as subroutines go?

Please be more specific on your error, for instance give excerpts from
your script.

: --
: Daniel Reeves  313-621-6974  dreeves3@ford.com  dreeves@umich.edu
: http://wwwdev.dearborn.ford.com/cmims/daniel/

--
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+   Christian Mondrup                                                     +
+   Computer Programmer                                                   +
+   Scandiatransplant, Skejby Hospital, University Hospital of Aarhus     +
+   Brendstrupgaardsvej                                                   +
+   DK 8200 Aarhus N                                                      +
+   Denmark                                                               +
+                                                                         +
+   Phone:   +45 89 49 53 01                                              +
+   Telefax: +45 89 49 60 07                                              +
+   E-Mail:  scancm@biobase.dk                                            +
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


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

Date: Fri, 26 Sep 1997 06:12:25 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Larry Nguyen <Larry_P_Nguyen@qmail2.sp.trw.com>
Subject: Re: Perl script is not executed by Web browser
Message-Id: <Pine.GSO.3.96.970926060916.376L-100000@usertest.teleport.com>

On Thu, 25 Sep 1997, Larry Nguyen wrote:

> I got the following error when running a Perl script from a web browser
> (ie. http://oassis.xyz.com/cgi-bin/howdy.pl)
> 
> "HTTP/1.0 403 Access Forbdden (Read Access denied. This virtual
> directory does not allow objects to be read."
> 
> It appears to me that the browser did not attempt to execute the Perl
> cmd which then run the Perl script. It tries to READ the script instead.

Browsers don't, normally, execute Perl scripts; but servers frequently do.
Of course, if your server won't do what you want, maybe there's something
in the docs or FAQs associated with your server which would help. If you
can't find anything there, you could ask in a server-related newsgroup,
since that would likely get you a better and more complete answer than we
could give you here.

Good luck!

-- 
Tom Phoenix           http://www.teleport.com/~rootbeer/
rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
              Ask me about Perl trainings!



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

Date: Fri, 26 Sep 1997 08:21:08 -0500
From: Mark Wilcox <mewilcox@unt.edu>
Subject: Re: Perl to Java Compiler?
Message-Id: <342BB6C3.AB2447C5@unt.edu>

>From what I read somewhere (may have been Perl Journal, O'Reilly or
Perl.com, I can't remember), but the Perl to Java compiler is actually a
backend to the Perl to C compiler Larry Wall wrote for the Perl Package
for UNIX that O'Reilly is releasing. I think the words were "It will do
what Perl does best (they meant regex's not "everything " :-)) and let
Java does best/easier(e.g. networking)".

I personally think we're heading for a mostly Intranet world, where big
pipe & fast machines rule & JAVA is likely to be entrenched there soon,
for nothing else than marketing hype (what a better platform loses to
marketing? never :-)) .

I don't think this version of the P->J compiler will be very good, mostly
because Java is still such a young language & still having the core
platform being worked out. But Perl to Java does make since because
already there already several commerical programs that have the Perl
interpreter embedded in them (usually for string processing or regexing)
& since JAVA one-way or another is likely to overtake C as the industry
standard programming language, Perl had better be able to embed itself in
there, if for nothing else than to keep some market share (Perl maybe
free, but O'Reilly who employs Larry, needs to make $$ & Java & Perl
books are it's bread & butter now. And the Perl for UNIX package, is a
commercial product )

Sorry to ramble on like this, guess I needed to get it out of the ol'
system.

Later,
Mark

There's Perl and there's everything else
--
--------------------------------------------
Mark Wilcox
mewilcox@unt.edu
Web Administrator
University of North Texas
(940)565-2568
http://www.unt.edu/




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

Date: 26 Sep 1997 06:51:16 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: jstone@america.net (Jeff R. Stone)
Subject: Re: Perl to Java Compiler?
Message-Id: <8c90wk9oa3.fsf@gadget.cscaper.com>

>>>>> "Jeff" == Jeff R Stone <jstone@america.net> writes:

Jeff> It all depends on your definition of "platform".  Java is in the
Jeff> process of working (seeping?) its way into all sorts of smart cards
Jeff> and other embedded devices that are unlikely to support Perl in its
Jeff> current incarnation.

You mean it will finally make it into the proverbial "smart toaster",
where it was designed for originally?

That'd be cool. :-)

Now, treating millions of web browsers like they are merely smart
toasters... that's what puzzles me.

:-)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 340 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
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@ora.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: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

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

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