[8637] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2254 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 5 19:07:26 1998

Date: Sun, 5 Apr 98 16:00:27 -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           Sun, 5 Apr 1998     Volume: 8 Number: 2254

Today's topics:
    Re: 5.004.004 won't configure on RH5 gatman@gate.nospam.net
    Re: changing perms w/CHMOD. (Bart Lateur)
    Re: Dummy question <Rosie@dozyrosy.demon.co.uk>
        Emergency Perl Installation Help... <mefe@usa.net>
    Re: Emergency Perl Installation Help... (Jason Gloudon)
    Re: file locking in perl (Matthew Cravit)
    Re: help for a newbie?? <mm93064@central.ntua.gr>
    Re: How to stop cmd Windows Pop-up on NT <d.cottle@csc.canterbury.ac.nz>
    Re: How to stop cmd Windows Pop-up on NT <d.cottle@csc.canterbury.ac.nz>
        JAPH Nasties... <jeffp@command-o.com>
    Re: Memory management issue with ptk (Stephen O. Lidie)
    Re: Position in Toronto & Question <westxga@ptsc.slg.eds.com>
    Re: Position in Toronto & Question (Andre L.)
    Re: Running a CGISite! <matt@whiterabbit.co.uk>
    Re: Running a perl script with root privilges <eugene@vertical.net>
    Re: Someone put my munged e-mail address on a spam list (John Stanley)
        Sorting <judas@interprice.com>
    Re: Sorting <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: Sorting <matt@whiterabbit.co.uk>
        Win32 ODBC error - object not found santon@nu.com
        Win32 ODBC error - object not found santon@nu.com
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 05 Apr 1998 20:22:18 GMT
From: gatman@gate.nospam.net
Subject: Re: 5.004.004 won't configure on RH5
Message-Id: <3527e52e.148714@news.gate.net>

As follows:

Starting w/ clean install of RedHat 5.0.  Perl5.004_01 comes with.
All appears fine.

Using latest_tar perl version. Untarred in /usr dir

sh Configure
Messages: 
=> "Can't compile test program"
=> "The supplied flags may be incorrect with this C compiler."
=>  output of a dozen or so library files shown


Other Notes:
------------------
Linux OS 2.0.32
i586-linux  
CC compiler | GNU 2.7.2.3 => message "Doesn't look like MIPS system"
Checking for optional libraries => "No lsun, lcposix" etc etc
CC - E => "will work"
-02  => "what optimizer"

=> use of all defaults during install.

Thank - Regards
John
gatman@gate.net

>On Sat, 04 Apr 1998 15:55:08 GMT, gatman@gate.nospam.net wrote:
>
>>Compile won't work.  Can't find the fix in perl or Linux on this -
>>Anybody??
>>
>You'd better give us a clue.  The usual problems are due to giving a
>bad answer to a question in Configure (well for me anyhow) however
>without the error message it is pretty hard to give an answer (unless
>ones name is Doris that is). 
>
>/J\
>Jonathan Stowe
>See the MetaFaq at http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm



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

Date: Sun, 05 Apr 1998 18:13:20 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: changing perms w/CHMOD.
Message-Id: <3527b4f5.866332@news.tornado.be>

Larry Rosler wrote:

>This is not sound advice.  The forward-slash directory separator works
>fine using Perl on all platforms.  The back-slash works on some
>platforms only, and requires noise-polluting extra escapes.
>
>Perl is portable, and Perl code should be written portably, too,
>whenever possible.

"All" platforms does not include the Mactintosh. On a Mac, the separator
is ":". A slash is a legal character for a file name.

The safest cross-platform approach would be to declare a global variable
with this value, and use this everywhere.

E.g.	$SEP = '/' # Unix, ":" on Mac

usage:	"$dir$SEP$file"
or:	"$dir${SEP}$file"	#if necessary
	Bart.


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

Date: Sun, 5 Apr 1998 16:31:41 +0100
From: Rosemary I H Powell <Rosie@dozyrosy.demon.co.uk>
Subject: Re: Dummy question
Message-Id: <eZSAOBAdP6J1Ewmi@dozyrosy.demon.co.uk>

In article <6g46la$hc1$1@topsy.kiva.net>, Lobsang <ipc@kiva.net> writes
>I have just begun learning Perl-Win32 (using Perl5 for Dummies).  Because of
>my inexperience, I often get tons of error messages in the DOS window.
>There are so many they run off the screen, and I never have a chance to see
>the beginning.  Is there any way to view the error messages page by page in
>DOS?
>
>Thank you in advance.
>
Go and get yourself a FREE copy of PFE - the  Programmer's File Editor
from  http://www.lancs.ac.uk/people/cpaap/pfe

You can then edit and debug your script "all in one" :-)
>From the menu choose 'Execute DOS Command To Window' to run your Perl
scripts, and the output will be captured and displayed in a scrollable
window. AND, the editor will show you line numbers, so you can go
straight to the source of your problem.

I would not be with out it!

Best wishes, Rosemary
-------------------------------------------------------------------
| Rosemary I.H.Powell  EMail: Home: rosemary@dozyrosy.demon.co.uk |     
|                             Work: r.i.h.powell@rl.ac.uk         |
|                       http://www.netlink.co.uk/users/dozyrosy/  |
|                       http://www.dozyrosy.demon.co.uk/          | 
-------------------------------------------------------------------


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

Date: Sun, 05 Apr 1998 12:32:13 -0700
From: "M.EFE" <mefe@usa.net>
Subject: Emergency Perl Installation Help...
Message-Id: <3527DC3C.C36A5F5B@TTusa.net>

Hello,
I started to install the latest perl on a UNIX server /to a virtual
server.
I accepted almost all defaults and everthing looked fine.
I`ve been promted "Now You Must Run a make"
I did.
After some strange lines-strange to me:)- I got this error:

"doio.c: In function Perl_do_ipcctl:
doio.c:1381: argument #4: incompatible types in argument passing
doio.c:1432: argument #4: incompatible types in argument passing
*** Error code 1

Stop.
"
What should I do?

Any immediate help would be gratefully apreciated...
Sincerely

--
M.EFE_______________________
mailto:mefe@TTusa.net
----------------------------
>>>>! You Must Remove the 'TT'
from my address to Mail Me !<<<<
--------------------------------




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

Date: Sun, 05 Apr 1998 21:53:02 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Emergency Perl Installation Help...
Message-Id: <slrn6ifv4u.jmn.jgloudon@manitoba.bbn.com>

M.EFE <mefe@usa.net> wrote:
 .
 .
 .
>What should I do?

You should give a better description of your problem.
What operating system are you using? "UNIX" is not specific.
What compiler are you using ?
What version of perl are you trying to install ?

-- 
Jason Gloudon


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

Date: 5 Apr 1998 11:11:47 -0700
From: mcravit@shell3.ba.best.com (Matthew Cravit)
Subject: Re: file locking in perl
Message-Id: <6g8hh3$3ri$1@shell3.ba.best.com>

In article <m37m54viud.fsf@windlord.Stanford.EDU>,
Russ Allbery  <rra@stanford.edu> wrote:

>Unix does not, in general, implement mandatory file locking.  That ability
>exists on other platforms (VMS being one of them), but there isn't any

Some versions of UNIX (Solaris and recent versions of Linux, for instance)
do provide mandatory locking, which is set by setting the permission bits
on the file to some specific but otherwise meaningless value which I don't
recall off the top of my head. (Something like "group write and not group
read", but I don't know if that's it).

But you are correct that, in general, file locking on UNIX is advisory and
not mandatory.

/MC


-- 
Matthew Cravit, N9VWG               | Experience is what allows you to
E-mail: mcravit@best.com (home)     | recognize a mistake the second
        mcravit@net.com (work)      | time you make it.


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

Date: 5 Apr 1998 18:27:10 GMT
From: "Manos Tsiavos" <mm93064@central.ntua.gr>
Subject: Re: help for a newbie??
Message-Id: <01bd60c1$2c294a20$55df6693@default>



James Watson <james_vs_watson@yahoo.com> wrote in article
<3526bd9e.79849537@news.erols.com>...


> 
> I think I had a similar problem.  I found out that my server actually
> had an older version of Perl than I needed and not all of the modules
> that I need to use.  Make sure that your server is using the most
> current version of Perl.
> 
> HTH
>  - James
> 
Thank u James for your reply i' ve already done what u say
but nothing happens..



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

Date: Sun, 05 Apr 1998 17:10:35 +1200
From: Dave Cottle <d.cottle@csc.canterbury.ac.nz>
To: Chris Das <cdas@cnd.hp.com>
Subject: Re: How to stop cmd Windows Pop-up on NT
Message-Id: <3527124B.73F4A50A@csc.canterbury.ac.nz>

Chris Das wrote:

> Anyone know how to stop the terminal window pop-ups
> on NT when using the 'system' command?  It is against our
> policy to modify the Perl source so I guess I can create a
> module that does an 'exec' without spawning a shell as Perl
> does.  But I'm hoping someone else already has a better
> solution such as surpressing the window from Perl.
>
> Any help is greatly appreciated.
>
> Thanks,
> Chris Das

A really simple way of doing this (if you don't mind it popping up for
about 5 seconds) is to run something like HIDEWNDW, passing it the
window title. If you want to, you can run your perl proggy from a .cmd
file:

----
@echo off
title The Hidden Perl Proggy
\hidewndw.exe /n /fh "The Hidden Perl Proggy"
perl -w TheHiddenPerlProggy.pl
----
hidewndw is found at (among other places)
 ftp://ftp.winsite.com/pub/pc/win95/desktop/hidewndw.zip
it's freeware.

Cheers, Dave
Learn concepts, not methods - a good mind devises its own methods
-----------------------------------------------------------------
Dave Cottle                         Consultant
Computer Services, Room 205         University of Canterbury
d.cottle@csc.canterbury.ac.nz       Tel. 366 7001 ext. 8319




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

Date: Sun, 05 Apr 1998 17:11:47 +1200
From: Dave Cottle <d.cottle@csc.canterbury.ac.nz>
To: Chris Das <cdas@cnd.hp.com>
Subject: Re: How to stop cmd Windows Pop-up on NT
Message-Id: <35271293.C577CA9@csc.canterbury.ac.nz>

Chris Das wrote:

> Anyone know how to stop the terminal window pop-ups
> on NT when using the 'system' command?  It is against our
> policy to modify the Perl source so I guess I can create a
> module that does an 'exec' without spawning a shell as Perl
> does.  But I'm hoping someone else already has a better
> solution such as surpressing the window from Perl.
>
> Any help is greatly appreciated.
>
> Thanks,
> Chris Das

A really simple way of doing this (if you don't mind it popping up for
about 5 seconds) is to run something like HIDEWNDW, passing it the
window title. If you want to, you can run your perl proggy from a .cmd
file:

----
@echo off
title The Hidden Perl Proggy
\hidewndw.exe /n /fh "The Hidden Perl Proggy"
perl -w TheHiddenPerlProggy.pl
----
hidewndw is found at (among other places)
 ftp://ftp.winsite.com/pub/pc/win95/desktop/hidewndw.zip
it's freeware.

Cheers, Dave
Learn concepts, not methods - a good mind devises its own methods
-----------------------------------------------------------------
Dave Cottle                         Consultant
Computer Services, Room 205         University of Canterbury
d.cottle@csc.canterbury.ac.nz       Tel. 366 7001 ext. 8319




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

Date: Sun, 05 Apr 1998 12:05:35 -0400
From: Jeff Pinyan <jeffp@command-o.com>
Subject: JAPH Nasties...
Message-Id: <3527ABCE.856EBF07@command-o.com>

Does anyone out there have a webpage (or text file, for that matter)
devoted to wonderfully non-intuitive JAPH scripts?  There's one on the
CPAN, but, according to Randal, "it's a historical document" and can't
be changed :)

I'm trying to collect several, and if anyone's interested, I'd like to
receive your text files or scripts.  To simplify things, use the
reply-to: address and make the subject:
	JAPH
plain and simple...

If you'd like to see some of the ones I've come up with, here they are.
Note: the last one gets a warning under -w because I use a deprecated
variable... :)

## NUMBER 1 ## Somewhat comprehensible... 
$-=0;$/=[74,27,1,0,12,-13,20,-89,48,25,5,11,-24,13,-78,8,76,-15,-2,5,5,
-12,18,1,-15,13,-50,34,3,13,-11,-2,9,-64,65,3,-11,-62,5,0,0,-14,42,-9,15,
-8];for(0..$#{$/}){$-+=$/->[$_];print chr($-)};

## NUMBER 2 ## I'll make one to print "Non-intuitive"
$-=sub{chr(shift)};$$=2;$/=$$+$$*($$+$$/$$)/$$;for($$*($$**$/+$/),$$**(++
$/)+$$/$$,$$**$/+$$**($/-$$),(($$++)**($$))**(--$$)+$$+$/){print&{$-}($_)}

## NUMBER 3 ## Get your garbage cans out... this one's a doozy
$$=sub{for(reverse@_){print
chr}};*+=\3;$*=$+-$+/$+;&$$($***($**$+)+$***(
$*+$+)+$**$+**$*,$***($+**$*-$*)-$+**$+,$+**($**$*)+$***($*+$+)-$**$+,$+
**($**$*)+$**$+**($*),$+**($**$*)+$***($*+$*),$***($**$+)+$***$+,$***($+
+$*),$***$**$+**$+,$***($**$+)+$***($*+$+)+$**$+**$*,$***($+**$*-$*)-$+**
$+,$***($**$*)*($***$*+$+-$*),$***($++$*),$***($**$+)+$***($*+$+)+$**$+**
$*,$***($+**$*-$*)-$+**$+,$***$+*($+**$*+$***$*),$+**$+*$***$*+$***$+,$+
**($**$*)+$***($*+$+)-$*,$**($***($+**$*-$+)-$+**$*),$***($**$+)+$+-$*,$*
**($++$*),$+**$+*$***$*+$***$+,$+**$+*($*+$+)-($***$*+$***($**$*)),$+**$*
*($***$++$*+$+),$***($**$+)+$+**$*+$+-$*);


-----
Command-O Software, Software for the Internet (command-o.com)
Jeff Pinyan, Perl Programmer < jeffp@command-o.com >
P.O. Box 12200, Jackson Hole, WY 83002
307.734.1998 P, 307.734.5285 F

ICQ# 10222129
The views expressed in this email are my own, not those of my employer.
-----


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

Date: 5 Apr 1998 20:36:50 GMT
From: lusol@turkey.cc.Lehigh.EDU (Stephen O. Lidie)
Subject: Re: Memory management issue with ptk
Message-Id: <6g8q12$1jmq@fidoii.cc.Lehigh.EDU>

Jason Girard (jxg161@psu.edu) wrote:
: Hi,

: I am relatively new to Perl, and very new to Tk.
: I recently finished writing an application which updates an image based
: on a status taken every 5 minutes (if status changes, image changes;
: otherwise it stays the same).  Also, I'm using bind with a button to
: place another image on the canvas when the mouse is over the button, and
: clears the image when it isn't.

: The problem is, I don't think these images are actually being discarded
: when no longer needed, and my memory usage goes up during each image
: change.

: Here is a snippet which I bind Enter and Leave to the Button $button1;
: $canvas is a Canvas:
: --------------------------------------------------------------------
: $img2 = $canvas->Photo('-format' => 'gif',
:                              '-file'   
: =>                                                            
: Tk->findINC('demos/images/mouseon.gif'));

: $button1->bind('<Enter>' => sub{$canvas->create('image',180,0, 
:                                                '-anchor' => 'nw', 
:                                                '-image' => $img2)});
: $button1->bind('<Leave>' => sub{$img2->blank;
:                              $img2 = $canvas->Photo('-format' => 'gif',
:                                '-file'
: =>                                                            
: Tk->findINC('demos/images/mouseon.gif'))});
: ----------------------------------------------------------------------
: Is there some way of deleting this image object from memory and then
: re-creating it when needed?
: I have tried  $canvas->delete($img2)  but the picture doesn't disappear
: from sight.

You want $img2->delete.

: It looks like  $img2->blank  is clearing the area where the image was,
: but not freeing up memory; I need the line after it to re-fill the
: image.  Since I plan on having this application running most of the
: time, keeping memory usage steady is really important.  Seeing the
: percent memory usage increase by 1-2 percent after a couple image
: updates is alarming.  Any other suggestions for keeping things under
: control?

: Thanks,
: Jason

: -- 
: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
: Jason Girard
: jxg161@psu.edu
: http://www.personal.psu.edu/jxg161/
: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

--
--
Stephen.O.Lidie@Lehigh.EDU
Lehigh University Computing Center, USA


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

Date: Fri, 03 Apr 1998 14:41:16 +0000
From: Glenn West <westxga@ptsc.slg.eds.com>
Subject: Re: Position in Toronto & Question
Message-Id: <3524F50C.5C4D@ptsc.slg.eds.com>

Andre L. wrote:
> 
> Version 1 of Perl was introduced in January 1988 (Perl FAQ 1).
> 
> So, let's see...
> 
> @the_time = localtime(time);
> $max_perl_exper = $the_time[5] - 88;
> print "The most experience a person can have is $max_perl_exper years.\n";
> 
> # 'The most experience a person can have is 10 years.'
> 
> This being said, who wants to go work in Toronto?
> 
> Andre in Montreal 8-)
> 
> --------------------------------------------------------------
> 
> In article <01bd5e4d$cae770e0$e3845ad1@toronto-2>, "nwilson"
> <nwilson@globalserve.net> wrote:
> 
> > My question is how long has Perl been around? What is the most experience
> > in years a person can have?
> >
> >
> > Web developer position available in Toronto Ontario Canada.
> >
> > Perl is the most important skill the major bank is looking for in this full
> > time position. It will be used in a NT UNIX environment.
> > If Perl is your strong skill, please send your resume to

Hummm...www.perl.com indicates that Perl version 1 was born on Dec 18,
1987.

BTW, is that script Y2K compatible? ;)


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

Date: Sun, 05 Apr 1998 16:27:21 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Position in Toronto & Question
Message-Id: <alecler-0504981627210001@dialup-362.hip.cam.org>

In article <3524F50C.5C4D@ptsc.slg.eds.com>, Glenn West
<westxga@ptsc.slg.eds.com> wrote:

> Andre L. wrote:
> > 
> > Version 1 of Perl was introduced in January 1988 (Perl FAQ 1).
> > 
> > So, let's see...
> > 
> > @the_time = localtime(time);
> > $max_perl_exper = $the_time[5] - 88;
> > print "The most experience a person can have is $max_perl_exper years.\n";
> > 
> > # 'The most experience a person can have is 10 years.'
> > 
> > This being said, who wants to go work in Toronto?
> > 
> > Andre in Montreal 8-)
> > 
> > --------------------------------------------------------------
> > 
> > In article <01bd5e4d$cae770e0$e3845ad1@toronto-2>, "nwilson"
> > <nwilson@globalserve.net> wrote:
> > 
> > > My question is how long has Perl been around? What is the most experience
> > > in years a person can have?
> > >
> > >
> > > Web developer position available in Toronto Ontario Canada.
> > >
> > > Perl is the most important skill the major bank is looking for in
this full
> > > time position. It will be used in a NT UNIX environment.
> > > If Perl is your strong skill, please send your resume to
> 
> Hummm...www.perl.com indicates that Perl version 1 was born on Dec 18,
> 1987.
> 
> BTW, is that script Y2K compatible? ;)


As a matter of fact, it is.

In year 2001, the script will produce:
'The most experience a person can have is 13 years.'

That's because $the_time[5] will contain 101, not 1.

Quote perlfaq4:
"The year returned by [gmtime and localtime] when used in an array context
is the year minus 1900. For years between 1910 and 1999 this happens to be
a 2-digit decimal number. To avoid the year 2000 problem simply do not
treat the year as a 2-digit number.  It isn't."

Cheers,
A.L.


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

Date: Sun, 05 Apr 1998 22:14:46 +0100
From: Matt Pryor <matt@whiterabbit.co.uk>
To: TheTool <hobbezz@hotmail.com>
Subject: Re: Running a CGISite!
Message-Id: <3527F446.1ECFAB14@whiterabbit.co.uk>

TheTool wrote:

> we would name the files in some sort of consecutive order, like
> f00001.html, f00002.html and so on.....then we could just reference the file.  Is this good, bad, etc?

Yes, you could have a list of files arranged numerically and then a CGI
application which loads the contents and then prints the header and
footer around them.

> What about Forms?  How difficult is it to retrieve information from a
> FORM in an HTML file without Using CGI.PM?

It's very very easy!

If the form is sent to the gateway using "POST", it is stored in an
input stream sent to the server.  If you use "GET", it's even simpler as
its stored in the $ENV{"QUERY_STRING"} environment variable, ie anything
after the ? in the URL.  All you then need to do is split the variable
by ampersands like this:

@values = split (/&/,$querystring);

And then the individual bits by '='.

The mouse book covers this quite extensively.
So do the newsgroups devoted to CGI programming.

- 
Best Wishes

Matt Pryor
White Rabbit Promotions


http://www.whiterabbit.co.uk/design today!


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

Date: Sun, 05 Apr 1998 13:12:23 -0500
From: Eugene Sotirescu <eugene@vertical.net>
Subject: Re: Running a perl script with root privilges
Message-Id: <3527C986.77DAF9BF@vertical.net>

When you try to tun a suid script, Perl automatically turns on tainting. If
there is anything in your script that's insecure, Perl won't let you run it.

See perlsec for details.

Eugene

Crispin Tschirky wrote:

> I don't know if this is the right group for my posting.
> I have the problem that i should run a perlscript with root privilges from
> an unprivilged user (wwwrun  I know this is a potential security hole....).
> I tried to run it with the owner set to root and then set the filemode s
> (chmod u+s blabla) but while starting the script I always got the error:
> Can't do setuid.
> Does anyone have an idea how to manage this?
>
> Crispin





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

Date: 5 Apr 1998 19:24:17 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Someone put my munged e-mail address on a spam list
Message-Id: <6g8lp1$lgq$1@news.orst.edu>

In article <891745049.416216@cabal>,
? the platypus {aka David Formosa}  <dformosa@st.nepean.uws.edu.au> wrote:
>>The "culture" works just fine without mail.
>
>Even the bit that says "If your post is not of general intrest you should
>mail your reply to the author?"

Find a dictionary. Look up the word "should". Then look up the word
"must". Figure out the difference. Then look up "need" and "want".
Compare those two definitions. 

>>Nonsense. If it were such a mandatory part of the process, then news
>>systems would have always enforced authentication of From: headers.
>
>The forced authentication was not done because it was considered two hard,

It was considered not worth the effort. If it isn't worth the effort, it
is hard to claim now that it is a "need".

>anyway everybody on the network was honest so why should we bother?

Because YOU claim that it is necessary for the "culture". If it is
necessary, it is necessary. 



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

Date: Sun, 5 Apr 1998 12:18:15 -0700
From: "Dan Serban" <judas@interprice.com>
Subject: Sorting
Message-Id: <6g8ld4$9ht$1@news.junction.net>

I have posted previously about number sorting in a human readable form.
While I do not claim to be a whiz at Perl I do know about programming.  The
problem here is understanding the syntax (I'm learning).  While I've done
number sorting before, I seem to have trouble with it in Perl.  I am
modifying Selena Sol's Database Manager script to output decimal based
numbers (floats - they're probably irrelevant in Perl), what I need the
script to do is sort each row based on these numbers but they have to be
sorted as humans do ... lowest to highest or vice versa.  Has anyone had any
experience with this script at all?

I'm a little shaky on the notations of variables and arrays, but one kludgy
kind of way that I could try is to store the numbers in zero-padded format
for them to be sorted automatically.  But this poses another problem, I
don't know what commands to use to zero-pad these numbers when they're
entered and to strip the zeros when displayed.

eg.

247.12 needs to be 000247.12 and when displayed again, needs to revert back
to non zero padded form - 247.12.

While these may seem like stupid questions, I'm having trouble downloading
the Perl documentation from perl.com and the activestate site keeps it all
in HTML (non-downloadable) format.

Thanks for any help you can provide.

judas@interprice.com
http://www.interprice.com





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

Date: 05 Apr 1998 22:14:25 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Sorting
Message-Id: <7xsonsgh5q.fsf@fidelio.vcpc.univie.ac.at>

Re: Sorting, Dan <judas@interprice.com> said:

Dan> I have posted previously about number sorting in a
Dan> human readable form.

I don't see the difference but anyways...

Dan> at Perl I do know about programming.  The problem here
Dan> is understanding the syntax (I'm learning).  While I've

OK.  Post some perl code that attempts to do what you want.

Show some sample data, the intended output, and the actual
output from the perl.

Then someone can tell you where the problem is.

Dan> but they have to be sorted as humans do ... lowest to
Dan> highest or vice versa.

??

Dan> be sorted automatically.  But this poses another
Dan> problem, I don't know what commands to use to zero-pad
Dan> these numbers when they're entered and to strip the
Dan> zeros when displayed.

You seem to be rather confused about what numbers are and
what numerals are.

Dan> perl.com and the activestate site keeps it all in HTML
Dan> (non-downloadable) format.

If HTML is non-downloadable how do you read it in a
browser? :-)

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,      | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/

"Everything I am, I learned on the back of cereal boxes" ~ RJ, "Over the Hedge"


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

Date: Sun, 05 Apr 1998 21:42:51 +0100
From: Matt Pryor <matt@whiterabbit.co.uk>
To: Dan Serban <judas@interprice.com>
Subject: Re: Sorting
Message-Id: <3527ECCB.110C0FDF@whiterabbit.co.uk>

The logical thing to do would be to write a subroutine like this:

sub by_number {
	if ($a<$b) {
		return -1;
	}elsif ($a == $b) {
		return 0;
	}elsif ($a > $b) {
		return 1;
	}
}

and then call it like this:

#for example here's your number list;
@list = (1,4.8,3.99,0.28,4.3,104.5);
@rightlist = sort by_number @wronglist;

This numberic comparison is used so often in perl that there's a special
function to abbreviate it:

sub by_number {
	$a <=> $b;
}

Or you could even do away with the subroutine altogether, like this

@rightlist = sort {$a <=> $b} @list;

Which you use is a matter of preference.  The subroutine method makes it
a little more humanized.

-- 
Best Wishes

Matt Pryor
White Rabbit Promotions


Visit us at http://www.whiterabbit.co.uk/design today!


Dan Serban wrote:
> 
> I have posted previously about number sorting in a human readable form.
> While I do not claim to be a whiz at Perl I do know about programming. 
 ........chop


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

Date: Sun, 05 Apr 1998 17:26:14 -0600
From: santon@nu.com
Subject: Win32 ODBC error - object not found
Message-Id: <6g90e6$fg0$1@nnrp1.dejanews.com>





I've installed this version of Perl for Win32;

        Win32 port Copyright (c) 1995-1996 Microsoft Corporation.
                All rights reserved.
        Developed by ActiveWare Internet Corp., http://www.ActiveWare.com

Perl for Win32 Build 316 - Built 09:44:44 Mar 13 1998

This is perl, version 5.003_07

Copyright 1987-1996, Larry Wall

        + suidperl security patch
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.

I've done this (had to create the lib\site\auto\Win32\ODBC\ directories).

    - Rename the binary file according and copy it to the correct directory
      as shown in the following table:

      File Name              Rename to  then  Copy into directory:
      --------------------   ---------        -------------------------
      970208-3xx.pll         ODBC.pll         lib\auto\win32\odbc\
      970208-core.dll        ODBC.dll         lib\site\auto\Win32\ODBC\



I'm using this script:

use Win32::ODBC;
$DSN = "component_stuff";
print "Connecting to ".$DSN."\n";
if (!($db = new Win32::OBDC($DSN))) {
   print "Error connecting to $DSN\n";
   print "Error:  " . Win32::ODBC::Error()."\n";
   exit;
}
exit;


And I get this error:

Can't locate object method "new" via package "Win32::ODBC" at test.pl line 4.

I've setup the DSN etc.  I temporarily renamed ODBC.PM to ensure it is the
module being used, and it is.  What am I missing?


Thanks,
ns

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sun, 05 Apr 1998 17:25:10 -0600
From: santon@nu.com
Subject: Win32 ODBC error - object not found
Message-Id: <6g90cn$f2v$1@nnrp1.dejanews.com>





I've installed this version of Perl for Win32;

        Win32 port Copyright (c) 1995-1996 Microsoft Corporation.
                All rights reserved.
        Developed by ActiveWare Internet Corp., http://www.ActiveWare.com

Perl for Win32 Build 316 - Built 09:44:44 Mar 13 1998

This is perl, version 5.003_07

Copyright 1987-1996, Larry Wall

        + suidperl security patch
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5.0 source kit.

I've done this (had to create the lib\site\auto\Win32\ODBC\ directories).

    - Rename the binary file according and copy it to the correct directory
      as shown in the following table:

      File Name              Rename to  then  Copy into directory:
      --------------------   ---------        -------------------------
      970208-3xx.pll         ODBC.pll         lib\auto\win32\odbc\
      970208-core.dll        ODBC.dll         lib\site\auto\Win32\ODBC\



I'm using this script:

use Win32::ODBC;
$DSN = "component_stuff";
print "Connecting to ".$DSN."\n";
if (!($db = new Win32::OBDC($DSN))) {
   print "Error connecting to $DSN\n";
   print "Error:  " . Win32::ODBC::Error()."\n";
   exit;
}
exit;


And I get this error:

Can't locate object method "new" via package "Win32::ODBC" at test.pl line 4.

I've setup the DSN etc.  I temporarily renamed ODBC.PM to ensure it is the
module being used, and it is.  What am I missing?


Thanks,
ns

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

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

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