[19219] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1414 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 31 06:10:50 2001

Date: Tue, 31 Jul 2001 03:10:13 -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: <996574213-v10-i1414@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 31 Jul 2001     Volume: 10 Number: 1414

Today's topics:
    Re: PERL binaries for version 5.005_03 <vsen@atrenta.com>
    Re: Perl Binary <pne-news-20010730@newton.digitalspace.net>
        Problems with with Perl, Cgi using the Dbi module (Karen Mindermann)
    Re: Problems with with Perl, Cgi using the Dbi module <cyberjeff@sprintmail.com>
    Re: question about CGI.PM~~~ help <swansun@kali.com.cn>
        Regular expression problem <yf32@cornell.edu>
    Re: Regular expression problem (Philip Lees)
        Search statments -> SQL -> DBI (MrBoom)
    Re: Self-Searchable Perl documention - Extremely Useful (John Holdsworth)
        simple question <blahblahblah@blah.com>
    Re: simple question <yf32@cornell.edu>
    Re: Sorting problem <monty@primenet.com>
    Re: suid support in Perl nobull@mail.com
        System command (David)
        Using CSS with CGI.pm <js@hotmail.com>
    Re: Using CSS with CGI.pm <godzilla@stomp.stomp.tokyo>
    Re: Using CSS with CGI.pm <Dave.Stafford@globis.net>
    Re: Who can help me about the confused (..) operator? <no@mail.addr>
    Re: win32.c:1631: structure has no member named `u' (John Kristian)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 30 Jul 2001 20:21:52 -0700
From: Vishwanath Sen <vsen@atrenta.com>
Subject: Re: PERL binaries for version 5.005_03
Message-Id: <3B662450.A6025948@atrenta.com>

Thanks Bart.

nsperl did the wonder for me. Thanks again.

- Vishwanath.

Bart Lateur wrote:

> Bart Lateur wrote:
>
> >> Can someone please  point me to the web-site from where I can download
> >>binaries for Perl version 5.005_03 for platforms - Solaris, HPUX and
> >>Linux ? Any hint or suggestions would be greatly appreciated.
> >
> >Check the ports section on CPAN.
> >
> >       <http://www.cpan.org/ports/index.html>
>
> I should have been clearer. You'll find links to the latest perl
> binaries here. But if you go to the directories from the URL's where you
> can get them from, you'll likely find more there, including older
> versions.
>
> Just as a test, I followed one of those links. And where did it bring
> me? Here:
>
>         <http://people.netscape.com/richm/nsPerl/>
>
> Lo and behold: 5.005_03 for all of Linux, Solaris, HPUX are available.
>
> --
>         Bart.



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

Date: Mon, 30 Jul 2001 07:18:54 +0200
From: Philip Newton <pne-news-20010730@newton.digitalspace.net>
Subject: Re: Perl Binary
Message-Id: <06r9mtov8gfv9c6jua4smhmfo3ug4elqg2@4ax.com>

On Mon, 30 Jul 2001 00:22:17 -0300, "Luciano" <lnc_18@yahoo.com.ar>
wrote:

> I need to find where download the perl binary distro for linux,

On Unix, Perl is generally distributed in source form -- you can get a
tarball from CPAN (have a loop at http://www.cpan.org/ and its mirrors)
and compile it yourself.

If you're running Linux, chances are you already have Perl on your hard
disk. Try running the command 'perl -v' and see whether it gives you
version information. If not, the provider of your Linux distribution
(SuSE, Red Hat, Debian, ...) may have a binary RPM (or equivalent)
available for installation; have you checked there?

Another possibility is to install ActivePerl (see
http://www.ActiveState.com/ ); this is a binary distribution which is
available for Win32, Linux, and Solaris. The latest Win32 version is
based on Perl 5.6.1; I don't know whether their Linux distribution is
the same or older.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: 31 Jul 2001 02:15:05 -0700
From: KMindermann@gmx.de (Karen Mindermann)
Subject: Problems with with Perl, Cgi using the Dbi module
Message-Id: <f946d81f.0107310115.dc5c264@posting.google.com>

Hi,
I wrote a perl cgi program which received params from a form. These
values shall be inserted into a sybase db.
I get the following error message from the Webserver when i try the
program.
"Can't call method "prepare" on an undefined value at
 .../cgi-bin/kmindermann/FernleiheResult.pl line 235. "

I have no idea where's the error. Any help would be great.
Greetings,
Karen

This is my program code:

#!/usr/bin/perl5.6
#------------------------------------------------------------------------------------------------
#KMindermann
#FernleiheResult.pl

#-------------------------------------------------------------------------------

BEGIN {
        $ENV{SYBASE} = '/edvs1/edvsoft/SYBASE.1003/sybase';
 
}

#------------------------------------------------------------------------------------------------
use CGI;
use CGI::Carp 'fatalsToBrowser';
use lib '/usr/local/lib/perl5/site_perl/5.6.0/sun4-solaris/';
use DBI;



$cgi = new CGI();


#-------------------------------------------------------------------------------

#Parameter

$Name = $cgi->param('Name');
$Vorname = $cgi->param('Vorname');
$Autor_Hrsgb = $cgi->param('Autor_Hrsgb');
$Long_Titel = $cgi->param('Long_Titel');
$Ort = $cgi->param('Ort');
$Verlag = $cgi->param('Verlag');
$Buchjahr = $cgi->param('Buchjahr');
$Seiten = $cgi->param('Seiten');
$Aufsatzverfasser = $cgi->param('Aufsatzverfasser'); 
$Long_Aufsatz = $cgi->param('Long_Aufsatz'); 
$Kommentar = $cgi->param('Kommentar'); 
$Zeitschriftjahr = $cgi->param('Zeitschriftjahr'); 
$Band = $cgi->param('Band'); 
$Heft = $cgi->param('Heft'); 
$EMail_Adresse = $cgi->param('EMail_Adresse'); 
$Funktion = $cgi->param('FUNKTION'); 
$Sprache = $cgi->param('SPRACHE');
$date=localtime;
$user = xyz;
$passwd = xyz;
$server= xyz;
$database= xyz;
$host= xyz;
$driver=Sybase;
#------------------------------------------------------------------------------------------------

#Abfrage, ob alle notwendigen Angaben gemacht wurden
#Sonst Ausgabe Fehlermeldung

&Angabe if($Vorname eq "" || $Name eq "" || $Long_Titel eq "" ||
$Aufsatzverfasser eq "") ;


sub Angabe {

 print $cgi->redirect('/html/kminderm/Fernleihe/FernLeihErrorVar.html');

}

#------------------------------------------------------------------------------------------------


#Datenbankverbindung herstellen
#Datenbank oeffnen

sub connect_2_DB {

  $dbh = DBI->connect("DBI:$driver:$database:$host", $user,
$password,{PrintError => 0, RaiseError => 0 });

 # print $cgi->redirect('/html/kminderm/Fernleihe/FernLeihErrorDB.html');

}
&connect_2_DB;



#-------------------------------------------------------------------------------

#-------------------------------------------------------------------------------

#Druckseite erstellen

print "Content-type: text/html\n\n";



&De_Buch if ($Sprache eq "GERMAN" && $Funktion eq "BUCH" );
&De_Zeit if ($Sprache eq "GERMAN" && $Funktion eq "ZEITSCHRIFT");
&Eng_Buch if ($Sprache eq "ENGLISH" && $Funktion eq "BUCH");
&Eng_Zeit if ($Sprache eq "ENGLISH" && $Funktion eq "ZEITSCHRIFT");

#Deutsch
                        
sub De_Buch  {


print "Content-type: text/html\n\n";
print "<html><head><title>Schreiben in
Fernleihe</title></head><body>\n";
print "<body bgcolor=#ffffff >\n";
print "<h3>Diese Seite bitte ausdrucken und zu Ihren Unterlagen
nehmen</h3>\n";
print "<p>Sie haben nachfolgendes bestellt: </p>\n";
print "<p>Bestelldatum: $date\n";
print "<br><b>Besteller/in:</b></br>\n";
print "Name:<b> $Name, $Vorname</b><br><HR>\n";
print "<b>Angaben zur Fernleihe</b><br>\n";
print "Autor/Hrsgb.: <b>$Autor_Hrsgb</b><br>\n";
print "Titel: <b>$Long_Titel</b><br>\n";
print "Erscheinungsort: <b>$Ort</b><br>\n";
print "Verlag: <b>$Verlag</b><br>\n";
print "Jahr: <b>$Buchjahr</b><br>\n";
print "Seiten: <b>$Seiten</b><br>\n";
print "Aufsatzverfasser: <b>$Aufsatzverfasser</b><br>\n";
print "Aufsatz: <b>$Long_Aufsatz</b><br>\n";
print "<HR>Mitteilungen:<b>$Kommentar</b><br>\n";
print "</body></html>\n";

                        
}

#Zeitschrift

sub De_Zeit {
print "Content-type: text/html\n\n";
print "<html><head><title>Schreiben in
Fernleihe</title></head><body>\n";
print "<body bgcolor=#ffffff >\n";
print "<h3>Diese Seite bitte ausdrucken und zu Ihren Unterlagen
nehmen</h3>\n";
print "<p>Sie haben nachfolgendes bestellt: </p>\n";
print "<p>Bestelldatum: $date\n";
print "<br><b>Besteller/in:</b></br>\n";
print "Name:<b> $Name, $Vorname</b><br><HR>\n";
print "<b>Angaben zur Fernleihe</b><br>\n";
print "Zeitschrift: <b>$Long_Titel</b><br>\n";
print "Jahr: <b>$Zeitschriftjahr</b><br>\n";
print "Band: <b>$Band</b><br>\n";
print "Heft: <b>$Heft</b><br>\n";
print "Seiten: <b>$Seiten</b><br>\n";
print "Autor: <b>$Aufsatzverfasser</b><br>\n";
print "Aufsatz: <b>$Long_Aufsatz</b><br>\n";
print "<HR>Mitteilungen:<b>$Kommentar</b><br>\n";
print "</body></html>\n";
                       
}
#------------------------------------------------------------------------------------------------

#Englisch


#Buch
sub Eng_Buch {
print "Content-type: text/html\n\n";
print "<html><head><title>Schreiben in
Fernleihe</title></head><body>\n";
print "<body bgcolor=#ffffff >\n";
print "<h3>Diese Seite bitte ausdrucken und zu Ihren Unterlagen
nehmen</h3><BR>\n";
print "<p>Sie haben nachfolgendes bestellt: </p>\n";
print "<p>Date of order: $date\n";
print "<BR><b>Orderer:</B><BR>\n";
print "Name: <B>$Name, Vorname</B><BR><HR>\n";
print "<b>Bibliographic Citation for Interlibrary Loan:</B><BR>\n";
print "Author/Editor: <B>$Autor_Hrsgb</B><BR>\n";
print "Title: <B>$Long_Titel</B><BR>\n";
print "Place: <B>$Ort</B><BR>\n";
print "Publisher: <B>$Verlag</B><BR>\n";
print "Year: <B>$Buchjahr</B><BR>\n";
print "Pages: <B>$Seiten</B><BR>\n";
print "Article Author: <B>$Aufsatzverfasser</B><BR>\n";
print "Article: <B>$Long_Aufsatz</B><BR>\n";
print "<HR>Comments: <B>$Kommentar</B><BR>\n";
print "</body></html>\n";
}

#Zeitschrift
sub Eng_Zeit {
print "Content-type: text/html\n\n";

print "<html><head><title>Schreiben in
Fernleihe</title></head><body>\n";
print "<body bgcolor=#ffffff >\n";
print "<h3>Diese Seite bitte ausdrucken und zu Ihren Unterlagen
nehmen</h3><BR>\n";
print "Sie haben bestellt am $date \n";
print "<BR><b>Library Patron:</B><BR>\n";
print "Name: <B>$Name, Vorname</B><BR><HR>\n";
print "<b>Bibliographic Citation for Interlibrary Loan:</B><BR>\n";
print "Journal: <B>$Long_Titel</B><BR>\n";
print "Year: <B>$Zeitschriftjahr</B><BR>\n";
print "Volume: <B>$Band</B><BR>\n";
print "Pages: <B>$Seiten</B><BR>\n";
print "Author: <B>$Aufsatzverfasser</B><BR>\n";
print "Article: <B>$Long_Aufsatz</B><BR>\n";
print "<HR>Comments: <B>$Kommentar</B><BR>\n";
print "</body></html>\n";
}


#-------------------------------------------------------------------------------


sub Eintrag_2_DB {
       
  if ($Funktion eq "BUCH") {
    $columns='Vorname,Name,Long_Titel,Buchjahr,Autor_Hrsgb,Ort,Verlag,Seiten,Aufsatzverfasser,Long_Aufsatz,Kommentar,EMail_Adresse';
    $value="('$Vorname','$Name','$Long_Titel','$Buchjahr','$Autor_Hrsgb','$Ort','$Verlag','$Seiten','$Aufsatzverfasser','$Long_Aufsatz','$Kommentar','$EMail_Adresse')";
                
        }
   if ($Funktion eq "ZEITSCHRIFT"){
     $columns="(Vorname,Name,Long_Titel,Zeitschriftjahr,Band,Heft,Seiten,Aufsatzverfasser,Long_Aufsatz,Kommentar,EMail_Adresse)";
     $value="('$Vorname','$Name','$Long_Titel','$Zeitschriftjahr','$Band','$Heft','$Seiten','$Aufsatzverfasser','$Long_Aufsatz','$Kommentar','$EMail_Adresse')";
                
        }
      }

#Daten an die Datenbank schicken
&Eintrag_2_DB;

$statement=('INSERT INTO Ill_new ($columns) values ($value)');
$sth=$dbh->prepare($statement);
$sth->execute;
$sth->finish;
$dbh->disconnect;


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

Date: Tue, 31 Jul 2001 09:35:54 GMT
From: Jeff Thies <cyberjeff@sprintmail.com>
Subject: Re: Problems with with Perl, Cgi using the Dbi module
Message-Id: <39D06E14.82921D96@sprintmail.com>

> Hi,
> I wrote a perl cgi program which received params from a form. These
> values shall be inserted into a sybase db.
> I get the following error message from the Webserver when i try the
> program.
> "Can't call method "prepare" on an undefined value at
> .../cgi-bin/kmindermann/FernleiheResult.pl line 235. "

<snipped long bit of code>

You have a problem with your database handle $dbh; Turn on error
checking for your database handle. RaiseError=>1

Jeff


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

Date: Tue, 31 Jul 2001 14:40:58 +0800
From: "swansun" <swansun@kali.com.cn>
Subject: Re: question about CGI.PM~~~ help
Message-Id: <9k5jtf$isa$1@mail.cn99.com>

thank you very much!!!
:)

"David Efflandt" <see-sig@from.invalid> wrote in message
news:slrn9mbtou.an6.see-sig@typhoon.xnet.com...
> On Mon, 30 Jul 2001 16:55:32 +0800, swansun <swansun@kali.com.cn> wrote:
> > i'm using the CGI.PM to write a perl script
> > to upload files now,and it work!
> > but i want to know how can i know the size of the uploaded file?
> > who can help me? thanks.
>
> Either keep a running total of each line if read as a text file or
> $bytesread if saving it as binary (slightly modified from perldoc CGI):
>
> # Copy a binary file to somewhere safe
> if (open (OUTFILE,">>/usr/local/web/users/feedback")) {
>     while ($bytesread=read($filename,$buffer,1024)) {
>         $totalbytes += $bytesread;
>         # do something else if $totalbytes gets too big
>         print OUTFILE $buffer;
>     }
> } else {
>    # print error that file would not open including reason $!
> }
>
> Or if you simply want to know the size after it is saved, use the -s file
> test operator ($size = -s $savedfile).
>
> --
> David Efflandt  (Reply-To is valid)  http://www.de-srv.com/
> http://www.autox.chicago.il.us/  http://www.berniesfloral.net/
> http://cgi-help.virtualave.net/  http://hammer.prohosting.com/~cgi-wiz/




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

Date: Tue, 31 Jul 2001 00:35:49 -0400
From: "Young C. Fan" <yf32@cornell.edu>
Subject: Regular expression problem
Message-Id: <9k5ch1$d1f$1@news01.cit.cornell.edu>

Hi,

I'm having trouble with a simple regular expression -- any help would be
really appreciated.

I'm trying to turn the following:



possibly some characters<tagname>random characters all on one
line</tagname>possibly some characters

possibly some characters<tagname>more random characters all on one
line</tagname>possible some characters

possibly some characters<tagname>again, more
random characters,
but this time possibly spanning multiple
lines</tagname>and then more characters


into:


possibly some characters<a href="random characters all on one
line">link</a>possibly some characters

possibly some characters<a href="more random characters all on one
line">link</a>possible some characters

possibly some characters<a href="again, more
random characters,
but this time possibly spanning multiple
lines">link</a>and then more characters



The code I have is below. I also want to make substitutions only when
<tagname> is not immediately followed by a < character, as well a slightly
different substitution when <tagname> *is* followed by a < character. I
don't understand why, but the substitutions are working incorrectly. Any
help would be greatly appreciated.

Young


#!/usr/bin/perl

open(SOURCEFILE, "<test.txt");  # open file for input
@info = <SOURCEFILE>;   # copy file contents to array
$info2 = "@info";    # copy array contents as one string

$parse_phrase = "tagname";

$info2 =~ s/(<${parse_phrase}>)([^<])(.*)?(<\/${parse_phrase}>)?/<a
href="$2$3">link</a>/sg;
$info2 =~ s/(<${parse_phrase}>)(.*)?(<\/${parse_phrase}>)?/<a href="$2"
target="_new">link</a>/sg;


print $info2;




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

Date: Tue, 31 Jul 2001 07:06:12 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Re: Regular expression problem
Message-Id: <3b66580a.64408875@news.grnet.gr>

On Tue, 31 Jul 2001 00:35:49 -0400, "Young C. Fan" <yf32@cornell.edu>
wrote:

>I'm trying to turn the following:
>
>possibly some characters<tagname>random characters all on one
>line</tagname>possibly some characters
>
>possibly some characters<tagname>again, more
>random characters,
>but this time possibly spanning multiple
>lines</tagname>and then more characters
>
>into:
>
>possibly some characters<a href="random characters all on one
>line">link</a>possibly some characters
>
>possibly some characters<a href="again, more
>random characters,
>but this time possibly spanning multiple
>lines">link</a>and then more characters

I'm not sure what your substitution should be when <tagname> is
followed immediately by <, but these seem to be close to what you
want:

$info2 =~ s!<$parse_phrase>([^<]+?)</$parse_phrase>!<a
href="$1">link</a>!sg;

$info2 =~ s!<$parse_phrase>(<(.*)?)</$parse_phrase>!<a href="$1"
target="_new">link</a>!sg;

Note the use of ! as a delimiter so that you don't have to escape the
slashes.

You might also consider looking at one of the HTML parser modules.

Phil
-- 
Philip Lees
ICS-FORTH, Heraklion, Crete, Greece
Ignore coming events if you wish to send me e-mail
'The aim of high technology should be to simplify, not complicate' - Hans Christian von Baeyer


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

Date: 31 Jul 2001 02:36:19 -0700
From: andy_isherwood@hotmail.com (MrBoom)
Subject: Search statments -> SQL -> DBI
Message-Id: <9b6a13b2.0107310136.bb9fea9@posting.google.com>

I have an Access database which I am producing dynamic web pages from
using Perl and the DBI. Currently these pages are being generated SQL
statements which are hard coded in the Perl scripts.

The next task I've been given is to produce a web search facility for
the database. A number of the fields in the database are free text
fields, these are the ones I'll want to be searching. What I'd like to
do is take a search statement, eg:

+"the phantom menace" +maul -"jar jar"

and convert that into a form which could be inserted into my SQL
statement.

Does anyone know of the best way of doing this?

Also, I'd like to rank the results in order of relevance. What is the
best way of doing this?

This seems to me to be the sort of thing that there should be a module
for, does anyone know if there is?

Thanks very much
Andrew


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

Date: 30 Jul 2001 20:25:11 -0700
From: coldwave@bigfoot.com (John Holdsworth)
Subject: Re: Self-Searchable Perl documention - Extremely Useful!
Message-Id: <2a46b11e.0107301925.4c41aabb@posting.google.com>

> Hi John,
> 
> I tried it out, and it's really cool. Could you tell us a little bit 
> about how it works? In particular:
> 
> - Where is the web server? Does IE have a server built-in and listening 
> on port 8088?

Hi David,

The web server code is entirely embedded in the page and implemented
in perl or rather "PerlScript" which is a little hidden gem in the
Active Perl release. Inside Internet Explorer you can use perl as
as scripting language as you would JavaScript and once you can do
this you can run a Web server inside the browser (odd I know).

I don't know that much about the innards of IE but it seems to be
muti-threaded and the server runs itself once the page is loaded
polling to see if a browser (itself) has connected every 100ms
using a "setTimeout()" callback. Once a connection has been made
some regular expressions in function accepted() parse the header
and pass the request onto processRequest() in the environent which
is coded as you would a CGI script.

> - How are you running Perl? I see that you mentioned PerlScript in 
> another post...

Somebody did a very impressive job on PerlScript which is a complete
Perl implementation (minus threads). It seems to "OLE" in somehow and
gives you full access to most of the DOM for accesing page elements.
You can call perl from Javascript and I think the other way round.
There is a little documentation and an FAQ.

http://aspn.activestate.com/ASPN/Reference/Products/ActivePerl/Components/Windows/PerlScript.html
http://www.fastnetltd.ndirect.co.uk/Perl/perl-win32-asp.html

> - What about cross-platform, cross-browser compatibility? Do you just 
> need a browser with PerlScript? Any other requirements?

No dice here alas. Only IE realy supports OLE and access to activeX
objects which is presumably how they have wrapped up perl so it can
be called from inside IE (and any windows scripting whatever it
seems).

> The main reason I ask is that I'm interested in techniques for building 
> web-based interfaces to Perl programs, and most Windows folks don't have 
> web servers running on their machines.

This is one way to go about it distributing html wth embedded perl
to provide an interface rather than scripts. Change the method
processRequest() to do what to want the script to do. Arguments
from the form arrive in the hash reference $argh though using CGI.pm
should also work. One thing I had problems with is when you print too
much IE will threadlock eventually between the perl thread and the
thread rendering the page. This is why output is buffered and sent
in chunks by repeated callbacks by sendResponse(). This gives the
rendering thread a chance to run.

> Thanks!

John.


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

Date: Tue, 31 Jul 2001 03:52:15 GMT
From: "Hmmm..." <blahblahblah@blah.com>
Subject: simple question
Message-Id: <PXp97.8867$bl1.1343080@newsread1.prod.itd.earthlink.net>

I have a perl script (let's call it a.pl) that prompts for user
identification on an html form.  The form kicks off another another perl
script (let's call is b.pl) which validates the user identification.  If
validation fails in b.pl, I would like to display the original html page and
let the user try again.  If validation succeeds in b.pl, I would like to run
another script to display the main menu page of an application.  How would
you do this?

I tried using exec to run a.pl from b.pl when validation failed.  The
original page would display,  but the browser address still showed b.pl in
stead of a.pl.

Also, using exec, I could not pass an argument from b.pl to a.pl when
running from a browser, even though I was able to pass the argument from
b.pl to a.pl when testing b.pl from a Unix shell.

Any help would be appreciated.  Thanks.




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

Date: Tue, 31 Jul 2001 00:57:38 -0400
From: "Young C. Fan" <yf32@cornell.edu>
Subject: Re: simple question
Message-Id: <9k5dpt$f0d$1@news01.cit.cornell.edu>

"Hmmm..." <blahblahblah@blah.com> wrote in message
news:PXp97.8867$bl1.1343080@newsread1.prod.itd.earthlink.net...
> I have a perl script (let's call it a.pl) that prompts for user
> identification on an html form.  The form kicks off another another perl
> script (let's call is b.pl) which validates the user identification.  If
> validation fails in b.pl, I would like to display the original html page
and
> let the user try again.  If validation succeeds in b.pl, I would like to
run
> another script to display the main menu page of an application.  How would
> you do this?

# this is b.pl
# do authentication stuff
if(authentication_fails)
{
    print "Location: http://path_to/a.pl\n";
    print "Content-type: text/html\n\n";
}
else
{
    print "Location: http://path_to/mainpage.pl\n";
    print "Content-type: text/html\n\n";
}

>
> I tried using exec to run a.pl from b.pl when validation failed.  The
> original page would display,  but the browser address still showed b.pl in
> stead of a.pl.

Using the Location HTTP header should take care of that. It's just a
redirect. Don't print out anything before the header (e.g. no HTML).

>
> Also, using exec, I could not pass an argument from b.pl to a.pl when
> running from a browser, even though I was able to pass the argument from
> b.pl to a.pl when testing b.pl from a Unix shell.

You can use:

print "Location: http://path_to/a.pl?name1=value1&name2=value2\n";


>
> Any help would be appreciated.  Thanks.
>
>




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

Date: 31 Jul 2001 03:02:41 GMT
From: Jim Monty <monty@primenet.com>
Subject: Re: Sorting problem
Message-Id: <9k574h$pce$2@nnrp2.phx.gblx.net>

Benjamin Goldberg <goldbb2@earthlink.net> wrote:
> Jim Monty's message in this thread showed a Schwartzian Transform, I
> prefer to use GRT when possible:
>
>       map   { /[^\x00]*\x00[\x00-\xFF](.*)/ }
>       sort
>       map   { pack 'Z*Ca*', /^(\D*)(\d*)/, $_; }
>       qw    { abc23 abc113 cde34 abc5 cde4 def77 abc1 };
> __END__
>
> [Much explanation of the Guttman-Rosler Transform and its Byzantine
> nuances snipped]

You've demonstrated why the Schwartzian Transform is Baby Bear's
efficient Perl sorting idiom. It's juuuuust right!

Personally, I've never had the bal^Wcourage to use a GRT.

-- 
Jim Monty
monty@primenet.com
Tempe, Arizona USA


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

Date: 30 Jul 2001 18:29:40 +0100
From: nobull@mail.com
Subject: Re: suid support in Perl
Message-Id: <u9hevuuxyz.fsf@wcl-l.bham.ac.uk>

"Tintin" <somewhere@in.paradise.net> writes:

> I'm running Mandrake 8.0 that had a RPM version of Perl 5.6.0 installed.  I
> was using a script that had sgid bit set (to read mail).  I then manually
> installed Perl 5.6.1 and the sgid bit was being ignored.
> 
> What could cause this?

Not selecting the options to build Perl with SUID script support.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 31 Jul 2001 03:03:11 -0700
From: danova@multimania.com (David)
Subject: System command
Message-Id: <6ef50363.0107310203.7b1b72e@posting.google.com>

I have written a perl script and I have a problem while trying to
execute a system command.
In fact I have a Makefile to compile an external program. So I try to
execute the following command:

system ("path_to_the_makefile/make");

This command does not seems to work so does anyone know how can I run
the execution of a Makefile in perl.

Thanks


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

Date: Tue, 31 Jul 2001 03:43:00 GMT
From: "Kenneth Eide" <js@hotmail.com>
Subject: Using CSS with CGI.pm
Message-Id: <8Pp97.1209$Nk1.99626@news01.chello.no>

Hello guys.

I want to use Cascading Style Sheets with my CGI script but I'm having
trouble findig out how to specify how to use css, and what file to use. I'm
writing my CGI with CGI.pm.


This is how my script looks now, but it doesn't work:

#!/usr/bin/perl -w

use CGI;
my $q = new CGI;
print $q->header('text/html');
print $q->start_html(-title=>'test'
,-style=>{'src'=>'/home/bleh/public_html/cgi-bin/test.css'});
print $q->end_html;

print "test test test test test";
--------------------------------------------

Here's what test.css looks like:

body { background-color: #92B8BD}
------------------------------------------




Extra info if needed:

This is the line you use in a plain .html file to specify what .css file to
use:
<link rel="stylesheet" href="test.css" type="text/css">
------------------------------------------
And here is what a .html file using css looks like:

<html>
<head>

<style type="text/css">
body {background-color: yellow}
h1 {background-color: #00ff00}
h2 {background-color: transparent}
p {background-color: rgb(250,0,255)}
</style>

</head>

<body>

<h1>This is header 1</h1>
<h2>This is header 2</h2>
<p>This is a paragraph</p>

</body>
</html>

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

I'm really confused! Hope you're not.
Help would be much appriciated.

Thanks!!




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

Date: Mon, 30 Jul 2001 21:16:27 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Using CSS with CGI.pm
Message-Id: <3B66311B.32078641@stomp.stomp.tokyo>

Kenneth Eide wrote:

(snipped)

> I want to use Cascading Style Sheets with my CGI script but I'm having
> trouble findig out how to specify how to use css, and what file to use.
> I'm writing my CGI with CGI.pm.

You may discover trying to print a server side include
call with a script, will exhibit behavior very similar
to what you are experiencing with the -style switch.

Here is some paraphrased documentation.

A -style argument allows you to define a style sheet.
You may specify a string or reference a hash. The keys
you use are  -code  and  -src  in conjunction. The value
of -code will be included in your print as style sheet
information. Use of -src will be an URL to a .css file.

You can expect cgi.pm to wrap comment tags around your
code to prevent non-style sheet browsers from becoming
totally FUBAR. You can also expect cgi.pm to screw-up
just about anything you try. Chances are good you will
have better luck including your style whatever, within
your script print. You will have even better luck if
you dump cgi.poopmaker and write your own code.

Research and read Stein's cgi.pm documentation. This
will prove to be relatively painless and, perhaps
to your benefit.


Godzilla!


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

Date: Tue, 31 Jul 2001 09:54:56 GMT
From: "Dave Stafford" <Dave.Stafford@globis.net>
Subject: Re: Using CSS with CGI.pm
Message-Id: <Qfv97.301076$XL1.5312064@nlnews00.chello.com>

>"Kenneth Eide" <js@hotmail.com> wrote in message

> I want to use Cascading Style Sheets with my CGI script but I'm having
> trouble findig out how to specify how to use css, and what file to use.
I'm
> writing my CGI with CGI.pm.

Er.. why bother? You are spending a lot of time and effort find a
significantly more complicated way of writing:

print q|<link rel="stylesheet" href="test.css" type="text/css">|;

You don't gain anything from using CGI.pm's (IMO pointless) abstraction of
HTML in this case. You are, however, wasting a lot of your time trying to
make it work.

Use CGI.pm for parsing variables passed through the CGI.
Write the HTML in a separate file.
Use a template program to change the file as you need.

Dave






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

Date: Tue, 31 Jul 2001 09:57:39 +0800
From: MMX166+2.1G HD <no@mail.addr>
Subject: Re: Who can help me about the confused (..) operator?
Message-Id: <20bamtgkp3uf78fdprk2l16dvbib8iepvq@4ax.com>

On Mon, 23 Jul 2001 08:58:19 GMT, in comp.lang.perl.misc Bart Lateur
<bart.lateur@skynet.be> wrote:
>MMX166+2.1G HD wrote:
>
>>Terrible range operator (..) which in the scalar context...I had read
>>the perldoc many times, but I can't understand it at all.
>
>In scalar context, it's not a range operator. It's an entirely different
>operator which just happens to be written the same. A homonym.
>
>In scalar context, it's called the flip-flop operator, which won't mean
>much to you unless you're into digital electronics.
>
>It's an operator with built-in (1 bit) memory. Every time it's
>evaluated, its memory may change (between true and false). Initially,
>it's set to false. In that case, the left hand side gets tested. If it's
>true, the memory is set to true, and the value it returns is true too.
>Otherwise, memory remains false and value returned is false.
>
>When memory is true, the right hand side gets tested. If it's true, the
>memory is turned off to false, the value returned is true (for the last
>time). Otherwise, memory remains true, value is true.
>
>Thus: it is true from the time when the LHS is true up to and including
>when the RHS is true.
>
>p.s. Actually, the value returned is not a boolean but a number, a
>counter, with a special "last time" indicator: an appended "E0" which
>doesn't change the boolean or numerical value.
>
>	for my $i (1..10) {
>	    if(my $test = ($i==5 .. $i==8)) {
>	        # from when $i is 5 up to when $i is 8
>	        print "$i -> $test\n";
>	    }
>	}
>-->
>	5 -> 1
>	6 -> 2
>	7 -> 3
>	8 -> 4E0

thank you. I have understood.


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

Date: 31 Jul 2001 00:57:06 -0700
From: jmk2001@engineer.com (John Kristian)
Subject: Re: win32.c:1631: structure has no member named `u'
Message-Id: <b6ae18db.0107302357.eb21a2b@posting.google.com>

"J.Jacob" <jacobjf@cistron.nl> wrote:
> win32.c:1631: structure has no member named `u'
> win32.c:2505: union has no member named `u'
> win32.c:2506: union has no member named `u'

To build Perl using MinGW-1.0.1-20010726,  I found it necessary to
change win32.c, as follows (from `diff -u`):

--- Perl-5.6.1/win32/win32.c    Sat Mar 03 20:53:19 2001
+++ Perl-5.6.1-MinGW/win32/win32.c Mon Jul 30 22:40:17 2001
@@ -1627,7 +1627,7 @@
        char *arch;
        GetSystemInfo(&info);

-#if (defined(__BORLANDC__)&&(__BORLANDC__<=0x520)) ||
defined(__MINGW32__)
+#if (defined(__BORLANDC__)&&(__BORLANDC__<=0x520))
        switch (info.u.s.wProcessorArchitecture) {
 #else
        switch (info.wProcessorArchitecture) {
@@ -2047,7 +2047,7 @@
 DllExport char *
 win32_strerror(int e)
 {
-#ifndef __BORLANDC__           /* Borland intolerance */
+#if ! (defined(__BORLANDC__) || defined(__MINGW32__)) /* Borland
intolerance */
     extern int sys_nerr;
 #endif
     DWORD source = 0;
@@ -2501,7 +2501,7 @@
     StreamId.dwStreamId = BACKUP_LINK;
     StreamId.dwStreamAttributes = 0;
     StreamId.dwStreamNameSize = 0;
-#if defined(__BORLANDC__) || defined(__MINGW32__)
+#if defined(__BORLANDC__)
     StreamId.Size.u.HighPart = 0;
     StreamId.Size.u.LowPart = dwLen;
 #else

---
Without these changes, compilation fails with one of the following
errors:

gcc -c -I..\lib\CORE -I.\include -I. -I.. -DWIN32  -DPERLDLL
-DPERL_CORE -g -O2 -o.\mini\win32.o win32.c
win32.c: In function `win32_uname':
win32.c:1631: structure has no member named `u'
win32.c:1636: warning: unreachable code at beginning of switch
statement
win32.c: In function `Nt4CreateHardLinkW':
win32.c:2486: warning: initialization from incompatible pointer type
win32.c:2505: union has no member named `u'
win32.c:2506: union has no member named `u'
win32.c: In function `win32_link':
win32.c:2537: warning: assignment from incompatible pointer type
win32.c: In function `w32_DomainName':
win32.c:3675: warning: assignment from incompatible pointer type
win32.c:3677: warning: assignment from incompatible pointer type
win32.c:3695: warning: passing arg 2 of `WideCharToMultiByte' makes
integer from pointer without a cast
win32.c:3699: warning: passing arg 2 of `WideCharToMultiByte' makes
integer from pointer without a cast
dmake.exe:  Error code 1, while making '.\mini\win32.o'

 D:\bin\MinGW-1.0.1\bin\..\lib\gcc-lib\mingw32\2.95.3-5\..\..\..\..\mingw32\bin\ld.exe
--subsystem console -Bdynamic -o ..\miniperl.exe
D:/bin/MinGW-1.0.1/bin/../lib/gcc-lib/mingw32/2.95.3-5/../../../crt2.o
-Lc:\perl\5.6.1\lib\MSWin32-x86\CORE -Lc:\gcc-2.95.2-msvcrt\lib
-LD:/bin/MinGW-1.0.1/bin/../lib/gcc-lib/mingw32/2.95.3-5
-LD:/bin/MinGW-1.0.1/bin/../lib/gcc-lib
-LD:/bin/MinGW-1.0.1/bin/../lib/gcc-lib/mingw32/2.95.3-5/../../../../mingw32/lib
-LD:/bin/MinGW-1.0.1/bin/../lib/gcc-lib/mingw32/2.95.3-5/../../..
d:\tmp\mk000001 -lmingw32 -lgcc -lmoldname -lmsvcrt -luser32
-lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmsvcrt
 .\mini\win32.o: In function `win32_strerror':
//D/bin/Installers/Perl-5.6.1/win32/win32.c:2055: undefined reference
to `_sys_nerr'
dmake.exe:  Error code 1, while making '..\miniperl.exe'

-----------------------------------------------------------------
I also found it necessary to change win32/makefile.mk, as follows
(in addition to the changes recommended in README.win32):

--- Perl-5.6.1/win32/makefile.mk        Mon Apr 09 06:13:49 2001
+++ Perl-5.6.1-fixed/win32/makefile.mk     Mon Jul 30 22:41:08 2001
@@ -1241,8 +1241,8 @@
        copy ..\README.dos      ..\pod\perldos.pod
        copy ..\README.epoc     ..\pod\perlepoc.pod
        copy ..\README.hpux     ..\pod\perlhpux.pod
-       copy ..\README.machten  ..\pod\perlmachten.pod
-       copy ..\README.macos    ..\pod\perlmacos.pod
+#      copy ..\README.machten  ..\pod\perlmachten.pod
+#      copy ..\README.macos    ..\pod\perlmacos.pod
        copy ..\README.mpeix    ..\pod\perlmpeix.pod
        copy ..\README.os2      ..\pod\perlos2.pod
        copy ..\README.os390    ..\pod\perlos390.pod

These README files are not included in the 5.6.1 distribution, so
`make install` fails when it attempts to copy them.


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 1414
***************************************


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