[6918] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 543 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 30 11:27:54 1997

Date: Fri, 30 May 97 08:00:37 -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, 30 May 1997     Volume: 8 Number: 543

Today's topics:
     !Reading file <lauri@nettipaja.clinet.fi>
     Re: $ENV{PWD} versus `pwd' (Honza Pazdziora)
     [Q] Converting date and time amas@lhr-sys.dhl.com
     Re: [Q] Converting date and time <rootbeer@teleport.com>
     Re: [Q] Converting date and time (Michael Fuhr)
     Re: any editor for perl? <customdesign@nstate.net>
     Any plans for perl plug-ins? (Mark Nielsen)
     Re: Date Comparisons (Steffen Beyer)
     extensions in Configure <ldadams@mindspring.com>
     get the users login name <gijsbree@se.bel.alcatel.be>
     Re: get the users login name (Honza Pazdziora)
     Re: get the users login name <rootbeer@teleport.com>
     Re: Help with ( (Quentin Fennessy)
     Help writing a perl script.. (Ashwin Bihari)
     Re: How do you know is a message sent from sendmail fai <rootbeer@teleport.com>
     Re: Idiom for list summation? <rra@stanford.edu>
     Need vacation program in Perl! <q13382@bang.cig.mot.com>
     Re: Need vacation program in Perl! <rootbeer@teleport.com>
     Re: Need vacation program in Perl! (Nathan V. Patwardhan)
     NEWBY - problem with "register" password script - pleas shadow@purcom.org
     Re: NEWBY - problem with "register" password script - p <rootbeer@teleport.com>
     NT 4.0/ODBC/Perl/Weird? <trey@waymark.net>
     Re: ODBC, PERL, SQL and Access <trey@waymark.net>
     Re: Open and print HTML file insside CGI script <customdesign@nstate.net>
     Re: OS/2 : Backticks causing runtime crash (Koos Pol)
     Re: PASSING INFO/ RUNNING JAVA APPLICATION FROM PERL SC (Ronald L. Parker)
     perl compiler ? (Frederic COTE)
     Perl compiler (Sara Young)
     Re: Problem with Makefile.PL - Please help (Magnus Bodin)
     Re: PURE PERL .gif creating library needed; not in @#$  (Rachel Polanskis)
     Re: Slices of lists (Colin Kuskie)
     Re: Standalone web database for Perl? (Jay Flaherty)
     Re: Why is ("a" == 0) true? (Honza Pazdziora)
     Re: Why is ("a" == 0) true? (Michael Fuhr)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 30 May 1997 16:06:27 +0300
From: Lauri Laakso <lauri@nettipaja.clinet.fi>
Subject: !Reading file
Message-Id: <338ED08E.75EC@nettipaja.clinet.fi>

This should be simple:

I have file $xfile...

--- begin ---
This is line 1
and there are more lines like this one
and this third one
--- end ---

How I can read it...

$data = "This is line 1\nand there are more lines like this one\nandthis
third one";

Please email or I may miss it.

 ....................................................................
   Lauri Laakso - Nettipaja - GSM: 358+40-588 8889 [EMAIL2GSM]
 http://www.nettipaja.clinet.fi/ - mailto:lauri@nettipaja.clinet.fi




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

Date: Fri, 30 May 1997 08:47:35 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: $ENV{PWD} versus `pwd'
Message-Id: <adelton.864982055@aisa.fi.muni.cz>

evenh@bigblue.pvv.ntnu.no (Even Holen) writes:

> Because the $ENV{PWD}, or the $PWD in you current environment is ment to
> reflect whatever working directory you are in at the time being. That is
> you don't change it to change directory, but each time you change the
> directory it changes...

This doesn't sound right to me. When you do chdir, the internal
information about the process changes, but not the environment value.

> In this context it's quite natural that you get the given output.
> 
> >Grrr....this would seem to be "wrong" to me.  If I change the
> >directory that we are "in" using chdir, the environment has changed,
> >and when I look at the ENV hash, it should change as well.
> 
> No, it's correct behaviour albeit not what you wanted.
> 
> >This brings up the next question:  how do I determine which directory
> >I'm working in _without_ doing system calls?  
> 
> You don't?
> 
> In my experience you do need to a least one system call to get your
> starting point. But after you've done this once it should be relatively
> easy to keep track on where you are. Or that from time to time you
> changes the current directory to a given location (say your starting
> point, which you've got from pwd or similar.

You use the module Cwd to do the work for you, the there is no need
for forking another `pwd`.

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Fri, 30 May 1997 03:51:19 -0600
From: amas@lhr-sys.dhl.com
Subject: [Q] Converting date and time
Message-Id: <864982040.29955@dejanews.com>

Please could someone help me, I am getting desperate. I have been given
a file format where both the date and time are encoded and can't work
out how to decode them with an ease.

The date is stored as the number of days since 1/1/1900. What I need
from it is the day, the month and the year.

The time is stores as the number of seconds since the start of the
day and from it I need hour,minutes and seconds.

If anyone has a Perl 4 compatable module or an algorithm that would
show me how to do this I would very much appreciate this.

Thanks - Please CC me your reply

Andre

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Fri, 30 May 1997 07:40:01 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: amas@lhr-sys.dhl.com
Subject: Re: [Q] Converting date and time
Message-Id: <Pine.GSO.3.96.970530073611.11819D-100000@kelly.teleport.com>

On Fri, 30 May 1997 amas@lhr-sys.dhl.com wrote:

> The date is stored as the number of days since 1/1/1900. What I need
> from it is the day, the month and the year.

There are many different date formats, and most of them can be simply
converted with the help of modules available on CPAN. If you can't find
another way to do this, I'll point out that that number is easily
converted to the standard Unix time format with just a subtraction and a
multiplication. (So, you might not even need a module!)

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

> If anyone has a Perl 4 compatable module or an algorithm that would
> show me how to do this I would very much appreciate this.

Modules don't work with Perl 4. You should really install Perl 5, since
it's been around since 1994 in release (not beta) versions.

Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 30 May 1997 08:28:19 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: [Q] Converting date and time
Message-Id: <5mmo63$nt1@flatland.dimensional.com>

    [ cc to author ]
amas@lhr-sys.dhl.com writes:

> Please could someone help me, I am getting desperate. I have been given
> a file format where both the date and time are encoded and can't work
> out how to decode them with an ease.
>
> The date is stored as the number of days since 1/1/1900. What I need
> from it is the day, the month and the year.

Look at the Date:: or Time:: modules on CPAN.  I know Date::Manip
can do this.

    http://www.perl.org/CPAN/modules/by-module/Date/

> The time is stores as the number of seconds since the start of the
> day and from it I need hour,minutes and seconds.

No problem.

> If anyone has a Perl 4 compatable module or an algorithm that would
> show me how to do this I would very much appreciate this.

The above modules work with Perl 5, which you should install ASAP.
Perl 4 has been unsupported for years.

-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/


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

Date: Fri, 30 May 1997 02:54:43 -0700
From: TRG Custom Graphics <customdesign@nstate.net>
Subject: Re: any editor for perl?
Message-Id: <338EA3E3.4F60@nstate.net>

Mark Mills wrote:
> 
> On Tue, 27 May 1997 22:49:27 +0800, ccm <biceps@hkstar.com> wrote:
> 
> >I am a new user in Perl.
> >I found that those .pl files edited under Win95/Dos Editor will not work
> >properly.
> >But if I edit them in the unix shell with pico, they works fine.
> >is out there any editor which workable with perl under Win95/Dos
> >Environment?
> 
> Any text editor will do.  What you need to do is stop ftp'ing the
> files in BINary mode.  Make sure you move them back and forth in ASCII
> text mode.  If you are zip'ing them, stop.  This will drive you nuts
> till you figure it out. :>  Wait till you move them to mac machines
> too.  I sorted this all out without hints late on night.  If it had
> gone another five minutes or so I might still be in a corner slowly
> ripping a newspaper into neat 1/2 centimeter square bit while humming
> the theme to Fame.  =}
> 
> In 95 I use notepad (or wordpad, which can actually handle unix format
> text files if you have them, but still, use ASCII mode...)
> 
> In unix I use vi(m) because some people put more than 255 chars on a
> line and pico truncates without warnings! <-- not good for perl!  Of
> course if you are copying work from someone that stupid then maybe you
> deserve that...
> 
> In dos I suppose edit would do, unless you are partial to *shudder*
> edlin and other forms of mortal torture.
> 
> In mac I hear teachtext is adequate if it is a onetime thing.
> 
> HTH
> 
> >      SubSpace SquadSite: http://www.blackdragon.org/
> Kewl, SubSpace...
> --
> Mark <mark@ntr.net>
> Zaphod Beeblebrox: It's the weird color-scheme that freaks me. Every time
> you try to operate one of these weird black controls, which are labeled
> in black on a black background, a small black light lights up black to
> let you know you've done it!

I can say that I disagree (to a point). It really depends on what you
use.  I just use a notepad and hack away. But for myself having an
online chat site in perl, I HAVE to use pico or v to edit my scripts
online, or there wll be 100 people getting server 500 errors!  If you
can get away with t, just FTP after edting, etc. in a notepad. BUT, if
you need an onlne editor (such as myself in Linux), then I don't know
what to say.. pico does have a terrible wrap.. depending  on what it's
set at.. (more hacking probably).. oh well.. I think pico and vi are
both poor online edtors, and I end up having to FTP most of the time.. t
sometimes does short wraps without warning.. ERROR.. *cringe*..  f
anyone knows of any better onoine editors that aren't pico or vi, please
inform me...

		Tim...
                admin@chathub.com


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

Date: 30 May 1997 08:46:40 -0400
From: men2@auto.med.ohio-state.edu (Mark Nielsen)
Subject: Any plans for perl plug-ins?
Message-Id: <5mmi7g$1pb@auto.med.ohio-state.edu>

I would really like to use perl instead of java for web client programming.
Are there any plans to make a perl plug-in like tcl/tk has?

Would it be possible to create a plug-in which would interpret perl 
commands? -- so that you wouldn't have to program in java.

Mark
-- 
---------------------------------------------------------------------------
Mark Nielsen	men2@auto.med.ohio-state.edu or gytres+@osu.edu
Systems Specialist
The Ohio State University


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

Date: 30 May 1997 11:42:36 GMT
From: sb@en.muc.de (Steffen Beyer)
Subject: Re: Date Comparisons
Message-Id: <5mmefc$i1$1@en1.engelschall.com>

John Cokos <jcokos@surfr.com> wrote:

> I'm trying to do a date comparison, if you can help, I'd appreciate it.

[...]

> I can access the records by using this type of code
> $this_date = $entries[0]{'entry_date'};

> I want to be able to delete entries that are 30+ days old.
> How do I compare the date in the record to the current date?

You can use the module "Date::DateCalc" for this:

use Date::DateCalc qw(:all);
use Date::DateCalcLib qw(:all);

@today = parse_date(`/bin/date`); # note that this returns (year,month,day)!

@date = decode_date_us($this_date); # same here

if (dates_difference(@date,@today) > 30)
{
    # more than 30 days old, delete it
}
else
{
    # less than 30 days old, do something with it
}

The result of the function "dates_difference" is negative if the
two arguments are not given in chronological order.

You can find this module either on my web site

http://www.engelschall.com/u/sb/download/DateCalc-3.0.tar.gz

or on any CPAN ftp server.

Hope this helps.

Yours,
-- 
    Steffen Beyer <sb@sdm.de> http://www.engelschall.com/u/sb/
     "There is enough for the need of everyone in this world,
      but not for the greed of everyone." - Mahatma Gandhi
   >> Unsolicited commercial email goes directly to /dev/null <<


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

Date: Fri, 30 May 1997 10:32:30 -0400
From: Larry Adams <ldadams@mindspring.com>
Subject: extensions in Configure
Message-Id: <338EE4FE.7FF1@mindspring.com>

I'm compiling 5.004 and noticed a difference in the extensions listing
when running Configure.(Solaris 2.5.1)

When I compiled 5.003, months and months ago, I listed:
Fcntl,FileHandle,NDBM_File,ODBM_File,POSIX,SDBM_File,Safe,Socket

The defaults in 5.004 Configure are:
Fcntl,IO,NDBM_File,ODBM_File,POSIX,SDBM_File,Opcode,Socket

The obvious differences are IO<->FileHandle and Safe<->Opcode

There was some reason for the FileHandle and Safe back then, probably
because of some of the other PERL related things I installed, like
Tk,CGI, etc. - of course the documentation I made when I compiled 5.003
is somewhere, probably to be found decades from now by whoever inherits
my cube... 

Is there a listing of the main objects contained in the 4 extensions in
question? and significant differences... 

Should I compile with the older extensions added on to the defaults?

Before I install 5.004 on any critical machines I would like to have as
much forewarning about anomalies as possible.

Thanks for any assistance in advance

Larry Adams



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

Date: Fri, 30 May 1997 10:57:09 +0200
From: Edwin Gijsbregts <gijsbree@se.bel.alcatel.be>
Subject: get the users login name
Message-Id: <338E9665.6C2F@se.bel.alcatel.be>

Hello,

is there a way to retrieve the login name of the user who invoked
a perl-script  ? (btw. I am new to perl)

Edwin.


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

Date: Fri, 30 May 1997 13:05:01 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: get the users login name
Message-Id: <adelton.864997501@aisa.fi.muni.cz>

Edwin Gijsbregts <gijsbree@se.bel.alcatel.be> writes:

> Hello,
> 
> is there a way to retrieve the login name of the user who invoked
> a perl-script  ? (btw. I am new to perl)

$ENV{LOGNAME} or $ENV{USER}.

Or there is a function getlogin.

Or you can use the value of $< and then (getpwuid($<))[0].

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Fri, 30 May 1997 07:35:43 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Edwin Gijsbregts <gijsbree@se.bel.alcatel.be>
Subject: Re: get the users login name
Message-Id: <Pine.GSO.3.96.970530073119.11819C-100000@kelly.teleport.com>

On Fri, 30 May 1997, Edwin Gijsbregts wrote:

> is there a way to retrieve the login name of the user who invoked
> a perl-script  ? (btw. I am new to perl)

It's okay that you're new; you can still use the same method that anybody
else would use. 

The special variable $< holds the numerical user-id of the user who
invoked the script. The built-in function getpwuid (whose ugly name was
around long before Perl) can give you information about a user, including
the username. If you simply use it in a scalar context, you'll get the
username, something like this. 

    $username = getpwuid( $< );

Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 30 May 1997 14:57:50 GMT
From: quentin@remington.amd.com (Quentin Fennessy)
Subject: Re: Help with (
Message-Id: <5mmpte$hk9$1@amdint2.amd.com>

In article <EAyoyo.DAr@world.std.com>,
Andrew M. Langmead <aml@world.std.com> wrote:
>Dave Boswell <dave_boswell@nt.com> writes:
>
>>> Dave Boswell  <dave_boswell@nt.com> wrote:
>>> >   #!/usr/local/perl-5.004/bin/perl -w
>>> >   print ( "hello world\n" );
>>> >
>>> >When run from the command line, with 'perl -w file' it works fine, if I
>>> >however make the file executable and run it I get the error.  I have
>>> >removed the () pair and ran it as an executable and everything is OK.
>>> 
>
>>No whitespace.  I'm running ksh under HPUX 9.05, nothing special there. 
>
>Many systems have a 32 character limit on the "#!" line, including the
>switches. (Of which many only allow one, but perl tries to make up for
>it.) Sorry I didn't notice that before.
>
>This used to be in the FAQ, but it doesn't seem to be in the current
>version.

>From perlrun(1) (not the FAQ):

	Because many operating systems silently chop off kernel
	interpretation of the #! line after 32 characters, some
	switches may be passed in on the command line, and some may
	not; you could even get a "-" without its letter, if you're not
	careful.  You probably want to make sure that all your switches
	fall either before or after that 32 character boundary.  Most
	switches don't actually care if they're processed redundantly,
	but getting a - instead of a complete switch could cause Perl
	to try to execute standard input instead of your script.  And a
	partial B<-I> switch could also cause odd results.

I could not find it in the faq either.


-- 
Quentin Fennessy			AMD, Austin Texas


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

Date: 30 May 1997 13:24:50 GMT
From: abihari@cs.uml.edu (Ashwin Bihari)
Subject: Help writing a perl script..
Message-Id: <5mmkf2$b16$1@ulowell.uml.edu>

Hello all, I have to write a Perl script for where I work to accomplish a task,
I have experience with C and C++ but unforuntanetly my experience and knowledge
of Perl is a little lacking, so I hope someone can give me a helpful hand out
here.

The scneario is as follows, I work in a QA department and we have some 42
machines, ranging from UltraSparc 170's, UltraSparc200's to SGI's and HP's,
most of them have same or less 512MB to 1gig of RAM, but the actual CPU
speeds a very varying, we have already written a script that will go to each
machine and run 3 tests about 5 times each, they are different tests, we are
part of the EDA(Electronic Design Automation) business and deal with Integrated
Chip verification, in that, we test circuit board designs, so what we need
to do is to take 2 design specifications, BUILD them into our object files, and
then compare them to eachother and see if they are the same or differnt, to
our program goes through 2 BUILD processes and 1 VERIFY process, the 3 tests
I mentioned above are just that, so each of BUILD's is run 5 times on each
machine and 1 VERIFY is run 5 times on each machine, the script that we already
wrote takes all this infomration and creates a log file, along the lines of:

TestName		Machine	TestType	CPU/MEM
------------------------------------------------------
bio_funct		adam	BUILD		56/15
bio_funct		adam	BUILD		55/15
bio_funct		adam	BUILD		57/15
bio_nofunct		adam	BUILD		54/15
bio_nofunct		adam	BUILD		55/15
bio_nofunct		adam	BUILD		55/15
bio_functTObio_nofunct	adam	VERIFY		115/15
bio_functTObio_nofunct	adam	VERIFY		118/15
bio_functTObio_nofunct	adam	VERIFY		121/15

these are the 3 tests on one machine named adam. we have this type of log
for the other 41 odd machines, we also have a file that lists all the machine
names and the types of machines they are, for example:

yoyodyne	UltraSparc170
speedy		UltraSparc170
bach		UltraSparc200E
sonic		UltraSparc200ES
ham		HPJ200
boaz		HPJ200
seth		HP755

and so on..I have written a script so far that will take the first report
with all the times and memory and test name and stuff, and split it all up
to individual variables, but I am stuck after that, I know the logic of how
things need to happen, I am just having a very hard time implementing it in
Perl.

The logic should be something along the lines of checking the testname, and
the machine it was run and finding the HIGHEST cpu time for that test on any
given machine, for example here, for the first BUILD it should be 57 CPU secs
and for the second BUILD it should be 55 CPU secs and for VERIFY it should be
121 CPU secs, I need to list just these 3 times and then go on to the next
machine, I have sorted the list alphabetically and everything..That is one
of the tasks of the script.

The next is to compare the results of EACH machine to the base machine which
is the machine named boaz which is a HPJ200 type machine, so once I read in
the name boaz I have to create a few variables so that I can compare things
to it later on...that is basically what the program has to do, but knowing
very little of Perl I am not sure exactly hwo to get to it, so if you any
comments or suggestions, please feel free to share them with me, you can
reply to this newsgroups but please also cc: to either of my address:

mailto: ashwin@chrysalis.com
mailto: abihari@cs.uml.edu

preferablly to the first account, thanx..

---
/-----------------------------------------------------------------------------\
|Ashwin Bihari		  		    University of Massachusetts Lowell|
|E-Mail: abihari@cs.uml.edu	            Department of Computer Science    |
|URL: http://www.cs.uml.edu/~abihari                                          |
\-----------------------------------------------------------------------------/



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

Date: Fri, 30 May 1997 07:11:25 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Jason Anthony <oook@deathsdoor.com>
Subject: Re: How do you know is a message sent from sendmail failled?
Message-Id: <Pine.GSO.3.96.970530070815.11819A-100000@kelly.teleport.com>

On Fri, 30 May 1997, Jason Anthony wrote:

> Subject: How do you know is a message sent from sendmail failled?
> 
> Can anyone tell me how to get results from failed calls to sendmail
> from in a perl script.

If you have a pipe to sendmail, you can get a status value when you close
the pipe. It's either the return value from the close(), or you can find
it in the special $? variable. (See perlfunc and perlvar.)

Of course, just because sendmail returns a zero, indicating success, that
doesn't mean that the message was successfully delivered! :-)

Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 30 May 1997 01:34:37 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Idiom for list summation?
Message-Id: <m3g1v5bboi.fsf@windlord.Stanford.EDU>

Randal Schwartz <merlyn@stonehenge.com> writes:
Olivier Dehon <dehon_olivier@jpmorgan.com> writes:

>> You almost had it. It's fairly easy to translate the foreach construct
>> into a map construct:

>> map {$sum += $_} @nums;

> Ouch. Please don't do this.  It's considered bad form to use map or grep
> in a void context.  Use the equivalent foreach instead:

> 	$sum = 0;
> 	for (@nums) { $sum += $_ }

I still disagree with this stylistic guideline.  I can understand how some
people find "for" easier to read than "map," but that's because quite a
few people come from a C (or other imperative language) background.

For people with a LISP background, map is arguably more intuitive, and
there's nothing wrong with discarding the return value of a function whose
return value you're not interested in (this is done routinely with print).
There may be a speed issue involved, but there *shouldn't* be; Perl should
be able to detect that map is being run in a void context.

I don't think this is a big enough issue to be pointed out on the order of
not checking return statuses or printing $!.

-- 
Russ Allbery (rra@stanford.edu)         <URL:http://www.eyrie.org/~eagle/>


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

Date: Fri, 30 May 1997 17:36:10 +0700
From: Mongkol Horburapa <q13382@bang.cig.mot.com>
Subject: Need vacation program in Perl!
Message-Id: <338EAD9A.9430E227@bang.cig.mot.com>

Hi,

Anyone can provide me with vacation program in Perl?

Thanks,



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

Date: Fri, 30 May 1997 07:43:56 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Mongkol Horburapa <q13382@bang.cig.mot.com>
Subject: Re: Need vacation program in Perl!
Message-Id: <Pine.GSO.3.96.970530074057.11819E-100000@kelly.teleport.com>

On Fri, 30 May 1997, Mongkol Horburapa wrote:

> Anyone can provide me with vacation program in Perl?

    exec 'vacation';		#  :-)

Works for me!

Seriously, why do you want one written in Perl? The available program is
pretty versatile and efficient; I don't see much reason to re-write it. Is
there something that it won't do for you? 

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 30 May 1997 14:27:41 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Need vacation program in Perl!
Message-Id: <5mmo4t$go6@fridge-nf0.shore.net>

Mongkol Horburapa (q13382@bang.cig.mot.com) wrote:

: Anyone can provide me with vacation program in Perl?

if($day eq 'Saturday') { print "I'm on vacation!\n"; }

:-)

What kind of vacation program are you looking for?  Like an auto-responder
to your e-mail when you're away?  If you're using Unix, why not use the
vacation program?
--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Fri, 30 May 1997 09:24:26 GMT
From: shadow@purcom.org
Subject: NEWBY - problem with "register" password script - please help
Message-Id: <33909c1a.11965073@news.demon.co.uk>

Hi

Sorry to be a pain but, partly as a way of learning about scripts and partly for
fun I downloaded a password programme called register and I'm having trouble
with one bit of it

In a nutshell the programme is supposed to do the following.

If visitors want to access a protected area of my site they are first directed
to a page called "register.html where they are asked to enter name, e-mail etc
and select a user name and password.  When they press Submit a perl programme
called "register.pl" is called.   This checks that the selected password is not
already in the .htpasswd file in the protected directory and if it isn't then it
calls another script called htpasswd.pl  which encodes the password and places
it in the .htpasswd file.

My problem is that whilst the first part works fine the password is not being
written to the .htpasswd file although you get a message saying that your
password has been accepted.

I don't yet know enough to work out the problem which I asssume is to do with
the htpasswd.pl script.

I should say I just created a file in notepad called .htpasswd and uploaded it -
was this Ok or do I need to create it using telnet and unic commands.

Any help will be appreciated.

If you want to see the thing working - as far as it does then please go to

www.purcom.org/register.html

and fill in the form.

If you want me to send you the scripts with my url's etc added please e-mail me.
It may be I've put an actual url where a relative one is needed but the
instructions with the programme weren't too clear about this.  I'm sure I've
probably done something stupis but can't work out where.

Any help will be greatfully appreciated as this is bugging me,

Cheers

Mike


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

Date: Fri, 30 May 1997 07:30:52 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: shadow@purcom.org
Subject: Re: NEWBY - problem with "register" password script - please help
Message-Id: <Pine.GSO.3.96.970530071312.11819B-100000@kelly.teleport.com>

On Fri, 30 May 1997 shadow@purcom.org wrote:

> Sorry to be a pain but, partly as a way of learning about scripts and
> partly for fun I downloaded a password programme called register and I'm
> having trouble with one bit of it

> If visitors want to access a protected area of my site they are first
> directed to a page called "register.html where they are asked to enter
> name, e-mail etc and select a user name and password.  When they press
> Submit a perl programme called "register.pl" is called.  This checks
> that the selected password is not already in the .htpasswd file in the
> protected directory and if it isn't then it calls another script called
> htpasswd.pl which encodes the password and places it in the .htpasswd
> file. 

I suspect that it checks to see that the selected username is not already
there, rather than the selected password. But that's probably not really
relevant to the problem. (Does it at least use flock, in case two people
are using your script simultaneously? If not, that's a potential danger.) 

> My problem is that whilst the first part works fine the password is not
> being written to the .htpasswd file although you get a message saying
> that your password has been accepted. 

Sounds like the author didn't put in any checks that file operations were
successful. :-P  Let's check: Do you see that every open() is followed
with a die() which can let you know what went wrong? That is, you should
be able to find some code something like this...

    $filename = './whatever/.htpasswd';
    open FILE, "<+$filename"
        or die "Can't open '$filename' for update: $!";

If you can see that the author didn't check, that's the problem. Or, at
least it's _a_ problem. :-)  (I should note that there are other possible
ways to report errors from a CGI script; perhaps the author, instead of
using die(), did something to send the error message to another location. 
But that should be obvious from inspection of the code.) 

If you can do so, ask the script's author for help in fixing it; failing
to check for conditions which will cause the script's failure could easily
be construed as a bug. 

> I should say I just created a file in notepad called .htpasswd and
> uploaded it - was this Ok or do I need to create it using telnet and
> unic commands. 

It's possible that you have a file in the wrong format, and this could be
contributing to the problem. If you delete it, the touch command can
create a new, empty file; the script should be able to add passwords to
that.

    rm .htpasswd
    touch .htpasswd

One last note - As any animal trainer will tell you, if you make an animal
do a difficult trick, you need to reward them well for doing so. I hope
that the contents of your web page will be so amazingly wondrous that
nobody will mind having to make up a password, make note of it for later,
and fill in a form.

Good luck!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Fri, 30 May 1997 08:56:55 -0500
From: Trey Thompson <trey@waymark.net>
Subject: NT 4.0/ODBC/Perl/Weird?
Message-Id: <338EDCA7.5B06@waymark.net>

Stats:
NT 4.0 Server SP2
Perl 5.001 (Win32 Build 110)
ODBC.pm (Roth Release v960528)

I have been using this for months, and had NO problems with it until
now.  I have one server, that a simple script works fine on (Selecting
rows, inserting data, etc...).  When putting the SAME script and the
SAME database on a different NT 4.0 server with the SAME stats as above,
the INSERT no longer works, however the SELECT does.  The DSN is NOT
Read Only, so, I am at a loss...

Any help is appreciated...

Reply e-mail OR post, I read all this...


-- 

_____________________________________________________________________
Trey Thompson                          Voice:            972-409-9800
Waymark Internet Services, Inc.          Fax:            972-409-0858
                                      E-Mail:        trey@waymark.net
                                         WWW:  http://www.waymark.net


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

Date: Fri, 30 May 1997 08:39:17 -0500
From: Trey Thompson <trey@waymark.net>
Subject: Re: ODBC, PERL, SQL and Access
Message-Id: <338ED885.40C5@waymark.net>

I think that a lot of the search engines contain "offsets".  When you
select to view something, it gives you items 0-24.  In the form that has
the button for "Next", there is an offset variable that tells it, start
displaying at 25, etc...

Does this help?

heidi_ahders@non-hp-om.cv.hp.com wrote:
> 
>   I am using MS Access, Perl5, ODBC module by Roth, on a Windows NT4.0.
> 
>   I would like to be able to display 10 items from my database at a time
>   on the web. Then have a link so that the users can continue viewing the
>   database. Something like the search engines have.
> 

-- 

_____________________________________________________________________
Trey Thompson, Operations              Voice:            972-409-9800
Waymark Internet Services, Inc.          Fax:            972-409-0858
                                      E-Mail:        trey@waymark.net
                                         WWW:  http://www.waymark.net


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

Date: Fri, 30 May 1997 02:57:22 -0700
From: TRG Custom Graphics <customdesign@nstate.net>
Subject: Re: Open and print HTML file insside CGI script
Message-Id: <338EA482.7573@nstate.net>

Eric Bohlman wrote:
> 
> Miran Sepic (miran.sepic4@mss.tel.hr) wrote:
> 
> : $login_page = "/user/download.html";
> : open (FILE, "$login_page");
> : @filein = <FILE>;
> : print "Content-type: text/html\n\n";
> : print @filein;
> 
> : The response is:
> 
> : Internet explorer cannot open the Internet site .....
> : The operation completed successfully.
> 
> : When I put HTML directly inside script,  everything is OK.
> 
> You aren't checking to see if your open() was successful.  How do you
> know that you were actually sending *anything* out?

If nothing else, check the files to see the byte size.. perhaps t's
writting zero byte files.. N That could depend on anything from the hard
drve space, to how many intsances or data transfers are happing at once
too.. 

  Tim...


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

Date: 30 May 1997 08:47:19 GMT
From: koos_pol@nl.compuware.com.NO_JUNK_MAIL (Koos Pol)
Subject: Re: OS/2 : Backticks causing runtime crash
Message-Id: <5mm46n$pm@news.nl.compuware.com>

OS/2 Warp 3.0 + FP10 + Perl 5.003_93
-------------------------------------
  print "Hey";
  `dir`;

results in:
  Hey

Using -w flag:
  Hey
  Can't spawn "dir": No such file or directory at test.pl line 1.

  print "Hey";
  `helloworld.cmd`;

results in:
  Hey

Using -w flag:
  Hey
-------------------------------------
>From the window title I see that helloworld.cmd is being
executed, but the output seems to be  going nowhere.


Koos Pol
----------------------------------------------------------------------
                                                              S.C. Pol
                                              PC Systems Administrator
                                                 Compuware Europe B.V.
                                      email: Koos_Pol@nl.compuware.com


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

Date: Fri, 30 May 1997 13:44:33 GMT
From: ron@farmworks.com (Ronald L. Parker)
Subject: Re: PASSING INFO/ RUNNING JAVA APPLICATION FROM PERL SCRIPT
Message-Id: <338fd540.3230095@10.0.2.33>

On Thu, 29 May 1997 23:11:55 -0700, Tom Phoenix
<rootbeer@teleport.com> wrote:
>On 28 May 1997, Rajat Aggarwal wrote:
[...]
>> System("rlogin peagus");
>> System("cd www/project2");
>> System("(java project2 $url) > $output");
[...]
>
>I think what you want is a two-way connection to your rlogin process, so
>you can 'type' to it, maybe via a pseudo-tty. I don't know much about
>this, but I know it's not easy. Good luck!

If you know all the input ahead of time, it looks like it should be 
pretty easy if you're using a system that supports forking.  (This 
example doesn't do the error-checking that a real program should do.  
See perlipc for details.  This code is just a fragment, not a complete

program.  Contents may have settled during shipping.)

-----------
$input = "cd www/project2\njava project2 $url\n"
$childpid = open ( CHILD, "-|" );
if ( !$childpid ) {
  open( RLOGIN, "|rlogin peagus" );
  print RLOGIN $input;
  close RLOGIN;
  exit;
  }
$output = join('', <CHILD>);
close CHILD;
-----------

Tom, you're one of the people on this group whose knowledge and 
experience of Perl I most respect.  I posted this once before in 
response to a question about PGP, and I invited commentary from the 
local Perl wizards, but none was forthcoming.  This can't possibly be 
as easy as it looks, so what's wrong with it?

--
Ron Parker
Software Engineer
Farm Works Software       Come see us at http://www.farmworks.com
For PGP public key see http://www.farmworks.com/Ron_Parker_PGP_key.txt


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

Date: 29 May 1997 09:24:44 GMT
From: frederic.cote@fundp.ac.be (Frederic COTE)
Subject: perl compiler ?
Message-Id: <5mji0s$cbi@hermes.fundp.ac.be>

Do you know if it is possible to compile a perl script ?

Frederic Cote



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

Date: Fri, 30 May 1997 08:20:45 GMT
From: syoung@actcom.co.il (Sara Young)
Subject: Perl compiler
Message-Id: <EAzJ6L.7y0@actcom.co.il>

I would like to write a Perl program for somebody, but I don't want to
give out the code.

I heard that there is a Perl compiler somewhere.

Where can I get more info on this?

TIA,

Sara


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

Date: Fri, 30 May 1997 08:21:42 GMT
From: Magnus.Bodin@tychonides.se (Magnus Bodin)
Subject: Re: Problem with Makefile.PL - Please help
Message-Id: <33918ca5.245339820@news1.telenordia.se>

Torfinn Keringen <tor@kmd.dk> wrote:

>When i try to install the module IO-1.15 (and some other),
>it complains over that there is no C compiler.
>I have installed the: GNU Development System (ver 95.4c),
>but that doesn't seem to help.

be sure cc or gcc can be found in your PATH


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

Date: 29 May 1997 12:47:24 GMT
From: rachel@virago.org.au (Rachel Polanskis)
To: paf@fbit.msk.su
Subject: Re: PURE PERL .gif creating library needed; not in @#$ C language or external modules.  PERL!
Message-Id: <5mjtss$hg3@janis.virago.org.au>

In article <01bc69cf$8ab9a420$32c8c8c8@paf>,
	"Alexander Petrosyan" <paf@fbit.msk.su> writes:
> I'm looking for a PURE PERL library of manipulating GIF images.
> Perl, Perl and only Perl.
> Without patching perl sources / attaching external C language libraries.

Look for transgif on the web.
It's a perl script that generates transparent gifs.

I'm sure you could hack it into what you want.
It's perl4 only.

Here's the blurb from the top part of the file:

#!/usr/bin/perl -w
## Make a gif "transparent"
##
## Jeffrey Friedl
## jfriedl@omrongw.wg.omron.co.jp
## 15 July 1994
## 2 Aug 1994 - added ability to select transparent color by RGB values.
## 940825.3 -- modified to work with possible future versions of the
##             GIF standard... just in case.
##
#$version = "940825.3";
##
## BLURB:
## Transforms a "normal" gif into a "transparent background" gif.
##
##>
##
## I wrote this because people ask for something like this all the time.
## I just learned the format of GIFs a week ago, so this will likely be
## lacking in many respects.


If you can't find it, I'd contact the author...

rachel




--
Rachel Polanskis                 Kingswood, Greater Western Sydney, Australia 
grove@zeta.org.au                http://www.zeta.org.au/~grove/grove.html
r.polanskis@nepean.uws.edu.au    http://www.nepean.uws.edu.au/ccd/
                Witty comment revoked due to funding cuts


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

Date: 29 May 1997 13:13:05 -0700
From: colink@latticesemi.com (Colin Kuskie)
Subject: Re: Slices of lists
Message-Id: <5mko0h$3q7@defiant.latticesemi.com>

In article <339671cd.18396087@news.geccs.gecm.com>,
Brian Orpin <brian.orpin@gecmX.com> wrote:
>As a newcomer to Perl I have hit my first (apparently) insurmountable
>problem which on line help (The downloaded HTML man pages are broken
>but that's another thread) hasn't and is beyond 'Learning Perl' (what
>a great starter).
This should not be a problem.  You shouldn't need the "downloadable
HTML man pages" because all installations of perl come with a copy
of those very man pages (in man, HTML, and various other sundry forms).
On my Solaris box, I find them in:
/usr/local/lib/perl5/html    --> for HTML
/usr/local/man               --> for man
/usr/local/src/perl5.002/pod --> raw form

(If you're not on a UNIX like box, I have no idea where they are kept.
 Whoever installed perl who be able to tell you where to find them.)

Additionally, I would recommend getting a copy of the book "Programming
Perl" by Larry Wall (creator of perl), Tom Christiansen (guy who wrote
a lot of perl documentation), and Randal Schwartz (author of Learning Perl).
In it, you will find the answer to your question, described below.

>I wish to replace a slice of an array.
Ah ha! You want to use splice()!

>I used a grep to find if the item (string) exists in the array but
>could not find a function to tell me it's position other than by going
>through the array and incrementing a counter.  Is there a better way?
Not really.

>@new = @old[$start..$end];
>
>However, how do I replace the slice with a different array e.g. or
>even delete those elements I have identified.
>
>@old = ("one", "two", "three");
>@new = ("twoa", "twob");
>
>to get  an array ("one", "twoa", "twob", "three")

splice(@old, 1, 1, @new);
or in your case:
##Generic definition
##    (ARRAY, OFFSET, LENGTH, [optional list to replace that slice with]);
splice(@old, $start, $start-$end+1, @new);

Hope this helps,
Colin


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

Date: 30 May 1997 11:39:19 GMT
From: fty@hickory.engr.utk.edu (Jay Flaherty)
Subject: Re: Standalone web database for Perl?
Message-Id: <5mme97$ch8$1@gaia.ns.utk.edu>

IMHO MySql is hands down the most robust/fast/free DBMS out there.
Check out http://www.tcx.se 
You can then use the DBI::DBD modules to interface your Perl CGI scripts.
Check out http://www.hermetica.com/technologia/DBI

Jay

Alan Gutierrez (a@b.c) wrote:
: 
: Simple on UNIX is Mini SQL. I would consider using perl and a plain 
: text file first.
: 
: I doubt that you have to install a commercial RDBMS. 
: 
: http://hughes.com.au/           MiniSQL
: 
: Another free one.
: 
: http://www.postgresql.org/      Postgress95
: 
: Using NT?
: 
: http://www.roth.net/odbc/       ODBC.pm
: 
: -- 
: (A)lan (J)ames Gutierrez 
: alan at cybernet dot com

-- 
**********************************************
Jay Flaherty                       fty@utk.edu

If software was free, who would pay "THE BILL"
**********************************************


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

Date: Fri, 30 May 1997 08:50:15 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Why is ("a" == 0) true?
Message-Id: <adelton.864982215@aisa.fi.muni.cz>

dchen@interport.net writes:

> Hi.
> 
> The following perl behavior baffles me:
> 
> perl -e 'if("a" == 0) { print "wow" }'
> Output is : wow
> 
> Perl thinks that "a" == 0 .
> I tried this on Perl 4.0.1.8.36 on SunOS 4.1.3 and Perl 5.003 on Solaris 2.5.
> 
> Why is this?

Because the numeric value of the string "a" and the numeric value of
zero are numerically equal. String is converted to number before doing
numerical comparison. You probably wanted to do

	if ("a" eq "0") {

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: 30 May 1997 08:21:25 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Why is ("a" == 0) true?
Message-Id: <5mmnp5$no4@flatland.dimensional.com>

adelton@fi.muni.cz (Honza Pazdziora) writes:

> Because the numeric value of the string "a" and the numeric value of
> zero are numerically equal. String is converted to number before doing
> numerical comparison. You probably wanted to do
>
> 	if ("a" eq "0") {

Or perhaps this:

	if (ord("a") == 0) {

-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/


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

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

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