[11297] in Perl-Users-Digest
Perl-Users Digest, Issue: 4897 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 15 12:07:25 1999
Date: Mon, 15 Feb 99 09:00:25 -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 Mon, 15 Feb 1999 Volume: 8 Number: 4897
Today's topics:
Re: #!/usr/bin/perl AND #!/usr/local/bin/perl both pos <taomi@taomi.com>
Re: #!/usr/bin/perl AND #!/usr/local/bin/perl both pos <vasquez@zap.a2000.nl>
Re: #!/usr/bin/perl AND #!/usr/local/bin/perl both pos <rra@stanford.edu>
Re: calculate and print a period of days (Larry Rosler)
Re: calculate and print a period of days (Clay Irving)
Re: calculate and print a period of days <dmarti81@ford.com>
Re: checking 'use' <jdf@pobox.com>
cookie problem <abukar@insidewire.com>
Re: create in form in tabullar format <gwynne@utkux.utk.edu>
Re: database: viewing large result sets in perl? (Andrew M. Langmead)
Re: how to get file creation time? (Andrew M. Langmead)
Re: how to get file creation time? (Larry Rosler)
Re: HTML File Upload tyuhas@neurobio.arizona.edu
Re: Looking for CGI database apps <tigra@holly.colostate.edu>
Re: Looking for CGI database apps <tigra@holly.colostate.edu>
Re: package reference??? (Andrew M. Langmead)
Perl and Novell NDS password checking <aubrey@eng.uct.ac.za>
Perl and SQL consultant required. (Adam Thyer)
Perl Xbase Module. pvdkamer@inter.NL.net
Re: Perl Xbase Module. (Clay Irving)
Re: PFR: Julian Date (Hans-Georg Rist)
Re: Printing an emailadres (Dimitri Ostapenko)
Randomizing Select Results with Perl <mskimin@loraincounty.com>
Re: Randomizing Select Results with Perl (brian d foy)
Re: script to forward email <gwynne@utkux.utk.edu>
Re: The order of form fields that recieve by cgi progra (Andrew M. Langmead)
Re: V-day Perl Poetry (Robert Bell)
Re: Web based calendar <stevenhenderson@prodigy.net>
Re: Web based calendar <uri@home.sysarch.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 15 Feb 1999 16:11:20 +0100
From: Taomi <taomi@taomi.com>
Subject: Re: #!/usr/bin/perl AND #!/usr/local/bin/perl both posible?
Message-Id: <36C83918.6EFB@binto.com>
How about creating a symbolic link (using: ln) on one system so you can
use the same path on both.
kikeboe,
r
Joel Wijngaarde wrote:
>
> Hi,
>
> Is it possible to give to search paths. I run my Perl script son two
> machines and both have Perl in different directories. One has Perl in
> /usr/bin/perl and the other in /usr/local/bin/perl.
>
> Now i'm always changing the first line...
>
> --
> Joel Wijngaarde (Physics student)
> vasquez@zap.a2000.nl
>
> Quote:
> "The final solution is possibly a little extreme - create a new
> country - and then export all lawyers there. The Brit's tried
> this with Australia, but somehow something went awry
> somewhere along the line."
>
> "Hrm. The whole of Europe did that with America and it seems to
> have been moderately successful."
------------------------------
Date: Mon, 15 Feb 1999 16:16:47 +0100
From: Joel Wijngaarde <vasquez@zap.a2000.nl>
Subject: Re: #!/usr/bin/perl AND #!/usr/local/bin/perl both posible?
Message-Id: <36C83A5F.CBCA01D3@zap.a2000.nl>
Well, the problem is that I'm not the administrator on both systems...
And I thought that because you don't know where somebody installs his
Perl distribution there would be an option to search multiple paths.
Taomi wrote:
>
> How about creating a symbolic link (using: ln) on one system so you can
> use the same path on both.
> kikeboe,
> r
>
> Joel Wijngaarde wrote:
> >
> > Hi,
> >
> > Is it possible to give to search paths. I run my Perl script son two
> > machines and both have Perl in different directories. One has Perl in
> > /usr/bin/perl and the other in /usr/local/bin/perl.
> >
> > Now i'm always changing the first line...
--
Joel Wijngaarde (Physics student)
vasquez@zap.a2000.nl
Quote:
"The final solution is possibly a little extreme - create a new
country - and then export all lawyers there. The Brit's tried
this with Australia, but somehow something went awry
somewhere along the line."
"Hrm. The whole of Europe did that with America and it seems to
have been moderately successful."
------------------------------
Date: 15 Feb 1999 07:34:21 -0800
From: Russ Allbery <rra@stanford.edu>
Subject: Re: #!/usr/bin/perl AND #!/usr/local/bin/perl both posible?
Message-Id: <yln22fy936.fsf@windlord.stanford.edu>
Joel Wijngaarde <vasquez@zap.a2000.nl> writes:
> Well, the problem is that I'm not the administrator on both systems...
> And I thought that because you don't know where somebody installs his
> Perl distribution there would be an option to search multiple paths.
The problem is that it's not Perl that's doing the searching. It's the
operating system kernel. And no, there isn't a facility in Unix to search
multiple paths for the interpreter of a script.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: Mon, 15 Feb 1999 07:49:54 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: calculate and print a period of days
Message-Id: <MPG.1131e1f2d23e0ddc989a3e@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7a98a3$ejf$1@nnrp1.dejanews.com> on Mon, 15 Feb 1999
13:43:32 GMT, nguyen.van@imvi.bls.com <nguyen.van@imvi.bls.com> says...
> I just wonder if any body have a script or leads to calculate and print out
> days of a period. For example: the input is like 01/19/1999-02/15/1999 or
> 12/15/1999-01/15/1999, the script will print out as following:
>
> 01/19/1999
> 01/20/1999
> 01/21/1999
> ........
> 02/13/1999
> 02/14/1999
> 02/15/1999
Very easy. First, compute the values of the starting and ending dates
of the range as times in the Unix epoch. There is a function to do this
in the new Perl Function Repository, at (kill the line-fold in the URL,
of course):
http://moiraine.dimensional.com/~dgris/cgi-
bin/pfr?index=1&func=UTC_to_Epoch
Then use the starting time as the argument to localtime(), adding 24 *
60 * 60 each time through the loop until you reach the ending time. The
components of the result of localtime() in list context are what you
want to reformat.
If, on the other hand, you prefer to use huge, slow modules, look at
Date::Manip and Date::Calc available from CPAN. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 15 Feb 1999 11:19:57 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: calculate and print a period of days
Message-Id: <7a9hfd$hbs$1@panix.com>
In <7a98a3$ejf$1@nnrp1.dejanews.com> nguyen.van@imvi.bls.com writes:
>I just wonder if any body have a script or leads to calculate and print out
>days of a period. For example: the input is like 01/19/1999-02/15/1999 or
>12/15/1999-01/15/1999, the script will print out as following:
>01/19/1999
>01/20/1999
>01/21/1999
>........
>02/13/1999
>02/14/1999
>02/15/1999
This program:
#!/usr/local/bin/perl -w
use Date::Manip;
$input_string = shift @ARGV;
chomp $input_string;
($begin_date, $end_date) = split /-/, $input_string;
print "$begin_date\n";
$date = ParseDate($begin_date);
until ($date eq $end_date) {
$date = UnixDate(DateCalc($date,"+1 day"), "%m/%d/%Y");
print "$date\n";
}
when called like this:
foo.pl 01/19/1999-02/15/1999
prints:
01/19/1999
01/20/1999
01/21/1999
01/22/1999
01/23/1999
01/24/1999
01/25/1999
01/26/1999
01/27/1999
01/28/1999
01/29/1999
01/30/1999
01/31/1999
02/01/1999
02/02/1999
02/03/1999
02/04/1999
02/05/1999
02/06/1999
02/07/1999
02/08/1999
02/09/1999
02/10/1999
02/11/1999
02/12/1999
02/13/1999
02/14/1999
02/15/1999
--
Clay Irving
clay@panix.com
------------------------------
Date: Mon, 15 Feb 1999 15:22:53 +0000
From: Duncan Martin <dmarti81@ford.com>
Subject: Re: calculate and print a period of days
Message-Id: <36C83BCD.7C39B50B@ford.com>
probably not the best way in the world, but...
split the text into two fields
($date_one,$date_two) = split '-',$input_text;
use Time::ParseDate (on www.perl.com most likely) to turn both dates
into seconds-since-epoch, round these numbers down to a multiple of the
number of seconds in a day (86400).
then use a loop like
for ($scan = $start_time, $scan <= $finish_time; $scan += 86400) {
...
}
and stick inside the loop your own code to turn the seconds-value in
$scan into text (Using localtime, gmtime etc)
Duncan
------------------------------
Date: 15 Feb 1999 10:17:35 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: Andrew Fry <andrewf@beausys.demon.co.uk>
Subject: Re: checking 'use'
Message-Id: <m3k8xjr90w.fsf@joshua.panix.com>
Andrew Fry <andrewf@beausys.demon.co.uk> writes:
> Is there some way to avoid this ? ie some way
> to check whether the current database type is "supported",
> perhaps by determining if the appropriate 'use...'
> statement was included / commented-out ?
> I guess what I want to do is something like this...
> if use statement for GDBM included
> then $gdbm_supported = 1;
> else
> $gdbm_supported = 0;
The -P switch immediately comes to mind..
#ifdef HAVE_GDBM
use GDBM_File;
#endif
Though you might want to do a run-time check for the existence of a
given module...
my $gdbm_supported;
BEGIN {
eval "use GDBM_File";
$gdbm_supported = !$@; # or you might want to check
# $@ for /Can't locate/
}
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Mon, 15 Feb 1999 11:30:05 -0500
From: "Abukar Mohamed" <abukar@insidewire.com>
Subject: cookie problem
Message-Id: <36c84ab4.0@diana.idirect.com>
Hi
I developed a scripts that writes a cookie to thier system whenever someone
visit that script. I wonder if there is a way I can tell if the cookie was
written or not?
Thanks and I appreciate any help.
Abukar
------------------------------
Date: Mon, 15 Feb 1999 09:53:19 -0500
From: "Robert Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: create in form in tabullar format
Message-Id: <7a9d3s$b34$1@gaia.ns.utk.edu>
> Could anyone suggest a good web tutorial to learn perl/cgi ?.
>
The Official Guide to CGI.pm by Lincoln Stein.
Bob Gwynne
JAPN
------------------------------
Date: Mon, 15 Feb 1999 15:29:09 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: database: viewing large result sets in perl?
Message-Id: <F77CCL.7D0@world.std.com>
tadmc@metronet.com (Tad McClellan) writes:
> Can you really _get_ an infinite size set of anything?
> I will be quite astounded if you can...
But if you start getting a record at a time, how can you tell it is
going to end? It seems that if you can prove that it isn't an infinite
set, you've solved the halting problem.
--
Andrew Langmead
------------------------------
Date: Mon, 15 Feb 1999 15:24:16 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: how to get file creation time?
Message-Id: <F77C4G.3vK@world.std.com>
%[5a?_ <kflin@alumni.csie.nctu.edu.tw> writes:
>if a file is modified,(e.g. appending some data)
>the mtime & ctime will be both updated.
>so I won't get any info about the create time
>of a file.
Thats not quite right. (Did you test your assumptions before you
posted them?)
The ctime parameter changes when the files i-node changes, not the
file itself. The i-node contains information like where the beginning
of the file is (which doesn't vary after the file is created.) the
owner, the permissions, and the number of hard links to the file.
In other words after the file is created, the system calls "chown",
"chmod", and "ln" will change the ctime (often done with the
indentically named shell commands that are just wrappers around the
underlying system calls.), but not reading or writing to the file.
Unfortunately, the standard Unix filesystems do not store the creation
time of the file. If you need that type of information, you need to
keep track of it yourself. (Either in the file itself if you control
the format of it, or somewhere else if the format is fixed.)
--
Andrew Langmead
------------------------------
Date: Mon, 15 Feb 1999 07:27:05 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: how to get file creation time?
Message-Id: <MPG.1131dc8e19900276989a3d@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7a8iuc$dbq$1@netnews2.csie.nctu.edu.tw> on 15 Feb 1999
07:38:52 GMT, %[5a?_ <kflin@alumni.csie.nctu.edu.tw> <%[5a?_
<kflin@alumni.csie.nctu.edu.tw>> says...
...
> by stat() function, we can only get
> atime (last access time)
> mtime (last modification time)
> ctime (last change time)
> of a file.
> if a file is modified,(e.g. appending some data)
> the mtime & ctime will be both updated.
> so I won't get any info about the create time
> of a file.
> Anybody knows the solution?
Your statement above is incorrect. If the contents of a file are
modified, mtime is updated, but ctime is not.
On Unix-derived systems, ctime is the 'last change time' of the inode of
the file, in other words, its link to the file system. This
changes if the name or permissions of the file are changed. There is no
information about file creation time, and you will have to maintain that
yourself (as Jonathan Feinberg's response suggests).
On Windows/DOS systems, ctime is in fact the creation time of the file.
Score one for Bill!
I can't speak for other OSs.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 15 Feb 1999 15:26:26 GMT
From: tyuhas@neurobio.arizona.edu
Subject: Re: HTML File Upload
Message-Id: <36c83b5d.1204926622@news.arizona.edu>
On 8 Feb 1999 22:09:06 -0000, Jonathan Stowe
<gellyfish@btinternet.com> wrote:
>On Sun, 07 Feb 1999 18:23:53 -0600 Adam Grayson wrote:
>> I am trying to create an HTML form for uploading graphics, and
>> understand how to set up the form, print the results into a jpeg file,
>> but I'm confused on bringing in the actual girth of the image so that I
>> can print FILE $in{"graphic"}. Any good example of how to do this,
>> either with cgi.pm or cgi-lib.pl?
>>
>
>This is simply done using CGI.pm - there is a section in the documentation
>entitled:
>
> CREATING A FILE UPLOAD FIELD
>
>There is also an article at <http://wwww.webreview.com>
>bu Brent Michalski that covers this subject with a useful example.
>
>/J\
I've gone through the threads on this, checked out the various sites,
etc. but still am stumped by one particular problem. For text files,
and images (.BMP), the script we're using with CGI.pm seems to be
flawless. When we use it to upload files like ZIP, EXE or Powerpoint,
the end result is a corrupted file. Byte by byte (countwise), the
original and uploaded file are the same.
We're running this on a Win95 machine with the latest Perl and CGI.pm.
Our webserver is Xitami.
Any ideas?
Terrill
------------------------------
Date: 15 Feb 1999 15:57:47 GMT
From: Carissa Highland <tigra@holly.colostate.edu>
To: a97485@cs.ait.ac.th
Subject: Re: Looking for CGI database apps
Message-Id: <7a9g5r$53n6@yuma.ACNS.ColoState.EDU>
Hi:
You can find lots of scripts about your topic at
http://www.cgi-resources.com
http://www.cgiworld.com
I hope this helps.
Take care.
timygonzalez@hotmail.com
------------------------------
Date: 15 Feb 1999 15:57:58 GMT
From: Carissa Highland <tigra@holly.colostate.edu>
To: a97485@cs.ait.ac.th
Subject: Re: Looking for CGI database apps
Message-Id: <7a9g66$53n6@yuma.ACNS.ColoState.EDU>
Hi:
You can find lots of scripts about your topic at
http://www.cgi-resources.com
http://www.cgiworld.com
I hope this helps.
Take care.
timygonzalez@hotmail.com
------------------------------
Date: Mon, 15 Feb 1999 15:51:14 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: package reference???
Message-Id: <F77DDE.n4E@world.std.com>
n8twatch <n8twatch@usa.net> writes:
>is it possible to build a reference to a package, like with the
>arrays($refarray = \@array;) or with scalars.
You can create a reference to the symbol table for a package.
package bar;
$foo = 1;
package main;
my $ref = \%bar::;
print "${$ref->{foo}}\n";
Are you sure that you can't accomplish what you want with soft
references?
${"${package}::$var"}
--
Andrew Langmead
------------------------------
Date: Mon, 15 Feb 1999 17:08:57 +0200
From: Aubrey Kilian <aubrey@eng.uct.ac.za>
Subject: Perl and Novell NDS password checking
Message-Id: <36C83889.622DFDA9@eng.uct.ac.za>
Hi guys,
stupid question.
Is there a way that perl can verify a Novell Netware 5 NDS password?
Thanks
Aubrey
------------------------------
Date: Mon, 15 Feb 1999 16:12:19 GMT
From: adam@promethean.com.au (Adam Thyer)
Subject: Perl and SQL consultant required.
Message-Id: <7a9duh$4je$1@reader1.reader.news.ozemail.net>
Hi all
I have ongoing project-based work for an *affordable* and experienced
consultant who can write SQL (ideally MySQL), CGI and Perl5 for Web site
back-ends on an Apache server running Redhat Linux. If you're interested,
please send your hourly rate (US$) and a detailed resume, URLs of previous
work and referees to adam@promethean.com.au.
Cheers
Adam
------------------------------
Date: Mon, 15 Feb 1999 15:24:39 GMT
From: pvdkamer@inter.NL.net
Subject: Perl Xbase Module.
Message-Id: <36c83c01.18453387@news.wxs.nl>
Does anyone know a good Perl-Xbase lib. One that can create and
maintain dbf's and indexes ?
Please let me know via Email.
Paul@balans.net
------------------------------
Date: 15 Feb 1999 11:25:23 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Perl Xbase Module.
Message-Id: <7a9hpj$i4r$1@panix.com>
In <36c83c01.18453387@news.wxs.nl> pvdkamer@inter.NL.net writes:
>Does anyone know a good Perl-Xbase lib. One that can create and
>maintain dbf's and indexes ?
Like DBD:XBase?
>From the pod:
Module XBase provides access to XBase (dBase, Fox*) database files,
namely dbf, dbt, fpt, ndx and ntx. It provides native Perl interface
($table->get_record, $table->update_record) to read and write the tables.
Module DBD::XBase is a DBI driver that uses the XBase module to work with
the data, providing you with DBI compliant processing interface and SQL
commands ($dbh->prepare("SELECT * FROM TABLE")). As an argument to
DBI->connect, specify "dbi:XBase:$dir", where $dir is the directory with
the data files.
>Please let me know via Email.
--
Clay Irving
clay@panix.com
------------------------------
Date: Sat, 13 Feb 1999 16:33:01 GMT
From: hans-georg@rist.net (Hans-Georg Rist)
Subject: Re: PFR: Julian Date
Message-Id: <36c5a2cb.14044850@news.uni-ulm.de>
snow@biostat.washington.edu (Gregory Snow) wrote:
>I've thought about doing something like this myself, but don't have
>the resources. There are a bunch of things that don't really need
>modules to solve, just a good function or 2 to paste into the code.
>Thanks for doing this. Here is my suggestion for the next addition:
>This was posted by Jeff Godden a while back (I don't take any credit),
>to compute julian dates:
>
># ----- this will return day number 719469 for 1970/1/1
>sub jday {
> # note screwed up american date element ordering
> my($month,$day,$year) = @_;
> my($y) = $year + ($month-3)/12;
> int(367*$y+0.625)-2*int($y)+int($y/4)-int($y/100)+int($y/400)+$day;
>}
>
>Note, this is off from the "usual" definition of Julian days by a
>constant, but if that is important to you, then just add the constant
>back in. It also does not take into account the week that was lost
>when most of the world switched to the Gregorian calender, but if all
>you want to do is compute the number of days between 2 recent (100
>years or so) to future dates, it works fine. If there is interest,
>one of these days I'll try to write the routine to go from the Julian
>day to month/day/year.
Already done: see g_date() below. But I don't know if this function
works with your jday() routine. So better use g_date() together with
my j_date() function.
Here are some routines published by the german magazine c't as C code
in issue 15/1997, p. 312ff
(ftp://ftp.heise.de/pub/ct/listings/ct9715.zip) which I translated to
perl (and put them in my own date module). They seem to work very well
and I use them in my daily job without problems.
#--- Julian / Gregorian dates:
$j = &j_date( $year, $month, $day ); # calculate Julian date
( $year, $month, $day ) = &g_date( $j ); # back to Gregorian date
#--- calculating Easter Sunday of $year:
$d = &easter_sunday( $year ); # number of day in year
# of Easter Sunday
$day = &day_in_year( $year, $d ); # get day of month
$month = &month_in_year( $year, $d ); # get month
# leapyear() is also needed for the above three routines.
print "Easter Sunday: $year-$month-$day\n"; # Gregorian date
#=============================================================================
sub j_date {
#-----------------------------------------------------------------------------
# Arguments: year, month (1=Jan, 2=Feb, ... 12=Dec), day (1...31)
# Returns: Julian date (days since 1.1.4713 B.C.)
#-----------------------------------------------------------------------------
# Algorithm: R. G. Tantzen
#-----------------------------------------------------------------------------
my( $year, $month, $day ) = @_;
my( $c, $y );
if ( $month > 2 ) {
$month -= 3;
}
else {
$month += 9;
$year--;
}
$day += int( ( 153 * $month + 2 ) / 5 );
$c = int( ( 146097 * int( $year / 100 ) ) / 4 );
$y = int( ( 1461 * ( $year % 100 ) ) / 4 );
$c + $y + $day + 1721119; # return value
} # end sub j_date()
#=============================================================================
#=============================================================================
sub g_date {
#-----------------------------------------------------------------------------
# Arguments: Julian date (days since 1.1.4713 B.C.)
# Returns: year, month (1=Jan, 2=Feb, ... 12=Dec), day (1...31)
#-----------------------------------------------------------------------------
# Modified algorithm of R. G. Tantzen
#-----------------------------------------------------------------------------
my( $jd ) = @_;
my( $year, $month, $day );
$jd -= 1721119;
$year = int( ( 4 * $jd - 1 ) / 146097 );
$jd = ( 4 * $jd - 1 ) % 146097;
$day = int( $jd / 4 );
$jd = int( ( 4 * $day + 3 ) / 1461 );
$day = ( 4 * $day + 3 ) % 1461;
$day = int( ( $day + 4 ) / 4 );
$month = int( ( 5 * $day - 3 ) / 153 );
$day = ( 5 * $day - 3 ) % 153;
$day = int( ( $day + 5 ) / 5 );
$year = 100 * $year + $jd;
if ( $month < 10 ) {
$month+=3;
}
else {
$month -= 9;
$year++;
}
( $year, $month, $day ); # return values
} # end sub g_date()
#=============================================================================
#=============================================================================
sub easter_sunday {
#-----------------------------------------------------------------------------
# Arguments: year
# Returns: number of day in year of Easter Sunday
#-----------------------------------------------------------------------------
# Algorithm: "Computus ecclesiasticus"
#-----------------------------------------------------------------------------
my( $year ) = @_;
my( $gz, $jhd, $ksj, $korr, $so, $epakte, $n );
$gz = ( $year % 19 ) + 1;
$jhd = int( $year / 100 ) + 1;
$ksj = int( ( 3 * $jhd ) / 4 ) - 12;
$korr = int( ( 8 * $jhd + 5 ) / 25 ) - 5;
$so = int( ( 5 * $year ) / 4 ) - $ksj- 10;
$epakte = ( 11 * $gz + 20 + $korr - $ksj ) % 30;
$epakte++ if ( $epakte == 25 && $gz > 11 ) || $epakte == 24;
$n = 44 - $epakte;
$n += 30 if $n < 21;
$n += 7 - ( $so + $n ) % 7;
$n += &leapyear( $year );
$n + 59; # return value
} # end sub easter_sunday()
#=============================================================================
#=============================================================================
sub leapyear {
#-----------------------------------------------------------------------------
# Arguments: year
# Returns: boolean (1=true/0=false)
#-----------------------------------------------------------------------------
( $_[0] % 4 == 0 && $_[0] % 100 != 0 || $_[0] % 400 == 0 ) ? 1 : 0;
} # end sub leapyear()
#=============================================================================
#=============================================================================
sub month_in_year {
#-----------------------------------------------------------------------------
# Arguments: year, number of day in year
# (1=1.1., 2=2.1., ..., 365/366=31.12.)
# Returns: month (1=Jan, 2=Feb, ..., 12=Dec)
#-----------------------------------------------------------------------------
# Algorithm: R. A. Stone
#-----------------------------------------------------------------------------
my( $year, $n ) = @_;
my $p = &leapyear( $year );
$n += 2 - $p if $n > 59 + $p;
$n += 91;
int( ( 20 * $n ) / 611 ) - 2; # return value
} # end sub month_in_year()
#=============================================================================
#=============================================================================
sub day_in_year {
#-----------------------------------------------------------------------------
# Arguments: year, number of day in year
# (1=1.1., 2=2.1., ..., 365/366=31.12.)
# Returns: day of month (1-31)
#-----------------------------------------------------------------------------
# Algorithm: R. A. Stone
#-----------------------------------------------------------------------------
my( $year, $n ) = @_;
my( $q, $p );
$q = &leapyear( $year );
$n += 2 - $q if $n > 59 + $q;
$n += 91;
$p = int( ( 20 * $n) / 611 );
$n - int( ( 611 * $p ) / 20 ); # return value
} # end sub day_in_year()
#=============================================================================
HG
--
Hans-Georg Rist
hans-georg@rist.net
------------------------------
Date: Mon, 15 Feb 1999 16:10:26 GMT
From: euclid@fantom.com (Dimitri Ostapenko)
Subject: Re: Printing an emailadres
Message-Id: <SFXx2.8$Vk3.46@198.235.216.4>
...
>>I think it's something with the '@' symbol, but I don't know what.
>>
>>Can anyone tell me this?
>
>
use "\" in front of @
------------------------------
Date: Mon, 15 Feb 1999 09:45:00 -0500
From: Mike Skimin <mskimin@loraincounty.com>
Subject: Randomizing Select Results with Perl
Message-Id: <36C832EC.B2D84042@loraincounty.com>
Hello,
I have a list of business in a database. I would like to randomize the
results so no one company is listed at the top every time the select is
processed, but that every company will appear in a random order.
Any one have ideas about this one?
FYI: I am using MySQL and a PERL Script to process the select.
Thank you for your help.
Mike Skimin, Webmaster
Emerge Inc.
http://www.EmergeInc.com
http://www.LorainCounty.com
------------------------------
Date: Mon, 15 Feb 1999 10:30:11 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Randomizing Select Results with Perl
Message-Id: <comdog-ya02408000R1502991030110001@news.panix.com>
In article <36C832EC.B2D84042@loraincounty.com>, Mike Skimin <mskimin@loraincounty.com> posted:
> I have a list of business in a database. I would like to randomize the
> results so no one company is listed at the top every time the select is
> processed, but that every company will appear in a random order.
>
> Any one have ideas about this one?
it's the same problem as randomly selecting elements from a list, which
simply involves knowing the number of elements in the list and the use
of the rand() function. remove the element once you have selected it,
rinse, and repeat. :)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
------------------------------
Date: Mon, 15 Feb 1999 10:06:53 -0500
From: "Robert Gwynne" <gwynne@utkux.utk.edu>
Subject: Re: script to forward email
Message-Id: <7a9dte$beg$1@gaia.ns.utk.edu>
>Also, any comments on the "Perl 5" publicaiton? Just curious as I am
>considering purchasing this.
If you are talking about "Perl 5 Interactive Course" by Jon Orwant, buy it.
>I am looking for a script to forward email. I intend to use it on my
>email-pals club on my site (to hide email addys).
It might be best to use the CPAN module Mail::Mailer.
Here's a snippet of code that I have, but it might not work for you,
especially if your server doesn't have Sendmail installed.
open (MAIL, "| /usr/lib/sendmail -t ");
print MAIL "To: $to_address \n";
print MAIL "From: $from_address \n";
print MAIL "Subject: $subject \n";
print MAIL "\n";
print MAIL "$message, whatever";
close MAIL;
Bob Gwynne
JAPN
------------------------------
Date: Mon, 15 Feb 1999 15:08:38 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: The order of form fields that recieve by cgi program
Message-Id: <F77BEF.GqA@world.std.com>
Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at> writes:
>Bzzzt, please try again...
>The field order is *not* sorted. What does
>"occured" (sic.) mean? The textual order in the
>source of the HTML document? The order in which the
>form fields were rendered by a browser? Alphabetic
>order?
I think he is referring to the feature of the CGI module discussed in
this section of its documentation:
NOTE: As of version 1.5, the array of parameter names
returned will be in the same order as they were submitted
by the browser. Usually this order is the same as the
order in which the parameters are defined in the form
(however, this isn't part of the spec, and so isn't
guaranteed).
So it seems that most browsers return the parameters in the order in
which they are defined in the HTML document, but are under no
obligation to do so. The web server then passes the arguments to the
CGI script in the order in which it received them (having no reason to
change them.) and the CGI module maintains that order in order to help
people who depend on that behavior.
I see little reason why someone would want to assume this
behavior. (The desired order could be kept in either the CGI script or
in a hidden field of the HTML document.) but it seems that the CGI
module goes out of its way to allow it.
--
Andrew Langmead
------------------------------
Date: Mon, 15 Feb 1999 16:19:38 GMT
From: rbell@hcdemocrat.com (Robert Bell)
Subject: Re: V-day Perl Poetry
Message-Id: <36c8486d.9373888@news.eclipse.net>
Shouldn't that be:
open (HEART, "+<for_me") or die of_grief();
etc.
One doesn't want to replace HEART, after all, but add to it.
>On Sun, 14 Feb 1999 21:27:28 -0500, comdog@computerdog.com (brian d foy) wrote:
>In article <36C706A4.B924C36F@nni.com>, Eric Windisch <southpark@nni.com> posted:
>
>> This is my first perl-poem, and isn't very good... dunno if it even
>> parses, but what the hell :)
>>
>>
>> open (HEART, "for_me");
>
>sure you didn't want to open that for writing
>
> open (HEART, "> for_me")
>
>and then check to see if it worked
>
> or warn "oops, sorry to bother you";
>
>?
>
>[nice job, btw ;]
>
>--
>brian d foy
>CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Robert Bell
rbell@hcdemocrat.com
------------------------------
Date: Mon, 15 Feb 1999 07:01:15 -0600
From: "Steven T. Henderson" <stevenhenderson@prodigy.net>
Subject: Re: Web based calendar
Message-Id: <IEWx2.55707$641.100790@news.san.rr.com>
-ALSO-
check out http://www.stevenhenderson.com/demo
sounds like i have already done it. let me know and i can send you the
source, its very small and straightforward.
Justin Scott wrote in message <36C7B90B.F2FFCFC8@darktech.org>...
>> I'm very new to perl / CGI programming etc, so excuse my ignorance.
>
>As am I.
>
>> As a learning exercise, I want to create a very simple web based
calendar,
>> I just want to pick a date, and be able to make an entry. Then redisplay
>> the calendar showing the new entry.
>
>Sounds interesting.. I have a similar project that needs to be done for a
web
>site I'm working on right now.
>
>> Does anyone know of a calendar 'widget', or an perl modual that I could
use
>> to help me with this effort.
>
>Darryl C. Burgdorf has created an excellent Perl calendar script which I am
in
>the process of taking apart, modifying, and re-assembling for personal use
on
>the previously mentioned web site. You might take a peek at that, as he
has
>done a great job with it. The address to that script is:
>http://awsd.com/scripts/webcal/
>
>-Justin Scott aka Leviathan
> Webmaster, Riverview High School
> http://www.riverviewhs.com
------------------------------
Date: 15 Feb 1999 11:54:59 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: Web based calendar
Message-Id: <x7btivobdo.fsf@home.sysarch.com>
a full featured commercial web calendar in perl is webevent at
www.matadordesign.com.
it may be useful just to download and check out the features and design.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
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 4897
**************************************