[16114] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3526 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 30 18:05:38 2000

Date: Fri, 30 Jun 2000 15:05:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <962402716-v9-i3526@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 30 Jun 2000     Volume: 9 Number: 3526

Today's topics:
    Re: a large amount of unique numbers in an efficient wa <arnet@hpcvplnx.cv.hp.com>
        Best way of.. <tom@officedevil.co.uk>
    Re: Best way of.. <tina@streetmail.com>
    Re: Best way of.. <tom@officedevil.co.uk>
    Re: CGI script error <tina@streetmail.com>
    Re: change in precedence from 5.00503 -> 5.6.0 ? (Neil Kandalgaonkar)
        DBD::Oracle and &DBI::fetchrow_hashref <pastorem@mediaone.net>
    Re: DBD::Oracle and &DBI::fetchrow_hashref (John D Groenveld)
    Re: dbi oracle Select example (John D Groenveld)
    Re: Finding FatalsToEmail ? <tina@streetmail.com>
        Fun with typos. <y-o-y@home.com>
    Re: Golf problem (Craig Berry)
        Help beginner with CGI.pm please lliacopo8088@my-deja.com
    Re: Help beginner with CGI.pm please <tina@streetmail.com>
    Re: Help beginner with CGI.pm please <makarand_kulkarni@My-Deja.com>
    Re: Help beginner with CGI.pm please lliacopo8088@my-deja.com
    Re: Help beginner with CGI.pm please lliacopo8088@my-deja.com
    Re: Help with hashes (Tad McClellan)
    Re: Help with hashes (Tad McClellan)
    Re: Help with hashes (Andrew Johnson)
        help!! <noreturn@email.com>
        how to read STDERR from an ext cmd ken_ross@my-deja.com
    Re: interpreting system() returned numbers zephar@my-deja.com
    Re: Looking for the comp.lang.perl.misc FAQ (Jon Bell)
        Need to POST file from VC++ and process with Unix pl/cg <matt@mixman.com>
    Re: Net::FTP not on CPAN <jsdNOjsSPAM@gamespot.com.invalid>
        Newbie question: Sorting a list-of-hashes <dr_retribution@hotmail.com>
    Re: Newbie question: Sorting a list-of-hashes <stephen.kloder@gtri.gatech.edu>
        Read multiple lines as one <gpitman@nb.net>
    Re: referencing with cgi <makarand_kulkarni@My-Deja.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 30 Jun 2000 21:26:50 GMT
From: <arnet@hpcvplnx.cv.hp.com>
Subject: Re: a large amount of unique numbers in an efficient way?
Message-Id: <8jj3aq$etk$1@hpcvnews.cv.hp.com>

In comp.lang.perl Abigail <abigail@delanet.com> wrote:

> It's elementary. A beginners assignment.

Hmph!  You didn't need to rub it in! ;-)

I was so stuck on thinking about the first approach I missed this.
Hell, I *used* this algorithm to generate poker hand in a program I
did in college, several millenia ago.

Past 40, the brain cells go fast...

--arne

DISCLAIMER:  These opinions and statements are those of the author and
do not represent any views or positions of the Hewlett-Packard Co.

>     # Select $amount unique values between $min and $max (inclusive).
>     sub sel {
>         my ($min, $max, $amount) = @_;

>         die "Impossible" if $amount > $max - $min + 1;

>         my @results;
>     
>         my $last = $max;
>         my %map;
>         for (1 .. $amount) {
>             my $rand = $min + int rand ($last - $min + 1);
>             push @results => exists $map {$rand} ? $map {$rand} : $rand;
>             $map {$rand}  =  exists $map {$last} ? $map {$last} : $last;
>             $last --;
>         }

>         @results
>     }


> (This is just a Fisher Yates shuffle in disguise)


> Abigail
> -- 
> perl -wle '(1 x $_) !~ /^(11+)\1+$/ && print while ++ $_'


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

Date: Fri, 30 Jun 2000 19:58:11 +0100
From: "Tom" <tom@officedevil.co.uk>
Subject: Best way of..
Message-Id: <395cee47$1@news.jakinternet.co.uk>

Hi!

In some directorys I store a lot of data files (member information) which
are access, read and edit quite a though times during the day.  At the
moment I am using a .txt file - which was ok, up to know when the amount of
files are increasing daily.

What is the best method to use for this - and I need to make back-ups on
every other day.

Any ideas?  Thanks!

Tom
tom@officedevil.co.uk






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

Date: 30 Jun 2000 19:22:39 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Best way of..
Message-Id: <8jis1v$kpir$5@ID-24002.news.cis.dfn.de>

hi,
Tom <tom@officedevil.co.uk> wrote:

> In some directorys I store a lot of data files (member information) which
> are access, read and edit quite a though times during the day.  At the
> moment I am using a .txt file - which was ok, up to know when the amount of
> files are increasing daily.

tina@syracus:~ > perldoc -q database
=head1 Found in /usr/lib/perl5/5.00503/pod/perlfaq8.pod

=head2 How do I use an SQL database?

There are a number of excellent interfaces to SQL databases.  See the
DBD::* modules available from
http://www.perl.com/CPAN/modules/dbperl/DBD .
A lot of information on this can be found at 
http://www.hermetica.com/technologia/perl/DBI/index.html .


tina


-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \ _,_\ __/\ __/_| /__/ perception
"The Software required Win98 or better, so I installed Linux."


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

Date: Fri, 30 Jun 2000 20:23:45 +0100
From: "Tom" <tom@officedevil.co.uk>
Subject: Re: Best way of..
Message-Id: <395cf445@news.jakinternet.co.uk>

Sorry, thought to mention I am running Linux, and the editing of the files
are done by perl.


>Hi!
>
>In some directorys I store a lot of data files (member information) which
>are access, read and edit quite a though times during the day.  At the
>moment I am using a .txt file - which was ok, up to know when the amount of
>files are increasing daily.
>
>What is the best method to use for this - and I need to make back-ups on
>every other day.
>
>Any ideas?  Thanks!
>
>Tom
>tom@officedevil.co.uk
>
>
>
>




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

Date: 30 Jun 2000 18:22:37 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: CGI script error
Message-Id: <8jioh9$kpir$2@ID-24002.news.cis.dfn.de>

hi,
Troy <Troyp@nospamwn.com.au> wrote:
> I was wondering if someone could help me with a cgi script?

please do *not* post your whole script! post that part of
the script which causes the error.

and please set the column length of your newsreader to
something about 70-80 characters.

>  Error: Can't open CSV file. 
> Please, check that you have provided the cgi script with correct CSV file
> path in the HTML form.

so, what does this error message tell us? right,
perl couldn't open the file. so something must
be wrong with the filename, probably it doesn't
exist.

>  I am not quite sure what this error message refers to. Does it refer to the following line in my form.html 

>  <Input type="hidden"name="file"value="http://load-search.netfirms.com/www/data.csv">

right, good guess. well,
http://load-search.netfirms.com/www/data.csv
is not a filename. how should perl open a file from an
URL (from maybe a different server)? not with open().
but take a look at the LWP modules.

>  If so I cant see where the error is as that is the exact path to my data.csv file. I have tried changing it around so the path is just /www/data.csv but it still wont work.

is that the absolute path to the file?

tina


-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \ _,_\ __/\ __/_| /__/ perception
"The Software required Win98 or better, so I installed Linux."


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

Date: Fri, 30 Jun 2000 21:17:53 GMT
From: neil@brevity.org (Neil Kandalgaonkar)
Subject: Re: change in precedence from 5.00503 -> 5.6.0 ?
Message-Id: <8jj2di$fcm$1@localhost.localdomain>

In article <slrn8lp27u.q62.garcia_suarez@rafael.kazibao.net>,
Rafael Garcia-Suarez <garcia_suarez@hotmail.com> wrote:

>    + C<not> followed by parentheses behaves like a list operator.  This

Ok, clearly I am totally blind because there is a HUGE perldelta entry
about this change... 'Parenthesized not() behaves like a list operator'

Or Sarathy broke into my computer last night to fix it. Clever guy.

-- 
Neil Kandalgaonkar <neil@brevity.org>


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

Date: Fri, 30 Jun 2000 18:57:33 GMT
From: Mike Pastore <pastorem@mediaone.net>
Subject: DBD::Oracle and &DBI::fetchrow_hashref
Message-Id: <x4675.558$aP6.15815267@elnws01>

I'm using DBD::Oracle with a database on a remote server. Everything 
is working just fine and dandy, except when I try to use fetchrow_hashref. i
Oracle returns uppercased field names. Is there any way to get around this?

I am not the DBA but I can ask him questions if you need more info.

Thanks in advance,

Mike Pastore
pastorem@mediaone.net



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

Date: 30 Jun 2000 16:41:22 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: DBD::Oracle and &DBI::fetchrow_hashref
Message-Id: <8jj0li$388$1@grolsch.cse.psu.edu>

You use Perl and you're super empowered! You don't need the DBA
to run perldoc DBI and read about the name parameter to
fetchrow_hashref.
John
groenveld@acm.org


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

Date: 30 Jun 2000 16:36:06 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: dbi oracle Select example
Message-Id: <8jj0bm$37i$1@grolsch.cse.psu.edu>

In article <39582F47.92315125@SPIRITONE.COM>,
Robert  <greendot@SPIRITONE.COM> wrote:
>I don't have the docs dbi or the language.  I'm trying to decide if Perl is
>the language I want to go with.  Is there somewhere I can download the docs
>from?

http://www.symbolstone.org/technology/perl/DBI/
John
groenveld@acm.org


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

Date: 30 Jun 2000 18:39:11 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Finding FatalsToEmail ?
Message-Id: <8jipge$kpir$3@ID-24002.news.cis.dfn.de>

hi,

Jukka Juslin <jtjuslin@kosh.hut.fi> wrote:


> I heard from Randal L. Schwarz about FatalsToEmail, but could not find it
> with altavista or google. Where can I get such a thing?

> I guess it's a close relative to the:
> use CGI::Carp qw(fatalstoBrowser);
 
i've never heard of that fatalsToEmail.
you should take a look at 
perldoc CGI::Carp
you can use the carpout() function to write
errors to a filehandle which can be a
pipe to an email program, too.

tina



-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \ _,_\ __/\ __/_| /__/ perception
"The Software required Win98 or better, so I installed Linux."


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

Date: Fri, 30 Jun 2000 18:24:18 GMT
From: Andy <y-o-y@home.com>
Subject: Fun with typos.
Message-Id: <mB575.24483$A%3.282728@news1.rdc2.pa.home.com>

Here was a fun one to tweak my org. line. Smiel!

srand;
@words = ("Monkeys,","Typewriters","and","Time","Literary","Group");
$arrayrand = int (rand (@words));
$wordlength = length (@words[$arrayrand]);
$charrand = int (rand($wordlength-1));
$swap = reverse ($twochars = substr( @words[$arrayrand],$charrand,2));
substr (@words[$arrayrand],$charrand,2) = $swap;
print "@words\n";


The next version will optionally replace a character with others within 
close proximity of it's keyboard location.

TGFI!

Andy


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

Date: Fri, 30 Jun 2000 19:14:10 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Golf problem
Message-Id: <slpsc2knjev138@corp.supernews.com>

Neil Kandalgaonkar (neil@brevity.org) wrote:
: In article <slnta6pmjev21@corp.supernews.com>,
: Craig Berry <cberry@cinenet.net> wrote:
: >Peter Marksteiner (hump@katz.cc.univie.ac.at) wrote:
: >: Suppose you want to find words with exactly ten non-repeating letters such
: >: as "binoculars", "fishmonger", or "paintbrush", suitable for games or simple 
: >: encryption of numbers where every decimal digit is represented by a letter.
: >
: >  perl -pe 'length==11&&!/(.).*\1/ or$_=""' /usr/dict/words
: 
: Slightly shorter:
: 
:    perl -ne '/^(?!.*(.).*\1).{10}$/&&print' /usr/dict/words

Ah, nice...I'd rejected using $-anchoring because of the before-or-after
\n problem, forgetting that . not matching \n would take care of this.

Slightly further optimized version of my original:

     perl -ne '11-length||/(.).*\1/||print' /usr/dict/words

: This one isn't shorter, but I found it interesting:
: 
:    perl -F// -ape 'my%F;$_=""if@F!=10||(@F{@F}=@F)!=keys%F' /usr/dict/words

Wow, kinky.

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Beauty and strength, leaping laughter and delicious
   |   languor, force and fire, are of us." - Liber AL II:20


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

Date: Fri, 30 Jun 2000 18:52:40 GMT
From: lliacopo8088@my-deja.com
Subject: Help beginner with CGI.pm please
Message-Id: <8jiq9f$m6g$1@nnrp1.deja.com>

Hi,

I am beginning to use CGI.pm and have some confusion regarding:

if (!$q->param()) {
    # error missing parameters
} else {
    # continue processing form
}


I thought that $q->param() could be used to verify if all fields of
the form were filled out or left blank, but it seems not. I was
hoping for a quick way to ensure the whole form was completed. Can
someone clarify this please?

thanks


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 30 Jun 2000 19:19:20 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Help beginner with CGI.pm please
Message-Id: <8jirrn$kpir$4@ID-24002.news.cis.dfn.de>

hi,
lliacopo8088@my-deja.com wrote:

> if (!$q->param()) {
>     # error missing parameters
> } else {
>     # continue processing form
> }


> I thought that $q->param() could be used to verify if all fields of
> the form were filled out or left blank, but it seems not. I was
> hoping for a quick way to ensure the whole form was completed. Can
> someone clarify this please?

perldoc CGI

FETCHING THE NAMES OF ALL THE PARAMETERS PASSED TO YOUR
       SCRIPT:


            @names = $query->param

       If the script was invoked with a parameter list (e.g.
       "name1=value1&name2=value2&name3=value3"), the param()
       method will return the parameter names as a list.

you cannot make sure that every field was filled
out because the script doesn't know anything about
the htmlform. if a field isn't filled out, the
script doesn't get data from it.

only if the script know the fields you can then
test every field with 
$query->param('field')

tina


-- 
http://tinita.de    \  enter__| |__the___ _ _ ___
tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
search & add comments \    \ _,_\ __/\ __/_| /__/ perception
"The Software required Win98 or better, so I installed Linux."


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

Date: Fri, 30 Jun 2000 13:46:36 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: Help beginner with CGI.pm please
Message-Id: <395D072C.8947CCEE@My-Deja.com>

if ( $q->param() )
will be true if the script was invoked as a 
result of HTML form submission action. The
only way to find if the user of the HTML
did indeed fill out all the fields is to
do the check yourself. Alternatively, you coud
have javascript checks done on the browser side.
-


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

Date: Fri, 30 Jun 2000 21:35:51 GMT
From: lliacopo8088@my-deja.com
Subject: Re: Help beginner with CGI.pm please
Message-Id: <8jj3rl$tn0$1@nnrp1.deja.com>

Thanks all!

It's a shame that there is no quick way to check that all fields were
completed though because you basically cannot have a generic script for
multiple cgi applications. Seems client side checking with javascript
is the way to go so that when the cgi script is launched it is taken
for granted that form is completely filled out.

In article <395D072C.8947CCEE@My-Deja.com>,
  Makarand Kulkarni <makarand_kulkarni@My-Deja.com> wrote:
> if ( $q->param() )
> will be true if the script was invoked as a
> result of HTML form submission action. The
> only way to find if the user of the HTML
> did indeed fill out all the fields is to
> do the check yourself. Alternatively, you coud
> have javascript checks done on the browser side.
> -
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 30 Jun 2000 21:42:47 GMT
From: lliacopo8088@my-deja.com
Subject: Re: Help beginner with CGI.pm please
Message-Id: <8jj48k$u1v$1@nnrp1.deja.com>

You could fetch all the names into an array and loop through testing
something like $q->param($name[$i]) to see if it's a null string "".
However this does not work with all form constructs (checkbox radio
select-multiple). It seems to only work with textfield and textarea.

Can such a generic script be built??


In article <8jirrn$kpir$4@ID-24002.news.cis.dfn.de>,
  news@tinita.de wrote:
> hi,
> lliacopo8088@my-deja.com wrote:
>
> > if (!$q->param()) {
> >     # error missing parameters
> > } else {
> >     # continue processing form
> > }
>
> > I thought that $q->param() could be used to verify if all fields of
> > the form were filled out or left blank, but it seems not. I was
> > hoping for a quick way to ensure the whole form was completed. Can
> > someone clarify this please?
>
> perldoc CGI
>
> FETCHING THE NAMES OF ALL THE PARAMETERS PASSED TO YOUR
>        SCRIPT:
>
>             @names = $query->param
>
>        If the script was invoked with a parameter list (e.g.
>        "name1=value1&name2=value2&name3=value3"), the param()
>        method will return the parameter names as a list.
>
> you cannot make sure that every field was filled
> out because the script doesn't know anything about
> the htmlform. if a field isn't filled out, the
> script doesn't get data from it.
>
> only if the script know the fields you can then
> test every field with
> $query->param('field')
>
> tina
>
> --
> http://tinita.de    \  enter__| |__the___ _ _ ___
> tina's moviedatabase \     / _` / _ \/ _ \ '_(_-< of
> search & add comments \    \ _,_\ __/\ __/_| /__/ perception
> "The Software required Win98 or better, so I installed Linux."
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 30 Jun 2000 12:07:47 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Help with hashes
Message-Id: <slrn8lphej.6hs.tadmc@magna.metronet.com>

On Fri, 30 Jun 2000 08:23:14 -0600, Colby Hansen <cghansen@micron.com> wrote:
>>Do you claim that it is not a waste of time to review code
>>that does not exist?
>
>>I am not getting your point.
>
>I assure you the code does exist


_Your_ code existed, I can give you that.

But we did not see _your_ code!

We saw the code that was posted (which does not exist anywhere
but in the article).

If you had posted your code, there would not have been syntax errors.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 30 Jun 2000 14:34:48 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Help with hashes
Message-Id: <slrn8lpq28.6pl.tadmc@magna.metronet.com>

On Fri, 30 Jun 2000 16:50:52 GMT, Andrew Johnson <andrew-johnson@home.com> wrote:
>In article <8jiagj$3i0$1@admin-srv3.micron.com>,
> Colby Hansen <cghansen@micron.com> wrote:
>[snip] 
>> I assure you the code does exist and it did when I posted my original
>> message.  My point is that so what if I made two typos...  my question was
>> answered, my code works now, and I even learned some things

>You are right, that isn't the point -- nor was it Tad's point.

>I certainly do not think his response was
>offensive, nor intended to be offensive -- just a Tad smart-ass :-)


That part was perhaps a bit too subtle, sorry for those that
missed it.

I claimed he'd get smart-ass answers, so by being smart-ass
in the same post where I made the claim, I pretty much
guaranteed that what I claimed was true!

A circular reference CYA kind of thing.

Sorry for not being more blunt.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 30 Jun 2000 20:40:58 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Help with hashes
Message-Id: <uB775.2494$k5.51578@news1.rdc1.mb.home.com>

In article <slrn8lpq28.6pl.tadmc@magna.metronet.com>,
 Tad McClellan <tadmc@metronet.com> wrote:
[snip] 
> >I certainly do not think his response was
> >offensive, nor intended to be offensive -- just a Tad smart-ass :-)
> 
> 
> That part was perhaps a bit too subtle, sorry for those that
> missed it.

But subtlety is a natural hazard on the Perl course -- and hazards
are part of the fun of playing. Leave the twists and hazards in the
fairways -- occassionally some people will lose their balls (so to
speak). But whether they walk away mad (never to play again), take up
indoor golf (python -- always get your balls back), or just go and
get more balls and keep playing, is not something we can really help
and still keep the course interesting enough so that veterans still
drop in to play a hole or three.

andrew

-- 
Andrew L. Johnson   http://members.home.net/andrew-johnson/
      But puzzles in programming are what make it challenging and fun
      sometimes... you always end up learning one more way not to do
      something each time.  -- Brad Fenwick


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

Date: Fri, 30 Jun 2000 14:39:42 -0400
From: "wckf" <noreturn@email.com>
Subject: help!!
Message-Id: <8jipuk$3av$1@bob.news.rcn.net>

Ok.. i have a problem running Perl on an NT server.
i'm using a form script.. and whenever i try to submit the form,
it always asks me if i want to download the script first.  why is
it doing that and how can i fix it?

also.. when the form is viewed from any other machine, after the
submit butten is hit my perl script pops up in a text editor.
now usually this happens if the first line of the script isn't pointing
to where perl is located, but it is; "C:\perl".
any suggestions on either of these two issues is appreciated!
thanks in advance!!

-Tyler




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

Date: Fri, 30 Jun 2000 20:57:05 GMT
From: ken_ross@my-deja.com
Subject: how to read STDERR from an ext cmd
Message-Id: <8jj1in$ru6$1@nnrp1.deja.com>

Perlfaq8 answers the question, "How can I capture STDERR from an
external command?"  I have a related problem, which is my coworker is
able to read standard error from an external command WITHOUT using
"2>&1", yet I have to use it.  Her statement, which is in a .pm module,
is:

  open LOGIN_REC, "ftp -n <<INLINE\n$ftp_cmd\nINLINE |";  #her code

This does not work for me.  To get this to work, I have to use
redirection:

   open LOGIN_REC, "2>&1 ftp -n <<INLINE\n$ftp_cmd\nINLINE |";  #my code

When she tried my code and then reverted back to hers, all of a sudden
she was unable to read standard error.  Then she did something - we
don't know what - which caused her code to be able to read standard
error again without the redirection, as if by magic.  Does anyone have
an idea of what may be going on?  We have other .pm modules that also
work without the redirection command.

Thank you!
Ken Ross


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 30 Jun 2000 20:47:20 GMT
From: zephar@my-deja.com
Subject: Re: interpreting system() returned numbers
Message-Id: <8jj10h$rfb$1@nnrp1.deja.com>

In article <8jfpk9$7h9$1@internal-news.uu.net>,
  newsposter@cthulhu.demon.nl wrote:
> dbottoms98@my-deja.com wrote:
> > Hello,
>
> > Does anyone know where to find info on the numbers returned from the
> > system() command in Perl.  I know it says to divide by 256 but what
do
> > those numbers mean??  Thanks
>
> Check the documentation of the programs you run with system. On unix
> systems the manual pages seem to have some information about exit
> status and what it means.
>
> eg: from yacc's manual page:
>
> EXIT STATUS
>      The following exit values are returned:
>
>      0         Successful completion.
>
>      >0        An error occurred.
>
>

From variuous Unix sources I got this info...
I have used it successfully....

sub AnalyseSystemRv {
  my $rc = shift(@_);
  my $original_rc = $rc;
  my $outstr = "";

  if ($rc == 0) {
    $outstr = sprintf("Original Return_Code = [%s], Normal exit %#04x:
", $original_rc, $rc);
    }
  elsif ($rc == 0xff00) {
    $outstr = sprintf("Original Return_Code = [%s], Command failed errno
= [%s], rc = 0xff",$original_rc,$!);
    }
  elsif ($rc > 0x80) {
    $rc >>= 8;
    $outstr = sprintf("Original Return_Code = [%s], ran with non-zero
status of [%d]",$original_rc,$rc);
    }
  else {
    if ($rc & 0x80) {
      $rc &= ~0x80;
      $outstr = sprintf("coredump ");
      }
    $outstr .= sprintf("Original Return_Code = [%s], %s signal
%d\n",$original_rc, $outstr, $rc);
    }

  return ( $outstr );
  } # end sub analyse_system_rc

Have fun,

Jim


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Fri, 30 Jun 2000 18:54:31 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: Looking for the comp.lang.perl.misc FAQ
Message-Id: <FwzDuv.HMI@presby.edu>

In article <slrn8lpft3.696.tadmc@magna.metronet.com>,
Tad McClellan <tadmc@metronet.com> wrote:
>
>The rules of netiquette are generally applicable to nearly all
>Big 8 newsgroups, so there is not a specific set of netiquette 
>rules for this particular newsgroup.
>
>Seeing the regular postings on
>
>   news.announce.newusers
>
>ought to be enough.

Except that the moderator of news.announce.newusers has apparently been
AWOL since the beginning of the year.  The only postings there have been
crossposted (and approved) from other moderated groups such as
news.announce.newgroups.

-- 
Jon Bell <jtbell@presby.edu>                        Presbyterian College
Dept. of Physics and Computer Science        Clinton, South Carolina USA
[ Questions about newsgroups?  Visit http://www.geocities.com/nnqweb/  ]
[                or ask in news:news.newusers.questions                ]


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

Date: Fri, 30 Jun 2000 12:10:12 -0700
From: Matthew C Camuto <matt@mixman.com>
Subject: Need to POST file from VC++ and process with Unix pl/cgi script
Message-Id: <395CF093.A3A1E88A@mixman.com>

Hi.

This problem is multi disciplined.

I need to simply Upload a file to a web server using a Visual C++ app
and then copy the file to a perm home on the server. It seems like this
should be easy... it is not for me..

I can get the code using the WinInet functions in visual studio
but I don't understand on the server side what I need to do to
"intercept" the stream of data that is coming in!!??

To me it should be as simple as opening up an InternetFile on
the client side.. sending the data over and then processing
the data in the server side.. Unfortunately the data does not come in
into the perl script as stdin or that would be easy..

Does anybody have a simple solution to do this.. Tons of apps do this
so it should not be a problem hopefully..

Any help/pointers to both client and server side solns would be
great.. Possibly a perl module is needed?? I would be more then
willing to send anybody the small source code I have but did
not want to include it here due to length..

Please CC me at matt@mixman.com

Thanks in advance for any help on any aspect of the problem





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

Date: Fri, 30 Jun 2000 11:36:56 -0700
From: jsd <jsdNOjsSPAM@gamespot.com.invalid>
Subject: Re: Net::FTP not on CPAN
Message-Id: <0342dd6c.4a5b2d59@usw-ex0104-026.remarq.com>

Elaine Ashton <elaine@chaos.wustl.edu> wrote:
>Hmmm. What part of
>http://search.cpan.org/search?mode=module&query=Net%3A%3AFtp
>is easy to miss? What were you expecting and what about the
result from
>above was misleading? The line '6 modules found in 1
distribution matching
>'Net::Ftp' ' and the highlighting should be giving people a
really easy way
>to find their way, but if it isn't then what would you suggest?

although i have been using perl and modules extensively for
years now, i have never looked at the web site at all.  usually
i use the CPAN shell or i just go straight to an ftp site and
grab the file i want.

i found the link listed above extremely confusing.  if i didn't
know what i was looking for, there is no way i would have been
able to find it from the results page.

the link to the libnet bundle should be highlighted in a
different color than the regular text.  i'd also suggest putting
a "Download now" button under it, or something.  a message
saying "The Net::FTP module is part of the libnet bundle, click
here to download the libnet bundle now" would be perfect.

if you think you are only looking for Net::FTP and don't realize
it's part of the bundle, you might click the Net::FTP link,
which merely pops up the readme, with no instructions on how to
obtain it.

-jsd-


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

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



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

Date: Fri, 30 Jun 2000 14:28:05 -0400
From: "Dr. Retribution" <dr_retribution@hotmail.com>
Subject: Newbie question: Sorting a list-of-hashes
Message-Id: <8jiogr011p4@enews3.newsguy.com>

Given the following structure:

%scoredatabase = (
        [
        player => "Joe",
        frame1 => "5",
        frame2 => "8" ,
        frame3 => "1" ,
        total => "14"
        ]
    ... more players ...
) ;

    How can I sort the list on the contents of the "TOTAL" element of each
individual hash?

    TIA




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

Date: Fri, 30 Jun 2000 16:46:39 -0400
From: Stephen Kloder <stephen.kloder@gtri.gatech.edu>
Subject: Re: Newbie question: Sorting a list-of-hashes
Message-Id: <395D072F.D30DE042@gtri.gatech.edu>

"Dr. Retribution" wrote:

> Given the following structure:
>
> %scoredatabase = (
>         [
>         player => "Joe",
>         frame1 => "5",
>         frame2 => "8" ,
>         frame3 => "1" ,
>         total => "14"
>         ]
>     ... more players ...
> ) ;
>
>     How can I sort the list on the contents of the "TOTAL" element of each
> individual hash?
>
>     TIA

perldoc -f sort




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

Date: Fri, 30 Jun 2000 17:43:28 -0400
From: Gary Pitman <gpitman@nb.net>
Subject: Read multiple lines as one
Message-Id: <395D1480.825E9C8E@nb.net>

In a file that contains
    <VirtualHost xxx.xxx.xxx.xxx:80>
        ServerName www.foo.com
        DocumentRoot /home/a/abc/www
    </VirtualHost>
i need to extract only the domain name and the username from the path
("abc" in above example)
I can get it to work when all the info is on one line but I am having
trouble remembering or finding how to treat multiple lines as one.
I am sure the tags will make this simple if i could just remember how to
do it.

Thanks in advance,



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

Date: Fri, 30 Jun 2000 14:10:04 -0700
From: Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
Subject: Re: referencing with cgi
Message-Id: <395D0CAC.EAAA2C7F@My-Deja.com>



jinrai@my-deja.com wrote:
> 
> Is there a way to retrieve the values of variables in a cgi-script from
> another cgi-script?

Yes. If the first script saves it name/value pairs to a file
and then the second one reads those pairs back.

<< from the cgi.pm perldoc itself..>>
There is a form of the new() method allows you to read 
script parameters from a previously-opened file handle: 

    $query = new CGI(FILEHANDLE)

The filehandle can contain a URL-encoded query string, or can be a
series of newline delimited TAG=VALUE pairs. This is compatible with the
save() method. This lets you save the state of a CGI script to a file
and reload it later.

Or you can clone a CGI object from an existing one. The parameter lists
of the clone will be identical, but other fields, such as autoescaping,
are not: 

     $old_query = new CGI;
     $new_query = new CGI($old_query);
--


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 3526
**************************************


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