[12884] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 294 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 29 09:11:29 1999

Date: Thu, 29 Jul 1999 06:05:13 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 29 Jul 1999     Volume: 9 Number: 294

Today's topics:
        Any Perl-Guru out there??? <info@ITernity.net>
    Re: Any Suggestions? (Anno Siegel)
    Re: Any Suggestions? <revjack@radix.net>
    Re: Beginner needs help with a function <Tony.Irvine@env.qld.gov.au>
        Breakingdown an array? <fred@alpstreet.net>
    Re: Don't want to make file that owner is "NOBODY" (I.J. Garlick)
    Re: Easy way to emulate Unix's "sort" command? (Tad McClellan)
    Re: ebcdic packed numbers <flavell@mail.cern.ch>
    Re: ebcdic packed numbers (Anno Siegel)
    Re: Find::File -- skipping a directory? (Bart Lateur)
        Forbidden <maria.zevenhoven@kolumbus.fi>
        form, binary attachments <again> <prinspaul@NOSPAM!hotmail.com>
        GET, but starting at byte 5000, and just get 2000 byte <kin@0011.com>
        Hashes of Hashes <simon.brown@kns.ch>
    Re: Hashes of Hashes <Mark@Mark.Com>
    Re: help with vars <Mark@Mark.Com>
    Re: help: push array refs into hash, sort by refs in ha (Rory C-L)
    Re: how automatic assign a name to a hash (Tad McClellan)
    Re: How to find first occurance of white space... (Bart Lateur)
    Re: I need fast help (Bart Lateur)
    Re: more than one submit button (Bart Lateur)
    Re: OOP question. (Eugene van der Pijll)
    Re: Passing an Array into a HIDDEN FIELD (Anno Siegel)
    Re: Passing an Array into a HIDDEN FIELD (Michel Dalle)
    Re: Perl 5.005_58 ... a bug. (Matthew Bafford)
    Re: Perl Question (Tad McClellan)
        preventing more than 1 submission <bobby@alpstreet.com>
    Re: ref() return value... (Tad McClellan)
    Re: reg expression <revjack@radix.net>
        rtf to text converter? <james@microsec.co.uk>
        Running a CGI script as a specific user?? <matt@thehub.co.uk>
    Re: running Perl and Linux from a boot-cd? <thomas@bibsyst.no>
    Re: running Perl and Linux from a boot-cd? (Bbirthisel)
        Seeking good Perl Examples <James_Nedham@ml.com>
    Re: Seeking good Perl Examples <Mark@Mark.Com>
        Text::Wrap long string problem michaels@my-deja.com
        use lib - Problem <azielke@hotmail.com>
    Re: Using perl to ftp non interactively <keithcp@yahoo.com>
    Re: Using regular expressions in $\ (Bart Lateur)
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: Thu, 29 Jul 1999 14:32:14 +0200
From: "Hofmann, Florian" <info@ITernity.net>
Subject: Any Perl-Guru out there???
Message-Id: <37A049CA.82A363B3@ITernity.net>

Hello,

we are a 2 guy company that developes Java-Tree-Systems
that are working with external menu files...

Now we want to release a Perl-Treeview. We already have that
Perl code from the web and we are allowed to use this code but
this perl must be midified to work with our files...

Is there any cool guy out there that could help us?
We are not able to give you lot's of money but we could give you
a liftime licence of our Java-Applets and of course you 'll get 1.000
prays form us ;)

Please contact me by mail, Thank you!

--
With regards,

Florian Hofmann
Managing director
____________________________________________________________

ITernity Information Technologies   ITernity.net
Postfach 1204, D-83055 Kolbermoor   mailto:info@ITernity.net




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

Date: 29 Jul 1999 10:06:27 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Any Suggestions?
Message-Id: <7np933$114$1@lublin.zrz.tu-berlin.de>

Eric The Read  <emschwar@rmi.net> wrote in comp.lang.perl.misc:

>I'd suggest an amendment to the FAQ.  Before submitting the diff, lemme
>try this on you guys for size (critique at will):
>
>   It really depends on what you are trying to do.  The
>   CGI and CGI::Lite modules should generally be used for
>   most CGI purposes.  If you still feel, after testing 
>   the above, that you want to use your own module, then 
                                             ^^^^^^
                                             ^^^^^^code
>   be sure to read the documentation for CGI, available
>   at <URL:http://www.w3.org/CGI/>.

It will probably not be a module in most cases.

Anno


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

Date: 29 Jul 1999 12:07:38 GMT
From: revjack <revjack@radix.net>
Subject: Re: Any Suggestions?
Message-Id: <7npg6a$8rp$2@news1.Radix.Net>
Keywords: Hexapodia as the key insight

Eric The Read explains it all:

:Yes, and having read that bit of the FAQ (never needed to before), I'm
:concerned that the FAQ is undermining all the work we do here to get
:people using standardized modules.

To be fair, Tom C. is aware that that particular page needs severe
updating. Still might want to consider if it's doing more harm than good.
It's quite old. 

Other things I noted there are the following line for removing HTML tags: 

    $line =~ s/<(([^ >]|\n)*)>//g;

and this:

        You can have your CGI script determine whether your 
        script is being accessed by Netscape by using the 
        environment variable HTTP_USER_AGENT. Here is an 
        example: 
                
        $browser = $ENV{'HTTP_USER_AGENT'};
        
        if ($browser =~ /Mozilla/) {
            #
            # Netscape
            #
        } else {
            #
            # Non Netscape
            #
        }



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

Date: Thu, 29 Jul 1999 20:12:41 +1000
From: Tony Irvine <Tony.Irvine@env.qld.gov.au>
Subject: Re: Beginner needs help with a function
Message-Id: <37A02919.BF5BED73@env.qld.gov.au>

Abigail wrote:
> Tony Irvine (Tony.Irvine@env.qld.gov.au) wrote on MMCLVIII September
> MCMXCIII in <URL:news:379FC7F2.F8E84DA3@env.qld.gov.au>:
> ~~ It is still not as fast as the two step method but it is close.  I would
> ~~ still recommend using the two step because it is faster and clearer..
> ~~ but if you must use a single command... :)
> 
> But.... the original specification said *single* characters should be
> removed, which rules out the use of c+. Furthermore, the impression was
> made that only when the first and the last character were special, they
> should be removed. Which rules out your |.

Ahh.... Yes.... Damn..... I read too little of the thread and posted too soon. I
thought you were dealing with the strip chars front and back problem from the
FAQ.
 
Sorry.

We could just pretend that I was simply suggesting an improvement to the single
line solution in the FAQ and not making an ass of myself couldn't we? ;)

Tony


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

Date: Thu, 29 Jul 1999 13:16:03 +0100
From: Fred Mc Mahon <fred@alpstreet.net>
Subject: Breakingdown an array?
Message-Id: <37A04603.C9B1602@alpstreet.net>

hello, - if you can get through this it would be much appreciated.

        I'm using a form to appened data to a pipe delimited database.
First a user does a keyword search and gets a return on their query,
Which might be say 6 matches.
        They then can choose to add these to their database. The problem
is 
I only want them to add 1 item at a time.
        Im using an array variable in the script to add all the data to
the
database it looks like this:

foreach $field (@details_row)
 {
 $details_row .= "$field\|";
 }

$details_row .= "$name\|$address\|$phone\n";
print BOOK "$details_row";
close (BOOK);

        Is there a way to say if there is 2 $details_row, then return
page and 
print "sorry only one entry can be made at a time\n";


        Any help would be greatly apprecitiated.

        fred.


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

Date: Thu, 29 Jul 1999 09:18:56 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: Don't want to make file that owner is "NOBODY"
Message-Id: <FFMKJK.LyG@csc.liv.ac.uk>

In article <7nnghj$cs3$1@news.servint.com>,
<vlad@doom.net> writes:
>>> The only way around this that I know of is installing the suexec module for Apache
>>> (if Apache is the web server you are using of course)
>>> Check out http://www.apache.org/docs/suexec.html for more details on suexec
> 
>> No it's not, use chmod.
> 
> Nice smart ass response... But if you read the subject is says:
> Subject: Don't want to make file that owner is "NOBODY" 
> 
> So can you acommplish that with chmod?  No.

Ok I will give you that, but it's not clear what the poster actually wants.

> 
> 
> The data files are owned or need to be owned by a valid user.

And nobody is an invalid user on your system? (or whatever the server runs
a connection as anyway) All right you can't login into it but that's for
security.

> 
> If the data files need to be created/modified by a program/script
> that is spawned by the web server, then that program will run under 
> user: nobody, and therefore won't be able to modify a file owned by the 
> valid user (i.e. the user the files are owned by), unless of course the 
> file is mode 0666 or at least 0606.
> 
> But now, what stops another user on the same system from writing his own
> program/script that he can call via a web browser that runs under user:nobody 
> as well, and can view/modify any data files owned by nobody or that are world 
> writeable.

Dismissal! I think modifying some one elses files on your companies system
is definitely grounds for not having your feet touch the floor on the way
out of the door. Especially ones that have to be openly group modifiable,
at least with out permission.

If you must have a system where you can't trust people, say in an academic
environment then I would suggest a cgi wrapper would be more appropriate.
Agreed suExec seams to be something like that but sounds much more dangerous.

> 
> Thats one reason suexec exists...

Ok. Lets check out what it says in the quoted HTML page.

	Used properly, this feature can reduce considerably the security risks
	involved with allowing users to develop and run private CGI or SSI
	programs.  However, if suEXEC is improperly configured, it can cause any
	number of problems and possibly create new holes in your computer's
	security. If you aren't familiar with managing setuid root programs and
	the security issues they present, we highly recommend that you not
	consider using suEXEC

Hmmmm.... Not something a begginer should even contemplate with a warning
like that. Best left to a very savvy webmaster.

Mind you the same argument can be made for just about anything :-)

-- 
Ian J. Garlick
ijg@csc.liv.ac.uk

In Africa some of the native tribes have a custom of beating the ground
with clubs and uttering spine chilling cries.  Anthropologists call
this a form of primitive self-expression.  In America we call it golf.



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

Date: Thu, 29 Jul 1999 03:28:30 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Easy way to emulate Unix's "sort" command?
Message-Id: <uqvon7.3to.ln@magna.metronet.com>

Paul Glidden (paul.glidden@unisys.com) wrote:

: Don't be too upset about it, I hate reading those things, sometimes the
: explanations are just not up to snuff, 


   Part of the Open Source model is that users can contribute
   to finding and fixing bugs.

   When you find a FAQ answer that is not up to snuff (a bug),
   you should file a bug report (hopefully with a patch too).

   But be very sure that the answer does not answer the question,
   or could answer the question better.

   Be very wary of submitting a bug report just because you
   don't understand the answer. In that case, ask about
   the FAQ answer here, and see if anyone else can understand
   it (and re-explain it).


   Perl is free.

   It is maintained and updated by users.

   If you find something wrong, help fix it.

   That is how you "pay" for perl.


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


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

Date: Thu, 29 Jul 1999 12:19:41 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: ebcdic packed numbers
Message-Id: <Pine.HPP.3.95a.990729120159.14835B-100000@hpplus03.cern.ch>

On 29 Jul 1999, Uri Guttman wrote:

> my pl/1 runtime supported up to 15 decimal digits plus sign nibble.

That reflects the inherent IBM/360 architecture, where the length of 
packed-decimal operands was specified by a nibble in the instruction
format.

>   >> you can't
>   >> operate on bcd in perl directly 

To add two BCD data, in effect you have to add the two together (as if
they were binary data), plus 6666... to get the carry-over from digit to
digit, and then take the 6666... off again without producing a borrow. 
Surely this can be done with some clever combination of xor and masking
and stuff?  I've done it in hardware, years ago ;-)




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

Date: 29 Jul 1999 11:22:56 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: ebcdic packed numbers
Message-Id: <7npdig$13t$1@lublin.zrz.tu-berlin.de>

Alan J. Flavell <flavell@mail.cern.ch> wrote in comp.lang.perl.misc:

[...]

>To add two BCD data, in effect you have to add the two together (as if
>they were binary data), plus 6666... to get the carry-over from digit to
>digit, and then take the 6666... off again without producing a borrow. 
>Surely this can be done with some clever combination of xor and masking
>and stuff?  I've done it in hardware, years ago ;-)

But that would work only on big-endian machines. (Or was that
little-endian, I can't remember which is which[1]).

Anno

[1] This helps to write portable code, which again helps to keep up
    the state of blissful ignorance.


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

Date: Thu, 29 Jul 1999 10:17:41 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Find::File -- skipping a directory?
Message-Id: <37a9273d.7660115@news.skynet.be>

J. Moreno wrote:

>Am, I missing something or is there no way to skip a directory when
>using Find::File?

It's File::Find, but that's probably just a typo. And yes, I bet you're
interested in "pruning". From the docs:

    The function may set $File::Find::prune to prune the tree.

	Bart.


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

Date: Thu, 29 Jul 1999 13:48:47 +0200
From: "Maria Zevenhoven" <maria.zevenhoven@kolumbus.fi>
Subject: Forbidden
Message-Id: <7npbdj$c5$1@news.kolumbus.fi>

You don't have permission to access /kalenteri.cgi on this server.

It's been long since I made my last script, and now I started again, and got
this message. I put chmod 775 script.cgi, but still... have I forgot
something here?

-Maria




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

Date: Thu, 29 Jul 1999 14:19:42 +0200
From: "Paolo" <prinspaul@NOSPAM!hotmail.com>
Subject: form, binary attachments <again>
Message-Id: <7npghu$gsfo$1@reader3.wxs.nl>

Hi,

Searching the web for the script I need I ended up here.
I must admit I don't know a damn thing about Perl.
I've seen some scripts and decided not to get into this because you just
can't know it all.
Here's my problem:
Like many others I am looking for a script with which I can let my website
visitors attach a binary file from their PC to the form displayed and mail
it to me.
Now, please don't send me replies about MIME::Lite and CPAN because like I
said I don't know anything about perl.
Does anybody have a script like this to share ?
Or maybe an example ?
Thanx a lot.

Greetings
Paolo





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

Date: Thu, 29 Jul 1999 04:24:59 -0700
From: Kin Lum <kin@0011.com>
Subject: GET, but starting at byte 5000, and just get 2000 byte
Message-Id: <37A03A0B.F2BED320@0011.com>

a question for LWP:  it seems that you can send a "GET"
request for a file, but say, starting at  byte 5000
and then you want just 2000 bytes.

Is that possible?

The routines I saw are all getting the complete file.

And if it is possible, can most Web server support it?
I think some cannot?


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

Date: Thu, 29 Jul 1999 14:48:07 +0200
From: "Simon Brown" <simon.brown@kns.ch>
Subject: Hashes of Hashes
Message-Id: <7npiib$klv$1@fu-berlin.de>

Hi All,

Example:

%hash = ();
$hash{"Simon"}{"Age"} = 42;
$hash{"Simon"}{"Weight"} = 80;
$hash{"Simon"}{"Rich"} = "No";

I want to know how I can get a list of the subkeys Age, Weight and Rich so
that I can dump the hash. Obviously I can start with something like:

foreach $person (keys %hash)
{
    # But then what???
}

I've looked everywhere. I gues it's simple once I know it. A reply to
simon.brown@kns.ch as well as here would result in undying gratitude.

Simon

---
Simon Brown, Casa Bergenia, 7031 Laax, Switzerland




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

Date: Thu, 29 Jul 1999 13:55:26 +0100
From: Mark <Mark@Mark.Com>
Subject: Re: Hashes of Hashes
Message-Id: <37A04F3E.BA3811DC@Mark.Com>



Simon Brown wrote:

> Hi All,
>
> Example:
>
> %hash = ();
> $hash{"Simon"}{"Age"} = 42;
> $hash{"Simon"}{"Weight"} = 80;
> $hash{"Simon"}{"Rich"} = "No";
>
> I want to know how I can get a list of the subkeys Age, Weight and Rich so
> that I can dump the hash. Obviously I can start with something like:
>
> foreach $person (keys %hash)
> {
>     foreach $attribute ( keys %{$hash{$person}})

        {
            print "$person - $attribute - $hash{$person}{$attribute}","\n";
        }

>
> }
>
> I've looked everywhere. I gues it's simple once I know it. A reply to
> simon.brown@kns.ch as well as here would result in undying gratitude.
>
> Simon
>
> ---
> Simon Brown, Casa Bergenia, 7031 Laax, Switzerland



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

Date: Thu, 29 Jul 1999 14:01:32 +0100
From: Mark <Mark@Mark.Com>
Subject: Re: help with vars
Message-Id: <37A050AC.D8E953D0@Mark.Com>



Abigail wrote:

> ted fiedler (tfiedler@ptd.net) wrote on MMCLVII September MCMXCIII in
> <URL:news:zfMn3.31$Q8.5285@nnrp1.ptd.net>:
> ^^
> ^^ what am i doing wrong?  this doesnt work...
>
> Well, there's a lot that can be improved on your program, but "this doesnt
> work" is a bit vague. No, let me rephrase that. It's pointless. It's
> useless. You don't tell us what you expect it to do, and you don't tell
> us what it does. So, how is anyone except yourself supposed to figure
> out what's wrong?
>
> Perhaps you should just feed it more candy bars.
>
> Abigail

Abigail,

Everyone else who replied tried to help. The guy is obviously panicking. You could
try and chill out just a bit and offer some constructive help.

Don't be such a smart a***. Try and remember when you had no idea what you were
doing, like when you sent this email.

:-)

Mark



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

Date: 29 Jul 1999 12:13:09 GMT
From: campbell-lange@easynet.co.uk (Rory C-L)
Subject: Re: help: push array refs into hash, sort by refs in hash
Message-Id: <campbell-lange-2907991312480001@campbell-lange.easynet.co.uk>

In article <7np33c$pa$1@lublin.zrz.tu-berlin.de>,
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:

> Obviously you need help.  But you won't get it unless you state
> clearly what you want to do.  Don't use Perl parlance if you don't
> understand it clearly, it will only confuse your readers.  
> 
> Anno

My sincere apologies for wasting your time. I failed
to read your previous posting properly. All my questions
about constructing the array referenced by the hash value
were answered by your excellent help. Thank you for spending
time trying to interpret my confusion.

I now understand:
Inserting : takes the form of:
         push @{$hash{'key'}}, [qw!one two three!];
         push @{$hash{'key'}}, [qw!three four five!];
Accessing : takes the form of:
         print @{@{$hash{'key'}}[0]}; # gives "one two three"
         print ${@{@{$hash{'hasher'}}[0]}}[2]; # gives "three"

Sorting: 
I realise I have to sort the hash by keys or values, or the hash value
ref'd array by values in the arrays in the ref'd array.

Thank you again
Rory
   

This is the final code, which works
------------
#!perl -w
use strict;

my (@issues, %hash);

while (<>)
{
   chomp;
   my ($plot, $no, $rev, $title, $iss, $date) = "";
   my ($rest) = [];
   ($plot, $no, $rev, $title, $iss, $date) = split /\t/;
   $date = "none" if (! $date);  
   $rest = [$no, $rev, $date, $iss];
   push @{ $hash{$iss} }, $rest; # from Anno Siegel 
}

### adapted from help by Anno Siegel

for my $issue ( sort keys %hash ) 
{
  print "$issue: \n";
  for my $aref ( @{ $hash{ $issue}} ) 
  {
    print "\t@$aref\n";
  }
  print "\n";
}

# (sample data)
# __END__
# 4   A/LB/10/00/249 C  Utility Building  780/1999 21/4/99
# 1   A/LB/10/01/003 R  First Floor Plan  874/1999 1/6/99
# 1   A/LB/10/02/028 C  Second Floor   542/1999 14/1/99
# 1   A/LB/10/04/021 J  Utility Building Central   487/1998 4/12/98
# 1   A/LB/10/05/032 K  Roof Plan   897/1999 8/6/99

-- 
Rory Campbell-Lange
The Campbell-Lange Workshop


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

Date: Thu, 29 Jul 1999 03:45:42 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: how automatic assign a name to a hash
Message-Id: <6r0pn7.3to.ln@magna.metronet.com>

Pieter Van der Donckt (virtual.factory@turboline.be) wrote:

: I am looking for a way to automate a nameassignment to a hash.


   You should stop looking!


: So I need a way to name the hashes in an=20
: automated way.


   You should use a HoH then.

   See perlref.pod and perldsc.pod for how to make a Hash-of-Hashes

   See also:

     http://www.plover.com/~mjd/perl/varvarname.html



: Somebody who has an idea?

: Content-Type: text/html


   One idea would be to stop with the HTML crap.

   HTML is for the WWW.

   This is Usenet.

   Usenet is not the WWW.

   Your "newsreader" is not configured properly.


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


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

Date: Thu, 29 Jul 1999 10:17:37 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: How to find first occurance of white space...
Message-Id: <37a721a9.6231900@news.skynet.be>

Mark wrote:

>$string = '123456 a b c';
>($substring = $string ) =~ s/^[^ ]* //;
>print 'string = ',$string,' substring = ',$substring,"\n";

Did you test it? It DELETES the wanted substring, and it LEAVES
everything not wanted intact.

This is probably more like what is wanted:

	($substring = $string ) =~ s/ .*//s;

	Bart.


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

Date: Thu, 29 Jul 1999 10:17:33 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: I need fast help
Message-Id: <37a31b1b.4553941@news.skynet.be>

Marko Cehaja wrote:

>open(MY,"FILETST");
>print MY "Testing file output\n";
>close (MY);

You don't have warnings enabled, have you? On the very first line, that
looks a bit like "#! perl", add " -w" at the end.

Now, if you try to run it again, you'll see the warning:

   print on closed filehandle main::MY at test.pl line 3.

Uh. The file isn't even open. That's because it doesn't exist. If there
*was* a file with that name, you'd see:

   Filehandle main::MY opened only for input at test.pl line 3.

Now look again at the docs for open() ("perldoc -f open" on the command
line, or open the documentation file "perlfunc". You can see:

    If the filename begins with "<" or nothing, the file
    is opened for input. If the filename begins with ">",
    the file is truncated and opened for output, being
    created if necessary. If the filename begins with
    ">>", the file is opened for appending, again being
    created if necessary. You can put a "+" in front of
    the ">" or "<" to indicate that you want both read
    and write access to the file; ...

Capice? What you did was equivalent to

	open MY,"<FILETST";

but you probably wanted

	open MY,">FILETST"; # new file
or
	open MY,">>FILETST"; # append to file

instead.

	Bart.


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

Date: Thu, 29 Jul 1999 10:17:35 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: more than one submit button
Message-Id: <37a61e3e.5357329@news.skynet.be>

boris_bass@my-deja.com wrote:

>so what if i want to have "submit1" and "submit2" buttons call
>"myscript1.cgi" and "myscript2.cgi" respectively? Any suggesions
>appriciated.

Put two submit buttons on the form. Give them a different name, or a
different value (which appears in the button caption), or both. Now, in
the main script, check the parameters for the button's name and/or
value. Only the button pressed will be in the list of parameters, as a
name/value pair. Let your script do whichever action you think
appropriate.

Oh dear, you really want two scripts? Huh... try

	if($button1pressed) {
		do 'myscript1.cgi';
	} else {
		do 'myscript2.cgi';
	}

in the main script.

	Bart.


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

Date: 29 Jul 99 09:49:08 GMT
From: pijll@phys.uu.nl (Eugene van der Pijll)
Subject: Re: OOP question.
Message-Id: <pijll.933241748@ruunat.phys.uu.nl>

In <7nools$sv5$1@towncrier.cc.monash.edu.au> damian@cs.monash.edu.au (Damian Conway) writes:

>   > > Although I've used Perl for a while, I haven't done much OOP
>   > > with it, so I'm trying to brush up. I came across an exercise
>   > > that instructed me to create a class C that inherits from
>   > > classes A and B in that order. The trick was, if a C object
>   > > should have a particular value (in this case, instance variable
>   > > "name" has value "blah") the order of inheritance should be
>   > > reversed.

>	package C;

>	@ISA = qw( A B );

>	sub new
>	{
>		my ($class, %args) = @_;
>		return AntiC->new(%args) if $args{name} eq 'blah';
>		return bless(\%args, $class);
>	}


>	package AntiC;

>	@ISA = qw( B A );

>	sub new
>	{
>		my ($class, %args) = @_;
>		return bless(\%args, $class);
>	}


>	package main;

>	my $c1 = C->new(name=>'bar', rank=>'foo', serialnum=>00001);
>	my $c2 = C->new(name=>'blah', rank=>'floo', serialnum=>00002);


>Now $c1 is a C, whilst $c2 is an AntiC.

But you're using two classes, that looks like cheating to me. Besides, it's
not a correct solution, IMHO:

what if the name of an object is changed?
$c1->set_name('blah') should rebless $c1 into the package AntiC, no?

My solution would be to have 1 class only, but with an @ISA which is
only determinated when a method is called:

#!/usr/local/bin/perl -w

{package A;

 sub foo { shift;print shift, " is an A\n"; }
}

{package B;

 sub foo { shift;print shift, " is a B\n"; }
}

{package C;

 @_ISA = qw( A B );

 sub AUTOLOAD {
	my ($self, @args) = @_;
	my $method = $AUTOLOAD;
	$method =~ s/.*://;
	unless ($method eq 'DESTROY') {
 		local @ISA = ($self->{name} eq 'blah'? @_ISA : reverse @_ISA);
		$method = "SUPER::$method";
		$self->$method(@args);
	}
 }
}

$x = bless {name => 'blah'}, 'C';
$x->foo("x");
$y = bless {name => 'bar'}, 'C';
$y->foo("y");


Comments, anyone? (I know it's not very nice, but it does satisfy the
specifications more than your code.)
--
         \
      Eugene van der Pijll  : pijll@phys.uu.nl
--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--


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

Date: 29 Jul 1999 09:40:42 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Passing an Array into a HIDDEN FIELD
Message-Id: <7np7iq$uu$1@lublin.zrz.tu-berlin.de>

Michel Dalle <michel.dalle@usa.net> wrote in comp.lang.perl.misc:
>In article <379FC827.8ABB17B9@altavista.net>, Patrick Lam <p.lam@altavista.net> wrote:
>[snip]
>>Looking at the CGI page at http://stein.cshl.org/WWW/software/CGI/, I
>>tried something like:
>>print $cgi->hidden(-name=>'theList' -default=>@theArray),
>>where the array contains the elements I wish to store.
>
>Have you tried [@theArray] instead of @theArray ?
>
>Who knows, that might work :-)

No, it might not.  Please, if you give advice, either be absolutely
sure or test it.

Anno


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

Date: Thu, 29 Jul 1999 12:53:07 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Passing an Array into a HIDDEN FIELD
Message-Id: <7npivl$lh1$1@news.mch.sbs.de>

In article <7np7iq$uu$1@lublin.zrz.tu-berlin.de>, anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote:
[snip]
>No, it might not.  Please, if you give advice, either be absolutely
>sure or test it.

Oops, you're right. I was a bit put off by someone else who posted the
same question under two different subjects, and it must have switched off
my brain and triggered my send finger :-o

My apologies to all for the wrong advice,

Michel.


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

Date: Thu, 29 Jul 1999 11:09:12 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Perl 5.005_58 ... a bug.
Message-Id: <slrn7q0bi6.203.*@dragons.duesouth.net>

Faisal Nasim" <swiftkid@bigfoot.com>, thinking with his hands, posted
the following to comp.lang.perl.misc: 
: perl -V is broken!
: 
: RedHat 6.0

Well, that was fairly informative.

You just might want to provide a tad bit more information, though.

Like:
        How you obtained the binary.

        What happens when you type perl -V.

        Output from perl -v, at the least.

Oh, and all bugs should be sent using the 'perlbug' command, which, in
this case, will mail the output of *attempting* to run 'perl -V', which
should help the Perl Porters out.

If perlbug just won't work for you, then mail perlbug@perl.com.

: Faisal Nasim

--Matthew
-- 
:               (the Whiz Kid)
Eh?


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

Date: Thu, 29 Jul 1999 03:48:21 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Perl Question
Message-Id: <501pn7.3to.ln@magna.metronet.com>

kaz@eudoramail.com wrote:

: Please someone tell me the difference between ".*" and ".*?"


   They are 2 strings. 

   One of them has a question mark, and one of them doesn't.



   If you meant to ask about how they behave when used as a
   part of a regular expression pattern match, then:

   Perl FAQ, part 6:

      "What does it mean that regexps are greedy?  
       How can I get around it?"


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


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

Date: Thu, 29 Jul 1999 11:11:39 +0100
From: Administrator <bobby@alpstreet.com>
Subject: preventing more than 1 submission
Message-Id: <37A028DB.7B490EF4@alpstreet.com>

hello, - if you can get through this it would be much appreciated.

	I'm using a form to appened data to a pipe delimited database.
First a user does a keyword search and gets a return on their query,
Which might be say 6 matches.
	They then can choose to add these to their database. The problem is 
I only want them to add 1 item at a time.
	Im using an array variable in the script to add all the data to the
database it looks like this:

foreach $field (@details_row)
 {
 $details_row .= "$field\|";
 }

$details_row .= "$name\|$address\|$phone\n";
print BOOK "$details_row";
close (BOOK);

	Is there a way to say if there is 2 $details_row return page 
print "sorry only one entry can be made at a time\n";


	Any help would be greatly apprecitiated.

	fred.


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

Date: Thu, 29 Jul 1999 03:39:21 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: ref() return value...
Message-Id: <9f0pn7.3to.ln@magna.metronet.com>

bhaskaracharya@my-deja.com wrote:

: $ref = ref (\( 1, 2, 3)); ## returns SCALAR

: why is the ref() considering the array as in scalar context???


   There is no array there, only a list.


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


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

Date: 29 Jul 1999 11:35:28 GMT
From: revjack <revjack@radix.net>
Subject: Re: reg expression
Message-Id: <7npea0$8rp$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight

Steven Smolinski explains it all:

:But come on, what sort of fool is writing production code in Perl, and at
:the same time asking FAQs in newsgroups?  Is it *that* easy to get a
:programming job nowadays?

Watch out for those tar pits over there. :)


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

Date: Thu, 29 Jul 1999 11:22:50 +0100
From: "James Lavery" <james@microsec.co.uk>
Subject: rtf to text converter?
Message-Id: <37a0238f.0@news.netdirect.net.uk>

Hi all,
Has anyone come across a module which will convert rtf to text?  It has to
be able to handle tables!

Thanks,

James




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

Date: Thu, 29 Jul 1999 12:43:21 +0100
From: Matt Carter <matt@thehub.co.uk>
Subject: Running a CGI script as a specific user??
Message-Id: <37A03E58.49361A1@thehub.co.uk>

Hi there,

I am trying to find out how it is possible to run an ' open(FH, ">
filename") '.
function as a specific user, so I can write to a file without having to
chmod it so
it is writeable by everyone!

I'm restricted to Perl5.003, and a remotely hosted server (with telnet
access!)

Any Ideas!!??

Cheers
Matt

--
Matt Carter
The Hub Communications Co Ltd
The Farmhouse
Syon Park
Middlesex
TW8 8JF

Tel: +44(0)1815609222 Fax: +44(0)1815609333
Email: matt@thehub.co.uk URL: http://www.thehub.co.uk



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

Date: Thu, 29 Jul 1999 13:11:32 +0200
From: Thomas Weholt <thomas@bibsyst.no>
Subject: Re: running Perl and Linux from a boot-cd?
Message-Id: <37A036E4.4B7EC682@bibsyst.no>

> the part of what you want to do that's actually relevant to this group is
> trivial .. ie. have perl available on a CD

I meant available like ready to run. You mean perhaps an package ready
to install. 

> your questions regarding the rest of this idea would be better directed
> to either a group on Linux or a group on CD burning

Yes, I know it`s a little off topic. 

> yes .. it sounds stupid .. perl is fairly compatible across different OSs

Thanks. I realized that what I wrote should have been something like 
"I want to create a bootable cd using linux as os with perl so that
people could boot this disc and not bother with installing linux or
perl. How do I .... etc. etc. "

Most of my friends are running windoze and doesn`t want to install perl
just to search a database. It would be easier for them, perhaps, to boot
this cd.

> that having been said .. it's certainly possible to boot Linux from a CD
> - but it is machine configuration dependant

Yes, that`s another matter. Perhaps I`ll post another message just
asking about that? ;->

Thomas


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

Date: 29 Jul 1999 12:36:02 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: running Perl and Linux from a boot-cd?
Message-Id: <19990729083602.25864.00003659@ng-bg1.aol.com>

Hi Thomas:

>> trivial .. ie. have perl available on a CD
>
>I meant available like ready to run. You mean perhaps an package >ready to
install. 

>Most of my friends are running windoze and doesn`t want to install perl
>just to search a database. It would be easier for them, perhaps, to boot
>this cd.

It would be MUCH easier on them to mount the CD on Windows
and have a Win32 Perl execute from the CD. No reboot needed.
I have not heard of anyone running Perl that way on Win32 - but
lots of people install Perl in non-default locations and a "server"
install is described. So it should be possible. And significantly
easier than teaching them another OS. You didn't sat which
database you are using.

>> that having been said .. it's certainly possible to boot Linux from a CD
>> - but it is machine configuration dependant

Hmm...some machine dependencies end up in Config.pm. You
might need to install something from the CD onto each local
machine. I would check the ActiveState archives for "server"
installs - maybe they have a cookbook for something like this.

-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)


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

Date: Thu, 29 Jul 1999 12:13:13 +0100
From: "James Nedham" <James_Nedham@ml.com>
Subject: Seeking good Perl Examples
Message-Id: <7npcvt$fam$1@news.ml.com>

I am a newbie seeking good Perl examples, not CGI scripts.  I am interested
in scripts which look for certain processes to be running which notify me
when they ahve died.  Also I want to look at perl scripts that monitor log
files and notify me when there are certain errors

Thanks in advance

james_nedham@ml.com




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

Date: Thu, 29 Jul 1999 13:46:28 +0100
From: Mark <Mark@Mark.Com>
Subject: Re: Seeking good Perl Examples
Message-Id: <37A04D24.B1A716F3@Mark.Com>

Try Learning Perl (good for newbies), Programming Perl (bible but a wee bit
advanced, great reference) and The Perl Cookbook
(rarely fails to provide pointers) All available from O'Reilly
(http://www.ora.com)

There are shedloads of perl tutorials and examples on the web.

James Nedham wrote:

> I am a newbie seeking good Perl examples, not CGI scripts.  I am interested
> in scripts which look for certain processes to be running which notify me
> when they ahve died.  Also I want to look at perl scripts that monitor log
> files and notify me when there are certain errors
>
> Thanks in advance
>
> james_nedham@ml.com



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

Date: Thu, 29 Jul 1999 12:45:03 GMT
From: michaels@my-deja.com
Subject: Text::Wrap long string problem
Message-Id: <7npice$huv$1@nnrp1.deja.com>

When using Text::Wrap, if the text to be wrapped contains a string which
is longer than $columns, it is broken up (in line with the documented
behaviour). However, the string is also moved to the end of the text.

Is there any way to avoid the long string from being moved to the end of
the wrapped text?

(I'm using Perl 5.005_03).

Thanks,
Michael Sanders


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Thu, 29 Jul 1999 12:08:08 +0200
From: A Zielke <azielke@hotmail.com>
Subject: use lib - Problem
Message-Id: <37A02808.8B2BEB61@hotmail.com>

Hi,

could anyone give me a hint, please?
I'm trying to add a path to @INC.

#-------SNIP-------------------------

#!shebang
use strict;
my $BaseDir = $ENV{'FOODIR'};
### Why is $BaseDir.'/lib' _not_ added to @INC this way?
use lib $BaseDir.'/lib';
use SomeModuleInFooDir;

#-------SNAP-------------------------

#!shebang
use strict;
my $BaseDir = $ENV{'FOODIR'};
my @List = ($BaseDir.'/lib');
### This doesn't work, either :(
use lib @List;
use SomeModuleInFooDir;

#-------SNAP-------------------------

#!shebang
use strict;
### Why does this work, opposed to the other two ways????
use lib $ENV{'FOODIR'}.'/lib';
use SomeModuleInFooDir;

#-------SNAP-------------------------

Andreas



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

Date: Thu, 29 Jul 1999 08:56:10 -0400
From: "Keith" <keithcp@yahoo.com>
Subject: Re: Using perl to ftp non interactively
Message-Id: <7npisj$29o$1@bmerhc5e.ca.nortel.com>

Thanks for the info.
Could someone please show me an example of how this might be used in a
script.
I am using the package as an FTP client.
I have read the documentation but when I run the script with the quit call
at the end I get the message:
Can't locate object method "quit" via package "Net::TFTP"
I believe that my syntax is wrong somewhere.
Thanks in advance.

Abigail wrote in message ...
>Keith (keithcp@yahoo.com) wrote on MMCLVI September MCMXCIII in
><URL:news:7nkrlq$s3t$1@bmerhc5e.ca.nortel.com>:
>{} Can anyone tell me if there is a way to use ftp in a perl script.
>
>Yes, there is a module for that on CPAN.
>
>{} I believe that I might need to use a Here Document type of syntax but am
not
>{} positive.
>
>What makes you think that?
>
>
>
>Abigail
>--
>srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
>//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
>
>
>  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News
==----------
>   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
>------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers
==-----




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

Date: Thu, 29 Jul 1999 10:17:39 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Using regular expressions in $\
Message-Id: <37a822af.6494057@news.skynet.be>

mgcesar@my-deja.com wrote:

>Does any body know how (or if) regular expression can be used as an
>INPUT_RECORD_SEPERATOR ($\)?  I have a file to parse where the 'RS' in
>Awk would be defined as "\\\xB3{1,4}" (ie 1 to 4 hex B3s).
>Any ideas?

First, you mean $/ not $\. Maybe that's why you didn't find it in the
docs.

Second, you might try split() if the file is not too big, and if you
don't mind that the RS is stripped off, and that empty records at the
end are ignored.

	@records = split /\xB3{1,4}/;


But I don't get why you don't simply set $/ to "\XB3", and skip empty
records (if there aren't more than 3 in a row).

	Bart.


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

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

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


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