use_named_parameters()

2002-12-10 Thread Kris Gaethofs
Hi, I have this problem and don't immediately know the sollution. I would like perl to use named parameters only while doing cgi scripting. To force this I use the following code: #!/opt/bin/perl -Tw use CGI; use strict; my $q = CGI->new(); $q->use_named_parameters(1); etc... However, it do

Re: script runs in console but not in browser

2002-12-10 Thread Mystik Gotan
#!/path/to/perl -wT use strict; use warnings; That might help. -- Bob Erinkveld (Webmaster Insane Hosts) www.insane-hosts.net MSN: [EMAIL PROTECTED] From: [EMAIL PROTECTED] To: Dave K <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED] Subject: Re: script runs in console but not in brow

How to get the biggest integers from an array?

2002-12-10 Thread Mystik Gotan
Hiya, I'm in search for a solution. Let's say I have this array: @array (5, 6, 7, 89, 1, 0, 456, 298023, 56); Now, how can I get the biggest integers from this array and give them a string with their place. Let's say I have a foreach loop where I checked all the biggest integers (however, I do

RE: use_named_parameters()

2002-12-10 Thread wiggins
The method has been removed. From the docs: Version 2.57 6. Removed use_named_parameters() because of dependency problems and general lameness. http://stein.cshl.org/WWW/software/CGI/ I think "param" is now the preferred method. http://danconia.org

Re: script runs in console but not in browser

2002-12-10 Thread wiggins
On Tue, 10 Dec 2002 12:35:56 +0100, "Mystik Gotan" <[EMAIL PROTECTED]> wrote: > #!/path/to/perl -wT > use strict; > use warnings; > > That might help. > Any reason to use -w and use warnings? http://danconia.org -- To unsubscribe, e-mail: [EM

Installing CGI.pm in RedHat 8.0.

2002-12-10 Thread Admin-Stress
I dont know why, in my OTHER RedHat 8.0 installation, I cant find CGI.pm. I did install perl5.8.0. Anyone know how to install it? I looked in cpan, it seems it's default perl module. And I cant find any installer for it. Is it OK if I just copy CGI.pm from cpan? into /usr/lib/perl5/5.8.0/CGI.

Regular Expression

2002-12-10 Thread Wagner
Hello, I have this regular expression: $List =~ /^(?:(\d+)\*)?(\w+)\/(?:(\d+)\*)?(\w+)$/; It checks for a string like this: number*word/number*word But it only accept integer number... Does anybody knows how to change it to accept decimal numbers like 0.1??? Thanks, Wagner Garcia Campagner -

can we use "system()" inside cgi ?

2002-12-10 Thread Admin-Stress
I got this error : [error] [client 10.0.0.88] Insecure $ENV{PATH} while running setuid at /var/www/cgi-bin/ifcfg_rh80.pl line 60., referer: http://10.0.0.50/cgi-bin/editconfig.pl And line 60 of ifcfg_rh80.pl is : system("/sbin/ifdown $device"); sleep 2; system("/sbin/ifup $device"); I

RE: Regular Expression

2002-12-10 Thread Joel Hughes
Hi Wagner, This should do the trick... $List =~ /^(?:([\d|\.]+)\*)?(\w+)\/(?:([\d|\.]+)\*)?(\w+)$/; Basically looks like you need a character class to accept a '.' as well. (However, this reg exp looks like it will let thru 100.0.0.1 is a number!) Joel -Original Message- From: Wagn

RE: can we use "system()" inside cgi ?

2002-12-10 Thread wiggins
You need to read up on tainted variables, I think. perldoc perlsec The problem isn't that it is a CGI, pretty sure the problem is that it is setuid. http://danconia.org On Tue, 10 Dec 2002 07:20:16 -0800 (PST), Admin-Stress <[EMAIL PROTECTED]> wr

RES: Regular Expression

2002-12-10 Thread Wagner
Hi Joel, Ok... it is working just as i want... No problem if the number is 1.8.6.5.4.3 Thanks, Wagner Garcia Campagner -Mensagem original- De: Joel Hughes [mailto:[EMAIL PROTECTED]] Enviada em: terça-feira, 10 de dezembro de 2002 12:21 Para: 'perl cgi' Assunto: RE: Regular Expression

RE: Installing CGI.pm in RedHat 8.0.

2002-12-10 Thread wiggins
On Tue, 10 Dec 2002 06:51:27 -0800 (PST), Admin-Stress <[EMAIL PROTECTED]> wrote: > I dont know why, in my OTHER RedHat 8.0 installation, I cant find CGI.pm. I did >install perl5.8.0. > I believe in RH8.0 the CGI module is in a separate RPM. Che

Re: Regular Expression

2002-12-10 Thread Keex
hi there - I did not try this, but it seems somewhat logical to me: $List =~ /^(?:(\d+(\.\d+)?)\*)?(\w+)\/(?:(\d+(\.\d+)?)\*)?(\w+)$/; > > Hello, > > > > I have this regular expression: > > > > $List =~ /^(?:(\d+)\*)?(\w+)\/(?:(\d+)\*)?(\w+)$/; > > > > It checks for a string like this: number

Re: Handling & =

2002-12-10 Thread John Stokes
Ah - I see the problem. I do a regex to replace all hex encoded characters BEFORE I split on &, thusly all %26's are replaced with & before I do the split. In terms of "why reinvent the wheel", I prefer not to use CGI.pm for simple form processing because it prevents me from doing something like

Re: Handling & =

2002-12-10 Thread Larry Coffin
>In terms of "why reinvent the wheel", I prefer not to use CGI.pm for simple >form processing because it prevents me from doing something like > >print >> End_of_form > >...lots of HTML code... > >End_of_form It does? Then I must be programming in something other than Perl because I use th

RE: Regular Expression

2002-12-10 Thread Larry Coffin
>This should do the trick... >$List =~ /^(?:([\d|\.]+)\*)?(\w+)\/(?:([\d|\.]+)\*)?(\w+)$/; Note that this will also pass '12|34.56' as a valid number because of the '|' in the '[...]'. I think you will really want just '[\d\.]'. ---Larry +

Re: Handling & =

2002-12-10 Thread John Stokes
Really? How could I mix something like: print OUTPUTFILE $q->start_html('Application'); print OUTPUTFILE $q->center( $q->h2("My Company Name"), $q->p($q->strong("Application")), ); print OUTPUTFILE $q->p("Applicant's Name: ",$q->b($q->param("Name")); With something like print >> End_of_form? Is

Re: Handling & =

2002-12-10 Thread Larry Coffin
Well, I'm not all that familiar with the CGI.pm html generation functions, but if they simply generate HTML elements, there should be no reason you can't mix CGI.pm calls with your own html code. Something like: --- #!/usr/bin/perl use CGI; $q = new CGI; open(OUTPUTFILE, ">

Re: Installing CGI.pm in RedHat 8.0.

2002-12-10 Thread fliptop
On Tue, 10 Dec 2002 at 06:51, Admin-Stress opined: A:I dont know why, in my OTHER RedHat 8.0 installation, I cant find A:CGI.pm. I did install perl5.8.0. A: A:Anyone know how to install it? I looked in cpan, it seems it's default A:perl module. And I cant find any installer for it. A: A:Is it OK i

Re: use_named_parameters()

2002-12-10 Thread Larry Coffin
>$q->use_named_parameters(1); Looks like that was removed in CGI.pm version 2.57. ---Larry ++ | Larry Coffin, G.P.H. Watertown, MA | | http://www.PointInfinity.com/lcoffin

Re: Handling & =

2002-12-10 Thread John Stokes
Nope, no luck. When I use something like: Print >> End_form; Name: $q->param("name") End_form My output looks like: Name: CGI=HASH(0x6590)->param("name") I think I tried this before and that's why I didn't use CGI.pm for variable processing. But hey... I'm open to correction! -John On 1

Re: Handling & =

2002-12-10 Thread Larry Coffin
>Print >> End_form; > >Name: $q->param("name") > >End_form That's because you can't execute perl code within this construct. It is essentially a double quoted string that just happens to span multiple lines. So, this doesn't work just like: print "Name $q->param('name')\n"; won't

Re: Handling & =

2002-12-10 Thread John Stokes
Ah yes... That makes sense. That's the solution I've used in other cases (for instance, resolving a CGI param to a path.) Unfortunately, it's not really practical to define a bunch of temporary variables for a form that may have hundreds (literally) of input fields. So, it looks like I'm back to

Re: Handling & =

2002-12-10 Thread Larry Coffin
At 2:15 PM -0500 12/10/02, John Stokes wrote: >Ah yes... That makes sense. > >That's the solution I've used in other cases (for instance, resolving a CGI >param to a path.) Unfortunately, it's not really practical to define a bunch >of temporary variables for a form that may have hundreds (literall

Re: Handling & =

2002-12-10 Thread John Stokes
Oh! Didn't think about that. Yes, that looks like a very workable solution. Thanks again. -John On 12/10/02 11:33 AM, "Larry Coffin" <[EMAIL PROTECTED]> wrote: > At 2:15 PM -0500 12/10/02, John Stokes wrote: >> Ah yes... That makes sense. >> >> That's the solution I've used in other cases (fo

RE: can we use "system()" inside cgi ?

2002-12-10 Thread Admin-Stress
I did read it, but still dont understand. What does "tainted" means? I changed my cgi like this : #!/usr/bin/suidperl Then : chown root:root saveconfig.pl chmod 755 saveconfig.pl It's now 'partly working', it can changed the content of /etc/sysconfig/... by overwriting it's content

RE: can we use "system()" inside cgi ?

2002-12-10 Thread Peter Kappus
I don't know much about suidperl but if I were doing this, I probably wouldn't give root privileges to my CGI. If it doesn't need to happen instantaneously, I'd consider a two-step approach: (of course, it probably does need to run instantaneously since you're doing it as a CGI anyway...) Instead

RE: can we use "system()" inside cgi ?

2002-12-10 Thread Admin-Stress
Thanks Peter, I was thinking about it too ... changing the content of interface configuration (in /etc/sysconfic/...), then by using cron job, make the change happen. But still, how often I must run the cron? I was thinking like every 10 seconds? hmm not good idea because this process will not h

Re: How to get the biggest integers from an array?

2002-12-10 Thread Geraint Jones
Use the sort function: print sort @array; and for largest number first use: print reverse sort @array; For your particular problem: @sorted_array = reverse sort @array; foreach (@sorted_array) { # whatever you want to do with each number

Re: How to get the biggest integers from an array?

2002-12-10 Thread Mystik Gotan
Oh, no, actually, I know quite about Perl. The problem is, I hardly have got any experience in programming, I read a lot. I've got 3 perl books and wasn't just thinking at the idea of using sort(). Thanks guys. -- Bob Erinkveld (Webmaster Insane Hosts) www.insane-hosts.net MSN: [EM

Re: Handling & =

2002-12-10 Thread Octavian Rasnita
You can use the CGI module this way: use CGI; my $q = new CGI; my $username = $q -> param('username'); my $password = $q -> param ('password'); ... #That's all with the CGI module. #Now you can use the normal HTML style of printing the page: print