[7060] in Perl-Users-Digest
Perl-Users Digest, Issue: 685 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 30 09:07:31 1997
Date: Mon, 30 Jun 97 06:00:33 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 30 Jun 1997 Volume: 8 Number: 685
Today's topics:
### FreePics ### ap7@ap7.com
a Newbie F.A.Q avaible !! <hotline@asi.fr>
Re: assoc. arrays <sheiness@no.canned.meat.austin.ibm.com>
Re: Commented Complex Regexes? <sfairey@adc.metrica.co.uk>
Re: data compression in perl? (Andrew M. Langmead)
Re: get end of string (easy question) <sheiness@zcmds.austin.ibm.com>
HELP <abimana@callisto.org.za>
Re: It slices, It dices (what is a glog) <pdcawley@aladdin.net>
Re: ODBC @@identity problem (Brian Jepson)
Re: ODBC @@identity problem (Brian Jepson)
Re: Pattern matching question (Sascha Ottolski)
Re: Pattern matching question (Jean-Damien Durand)
Re: Pattern matching question (Tung-chiang Yang)
Re: Perl 5.003 setuid -- please! (Sascha Ottolski)
Problem: NTMAIL and Perl <ip@cybernet.dk>
Re: references (Andrew M. Langmead)
Re: Trickey Regex... need thoughts <pdcawley@aladdin.net>
Re: what is my, lc and etc and where to learn it? <sheiness@es.pea.eigh.em>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 Jun 97 10:36:48 GMT
From: ap7@ap7.com
Subject: ### FreePics ###
Message-Id: <33b4e940.0@news.genesisnetwork.net>
## FreePics ##
FREE PHONE BONE
All For You! All For FREE!!
011-592-563-560
Click Here For Your Free Pic!
http://207.71.229.66/sexygirls/samples/blondes.html
------------------------------
Date: Mon, 30 Jun 1997 11:02:19 +0200
From: hotline <hotline@asi.fr>
Subject: a Newbie F.A.Q avaible !!
Message-Id: <33B77617.2CCFE980@asi.fr>
This is a multi-part message in MIME format.
--------------AC552125292220DE32382C3C
Content-Type: text/plain; charset=us-ascii
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Transfer-Encoding: 7bit
Hi ,
I have written a Newbie F.A.Q.,
It was first posted in the Perl-Win32-Users@ActiveWare.com mailling
list, as it was a success
i just think that you might need it , so i attach the FAQ with this mail
, if you can't find it
in your eudora/attach or detach , or if you can't recieved it , you can
find it at:
http://www.geocities.com/SiliconValley/Heights/9736 on dominic's page.
Check it and mail me if you got a problem, i work on a french version.
If anyone got time to translate it in is own NATIVE language , it will
be kool,
Soon it will be avaible at http://www.asi.fr/NtPerl
Best regards
cya
--------------AC552125292220DE32382C3C
Content-Type: text/plain; charset=us-ascii; name="PERLgg.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="PERLgg.txt"
NEWBIE FAQ v1.01
Author: OLIVER <oliver@asi.fr>
Date: Fri, 27 Jun 1997 17:02:43 +0200
*******************************************************
* Perl on NT: Installation & DATABASE V 1.01 *
*******************************************************
From: Gerald OLIVER (Lyon-France) 3eme annee Stage MIAGE 97
- - - - - - --+-- - - - - - -
GERALD OLIVER OLIVER@asi.fr | Tel : 0478930000 Fax : ~99
A.S.I. Espace Double Mixte | 43, bd du 11 novembre 1918
www.asi.fr info@asi.fr | 69622 Villeurbanne Cedex
" Acces et Solutions Internet, French PROVIDER"
==============================================================================
SPECIAL THANKS:
Dave Roth ...glittering prizes and
Roth Consulting endless compromises, shatter
rothd@roth.net the illusion of integrity
Aldo Calpini
---/\-----------------------------------------------------------
--/ \--------------------------------- mailto:dada@divinf.it --
-<dada>-- POPULUS VULT DECIPI, -------- mailto:sis@divinf.it ---
--\ /------- ERGO DECIPIATUR --------- http://sis.divinf.it ---
---\/-----------------------------------------------------------
LAURENT_FILHOL@HP-France-om8.om.hp.com ( Mon poto frenchy :) )
And PERL, Activeware , all the ones from Perl-Win32-Users
==============================================================================
INTRODUCTION:
============
The Hell ... May be that's what you might think about trying to install
PERL on NT. As a member of the Perl's mailling list : <Perl-Win32-Users@ActiveWare.com>,
I have noticed the same questions come back every day. Now the days, NT becomes
a standard to reach the Net and to publish informations for the entreprises.
Many people is trying now to install Perl on NT, but Perl is at first
designed for UNIX. So the installation is quite complexe and surely not a
click and play's one.
A day i crashed NT (power zapped) ... after an huge battle for a rebuild, i
noticed that i have forgot how to install Perl, and that there was no step by
step installation. So with friends and with the help of Perl's advanced
users and developpers we've released this one...
The aim is to help the newbies and to refresh our memory when the NT's JOKE
is back :). The Pros of this mailling list get more and more fed up with it,
some wants to create an advanced one just to avoid repeating the same thing
everyday... i understand but what can a newbies' perl mailling list do , if
none of us can answer complex questions ?
That's why i've started creating this "how to install", hoping that
next, several modules will be added. I don't want this to become a commercial
stuff , it's a FREEWARE !! and must stay as this ( Net pionners' attittude ).
With this you will now how to install perl on Windows NT(R), and how to
handle DATABASE.
1 GENERAL:
==========
1-1) REQUIEREMENTS:
To publish and administrate your entreprise's DATAS, you Need :
- WINDOWS NT (server only ?) 3.51, 4.0 or 5.0
- Service Pack 2.0 or 3.0 (it's on the CD)
- Netscape or Internet explorer or another browsner.
- Perl for Win32 (intel): pw32i306.exe
[ftp://www.activeware.com/Perl-Win32/Release/pw32i306.exe]
- Perl for IS-API (intel): plisi306.exe
[ftp://www.activeware.com/Perl-Win32/Release/plisi306.exe]
- PerlScript (intel): plsei306.exe
[ftp://www.activeware.com/Perl-Win32/Release/plsei306.exe]
- Win32::ODBC module: Win32odbc_v970208.zip
[ftp://ftp.roth.net/pub/ntperl/Win32odbc_v970208.zip]
1-2) RESOURCES:
1-2-1) PERL Home Page:
You can find here almost the thing you are looking at:
"http://www.perl.com"
Perl institute: "http://www.perl.org"
1-2-2) The Mailling lists:
You will find them at:
"http://www.perl.com/perl/info/mailing-lists.html"
1-2-3) The Newsgroups:
You will find them at:=
"http://www.perl.com/perl/info/newsgroups.html"
1-2-4) The Web Links:
You will find them at:
"http://www.perl.com/perl/info/other_resources.html"
1-2-5) The Perl journal:
You will find them at:
"http://orwant.www.media.mit.edu/the_perl_journal/"
1-2-6) The famous Dave ROTH page (ODBC module for perl)
Respect for DAVE at: "http://www.roth.net"
1-3) ENVIRONMENT:
The NT service Pack installs Internet Information SERVER (IIS alias ASP
(version 3.0)) With IIS , you can already publish database on the NET, but you
can only do basic queries, "select * from foo_table where foo_name='bar'; " :),
There's no logic such as "if foo_name is empty then do this else do that".
So you need a 3GL language as perl ( The famous One).
TIPS: I install my drive like that,
On a 800 Mo hard drive , i create a 500 Mo FAT partition (boot's one
and active) and a 300 Mo NTFS Partition (unhidded). I install Win95
and winNT on the FAT part. I install IIS inetpub dir
(wwwroot/ftproot/gopheroot) on the NTFS one.
By doing this i can face the NT zap crash :Win95 allows me to boot
(keeping the CD drive). The FAT help me to see my drive (NTFS can't
be seen via DOS/Win95 , even with "NTFS for Dos" or " Tiramisu soft" ..).
The NTFS part allows the administration of what we've published (access
permissions).
2 Perl Installation :
-=-=-=-=-=-=-=-=-=-=-=-=-
Well i suppose that NT,IIS and Netscape (or other browsers) are installed;
if not, check at "http://www.microsoft.com" how to install it.
Then made a dir called "e.g c:\perlinst", "md perlinst, cd perlinst"
and copy "pw32i306.exe, plisi306.exe, plsei306.exe, Win32odbc_v970208.zip" inside.
Then uncompress the pw32i306.exe (launch it) to "e.g c:\perl".
The simple way to avoid conflicts is to say "yes" to every default prompt.
When it reboot do the same with plisi306.exe and plsei306.exe into
c:\perl And then unzip Win32odbc_v970208.zip to c:\perl.
To avoid the "PARSE ERROR":
Copy "c:\perl\beta\lib\auto\win32\odbc\odbc.pll" on
"c:\perl\lib\auto\win32\odbc\odbc.pll", due to the fact that the original one is
designed for the 303's version and the upgrade needs the beta.
To avoid the "Error 500: Server Error":
Make sure that the dir inetpub got the Read and execute permission (the
chmod of NT :))
- click on "startup menu/programs/microsoft internet server(common)/service
manager"
- A box comes with a list of services that provided telling us if it works
or not.
Double click on the WWW service (be sure the "started" is wrote). Select dir tab.
Double click on the root (e.g: c:\inetpub) dir ( with the house icon).
Check the read permission ( you can check the exec permission if you want )
- One part of the "Error 501: not implemented" can be fix by double
clicking on "\inetpub\scripts\" dir and set an exec permission only.
- Ok,Apply and exit
To avoid the "Error 501: not implemented":
You must change the registry on one point,
- click on the "startup menu/execute", and put "regedt32.exe", say ok
- by double clicking, browsne to :
"HKEY_LOCAL_MACHINE\SYSTEME\CurrentControlSet\Services\W3SVC\Parameters\Scri
ptMap"
and add: (Add Value =>in Edit Menu)
Value Name : => .pl
Data Type => REG_SZ
String Value => <full path to perl.exe>\perl.exe %s %s
restart the WWW service
- Click on "startup menu/parameters/control panel".
Click on the Service icon.
The list of all the service that NT manage are in here.
Make the profit to shoot thoses which take CPU and that you don't
need anymore It will be lagless.
Whith the cursor go to the last sercice, which must be "World Wide Web".
Click on "stop".
When it's stopped, click on start :) and the WWW service has restarted
The most inportant thing is the "%s %s" behing the perl.exe.
The first one is the translation of the access path to the perl script
(URL translated in a local acces path).
The second one is the query string (from the URL). It's send as parameters of the
command line (on condition not containing any "=" sign).
To allow the browsner to exec a script, you always need to say it what
type of file are exec file (so you must map them, addind the extention
like .idc, .pl, .cfm, .asp, etc...)
Well now PERL is well installed, to be sure ot that, create this file called "hello.pl":
print "HTTP/1.0 200 OK\n";
print "Content-Type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Hello World</TITLE>\n";
print "</HEAD>\n"; print "<BODY>\n";
print "<H4>Hello World</H4>\n";
print "<P>";
print "<H5>Have a nice day</H5>\n";
print "</BODY>\n"; print "</HTML>\n";
Save it in the scripts' dir (e.g: c:\inetpub\scripts)
Test it via command line,
Click on "startup menu/programs/dos prompt"
Go to the scripts' dir (e.g: cd c:\inetpub\scripts) and do "perl hello.pl"
Normaly this must appear:
HTTP/1.0 200 OK
Content-Type: text/html
<HTML>
<HEAD>
<TITLE>Hello World</TITLE>
</HEAD>
<BODY>
<H4>Hello World</H4>
<P>
<H5>Have a nice day</H5>
</BODY>
</HTML>
If not, come back to the first step of the installation, and restart.
If this not work again , mail to the PERL LIST, with a complete description
of your environment and your problem.
Note that the HTML tags are not Handle in Dos mode.
Now do [ALT+TAB] to come back to NT, start NETSCAPE (...)
In the location put: "http://[name_of_your_server]/scripts/hello.pl"
Normaly this must appear:
Hello World
Have a nice day
NOTE: a "\n"; is not understand in HTML, it's just understood by
perl and it works only under command line. To do a "\n" in HTML , you
must use the HTML Language: "<br>"
if u do not put those lines,
print "HTTP/1.0 200 OK\n";
print "Content-Type: text/html\n\n";
Nothing will comes out under netscape,just a blank page .
Those lines tell to the stdout that what it has to print is HTML.
3 DATABASE:
-=-=-=-=-=-=-
3-1) ODBC
To work on a database , you must "map" this database to the system.
So as i personnaly work on Access, i will give only access example
(but it works as well on Postgres... etc).
To have the ODBC manager you must install IIS.
IIS gives you just the Ms SQL pilot, to get the other just install
Ms Access (to get Postgres pilot, go on the web take "poO21-32.tgz"
at "http://stud1.tuwien.ac.at/~e9025461/" and use their Setup.
Beware this pilot creates a conflict with NT and erase other pilots)
3-2) A new DSN.
Click on "startup menu/parameters/control panel"
You'd better drag and drop it on desktop as "Service".
Double click on ODBC.
Click on "DSN System".
Click on "ADD".
Choose your DATABASE Type, i choose "Microsoft Access Driver (*.mdb)".
Say ok.
Give the name you will use in the script. I call it "Base1".
Give a description to remind you what it's about ...
And browsne to find the database file by clicking "select".
If you have restrited acces to your database WITH Ms access,
it performs a .mdw , you can use it in system database area.
Choose database and browsne to your .mdw
Options give the permissions (if you allow the user to change the
datas inside the TABLES, it's dangerous).
Extended , allows NETSCAPE to PROMPT for a log & Pass.
Excelent , you have finished !
You can use, now, the database called "Base1" in your Perl script.
3-3) Handling.
This is a simple file that show you the way to call a database.
use Win32::ODBC;
print "HTTP/1.0 200 OK\n";
print "Content-Type: text/html\n\n";
if (!($db = new Win32::ODBC("Base1"))){
print "Could not connect to DSN. Error: " . Win32::ODBC::Error() . "\n";
exit;
}
else {print "<BLINK><FONT COLOR=RED>Connexion etablie</font></BLINK><BR>";}
$db->Sql("SELECT f1, f2, f3 FROM foo");
print "<html><head><title>Test Base1</title></head><body>";
print "<center>";
$db->FetchRow();
($f1, $f2) = $db->Data("f1", "f2");
print "</center>";
print "</table>";
$db->Close();
NOTE: by calling Your database , in ($db = new Win32::ODBC("Base1")), watch
to keep the same CAPS or MINI, it's important Perl ODBC FONCTIONS MUST
KEPT THE CAPS or MINI: FetchRow(), Data("f1", "f2"), Close() ...
Ok ??!
Now you can work ... thanks to perl and thanks to us...
Conclusion:
-=-=-=-=-=-=-
At least we got it !
Now to all the members of Perl-win32-Users, read this FAQ.
If there's anything to add , add it ...
If someone talk about installation troubles get the reflex
and mail him/her this.
U can use it in a WEBPAGE. Just don't cut my name off, i took
a day to perform it ...
By the way , hope we will add another things on it as GD module
etc...
I work on a translation in my native language ( FRENCH ), please
can a native english scan my text to build it in a readable english ??
If some changes come, i can centralise all the new stuff and all the
comments , in order to create a perfect sheat !
(to be continued ...)
The author :
------------
Gerald OLIVER (Lyon-France) 3eme annee Stage MIAGE 97
- - - - - - --+-- - - - - - -
GERALD OLIVER OLIVER@asi.fr | Tel : 0478930000 Fax : ~99
A.S.I. Espace Double Mixte | 43, bd du 11 novembre 1918
www.asi.fr info@asi.fr | 69622 Villeurbanne Cedex
" Acces et Solutions Internet, French PROVIDER"
--------------AC552125292220DE32382C3C--
------------------------------
Date: 23 Jun 1997 22:40:47 GMT
From: Frank Sheiness <sheiness@no.canned.meat.austin.ibm.com>
Subject: Re: assoc. arrays
Message-Id: <5omu1f$12aq$1@ausnews.austin.ibm.com>
Wendy Poulin <wendyp@skegness.cup.hp.com> wrote:
> hello,
250 comp.lang.perl.misc Hello wendyp@skegness.cup.hp.com
--
btw, this is going to take a long time if you post one word per article.
rainking@k-rad.biff.net
------------------------------
Date: Mon, 30 Jun 1997 11:38:32 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: cbevis@nsinet.com
Subject: Re: Commented Complex Regexes?
Message-Id: <33B78CA8.2781@adc.metrica.co.uk>
Cam Bevis wrote:
>
> Hello All,
>
> I have found some nice code that doesn't do exactly what I want, and
> I would like to modify it. Problem is, it has some REALLY HAIRY regex
> patterns in it (you know the ones 80 characters long that look like your
> cat danced on the keyboard). I've read and re-read both the perlre man
> page and 2.4 of Camel, and can't seem to work through them. I know it
> sounds silly, but does anyone know of a site with some fairly complex
> patterns that are nicely commented out, step-by-step for an oaf like me?
>
> My next step is to go out and buy Freidel's(sic) text on regexes (I
> know, I should already have it), any other suggestions?
>
> --
> Cam Bevis
> President
> NetCom Systems, Inc.
> cbevis@nsinet.corn
> This message has an anti-spam mechanism-change ".corn" to com to reply
Try looking in the documentation section of www.perl.com. There are a
couple of things on regexps, including a script to strip html tags which
has a well commented regexp in it.
Simon
------------------------------
Date: Mon, 30 Jun 1997 12:22:49 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: data compression in perl?
Message-Id: <ECL921.6G5@world.std.com>
Dan Smith <daniel@fit.qut.edu.au> writes:
>Can anyone tell me if there exists a perl library to perform a simple
>compression routine on a scalar? I have a cookie to send that I'd like
>to keep as small as possible.
Take a look at the Compress::Zlib module available at
<URL:http://www.perl.com/cgi-bin/cpan_mod?module=Compress:Zlib>
Another option would be to keep the information you need on the server
in a DBM file. You could send the key to the record as the cookie
(which can be very small), and when the key is returned, look up the
corresponding value.
--
Andrew Langmead
------------------------------
Date: 23 Jun 1997 23:16:45 GMT
From: Frank Sheiness <sheiness@zcmds.austin.ibm.com>
Subject: Re: get end of string (easy question)
Message-Id: <5on04t$1ai4$1@ausnews.austin.ibm.com>
Cathy Huang <cathyh@cs.berkeley.edu> wrote:
> Say
> $IMAGE = http://www.women.com/guide/guide/gifs/nav.7.gif
you should put the url in quotes
> This is wrong:
> ---------------------
> if ($IMAGE =~ /\/(.*?)$/i)
> {
> $END = $+;
> }
> -----------------------
> $END = /www.women.com/guide/guide/gifs/nav.7.gif
> ------------------------
> How can I get $END = nav.7.gif? I just want to get the string between
> the last / and the end of the line.
$END = substr($IMAGE, rindex($IMAGE, '/') + 1);
we don't need no steenkin regex!
i wonder if this article will be posted this time or if it was posted the
first time and this will be the second time in which case it's a waste of
time.
--
i speak for myself therefore i am myself. or something.
this usenet article is powered by vim!
- archon@unix.bigots.org -
------------------------------
Date: Mon, 30 Jun 1997 11:03:58 -0700
From: abimana <abimana@callisto.org.za>
Subject: HELP
Message-Id: <33B7F50E.7D71@callisto.org.za>
Hi,
I am running a perl script which calls a command with a long timeout. I
would like to control this timeout within the script. It seems that I can
fork a new process, execute the command in the child process but how do I
implement and check the timeout ? The OS is FreeBSD-2.1.5
A. Bimana
------------------------------
Date: 30 Jun 1997 12:01:14 +0100
From: Piers Cawley <pdcawley@aladdin.net>
Subject: Re: It slices, It dices (what is a glog)
Message-Id: <54d8p4gxs5.fsf@gunnar.aladdin.net>
Tom Phoenix <rootbeer@teleport.com> writes:
> If you assign to *foo, Perl looks at what value you're giving so that it
> can see how to modify the typeglob. If you assign an array reference,
> you'll replace @foo. If you assign a hashref, that replaces %foo. If you
> assign a coderef, that replaces &foo. (Yes, this redefines a subroutine at
> runtime. Somebody splash some cold water on those Pascal programmers who
> read this message by mistake.)
Ah... so that's how you do it. Once upon a time I wanted to have a
subroutine that did some initialization the first time it was
called. What I wanted to do was to redefine the subroutine from within
the subroutine but I ended up using a (hopefully) unique package
variable instead. (I should probably have done something clever with
AUTOLOAD, but I didn't think of that at the time...)
--
Piers Cawley -- Systems Genie for Aladdin
If a `religion' is defined to be a system of ideas that contains
unprovable statements, then Godel taught us that mathematics is not
only a religion, it is the only religion that can prove itself to be
one. -- John Barrow
------------------------------
Date: 30 Jun 1997 11:47:37 GMT
From: bjepson@ids.net (Brian Jepson)
Subject: Re: ODBC @@identity problem
Message-Id: <slrn5rf6r0.3bt.bjepson@Sol2-5.ids.net>
In article <33B75AB1.1FC0@istvax.ist.lu>, Folscheid Bob wrote:
>ODBC @@identity problem
>Hello,
>
>I am using Perl 32 for NT, and Win32:ODBC
>
>The command
>
>$db->Sql("select @@identity");
>
>after an insert command fails,
>
>what is the problem, has anyone a solution
>
>Bob Folscheid
>
>Email: folscheid_b@istvax.ist.lu
Bob,
Unfortunately, you haven't said anything about what database
server you are using; I'll hazard a guess and say that it's
SQL Server. The other problem is you haven't elaborated on the
word "fails." Does this mean it's not returning a value, or
are you actually getting an error? If you are getting an error
such as "Literal @identity now requires backslash..." try
escaping each @ symbol, as in "select \@\@identity", or try
putting it in single quotes.
If the failure is evidenced as an inability to fetch the value
of @@identity, can you be more specific as to what the problem
is? Perhaps the code that doesn't accomplish the fetch would be
helpful. FWIW, the following code works fine for me:
use Win32::ODBC;
$odbc = new Win32::ODBC("DSN=MSSQL;UID=sa;PWD=secret;");
$odbc->Sql("DROP TABLE frob");
$odbc->Sql("CREATE TABLE frob " .
" (name varchar(32), " .
" rowid int identity)");
$odbc->Sql("INSERT INTO frob (name) VALUES ('Me')");
$odbc->Sql("INSERT INTO frob (name) VALUES ('You')");
$odbc->Sql("SELECT frobval=\@\@identity");
$odbc->FetchRow;
$frobval = $odbc->Data('frobval'), "\n";
print qq[Frobval: $frobval\n];
Hope this helps,
--
Brian Jepson * (bjepson@ids.net) * http://www.ids.net/~bjepson
Int(ra|er)net Database Developer, Author, Crypto-Fluxologist
Non-Prophet Arts Technology Flux: http://www.ids.net/~as220
WWW/Database/NT,Java/Database: http://www.ids.net/~bjepson/books
------------------------------
Date: 30 Jun 1997 11:49:09 GMT
From: bjepson@ids.net (Brian Jepson)
Subject: Re: ODBC @@identity problem
Message-Id: <slrn5rf712.3bt.bjepson@Sol2-5.ids.net>
In article <33B75AB1.1FC0@istvax.ist.lu>, Folscheid Bob wrote:
>ODBC @@identity problem
>Hello,
>
>I am using Perl 32 for NT, and Win32:ODBC
>
>The command
>
>$db->Sql("select @@identity");
>
>after an insert command fails,
>
>what is the problem, has anyone a solution
>
>Bob Folscheid
>
>Email: folscheid_b@istvax.ist.lu
Bob,
Unfortunately, you haven't said anything about what database
server you are using; I'll hazard a guess and say that it's
SQL Server. The other problem is you haven't elaborated on the
word "fails." Does this mean it's not returning a value, or
are you actually getting an error? If you are getting an error
such as "Literal @identity now requires backslash..." try
escaping each @ symbol, as in "select \@\@identity", or try
putting it in single quotes.
If the failure is evidenced as an inability to fetch the value
of @@identity, can you be more specific as to what the problem
is? Perhaps the code that doesn't accomplish the fetch would be
helpful. FWIW, the following code works fine for me:
use Win32::ODBC;
$odbc = new Win32::ODBC("DSN=MSSQL;UID=sa;PWD=secret;");
$odbc->Sql("DROP TABLE frob");
$odbc->Sql("CREATE TABLE frob " .
" (name varchar(32), " .
" rowid int identity)");
$odbc->Sql("INSERT INTO frob (name) VALUES ('Me')");
$odbc->Sql("INSERT INTO frob (name) VALUES ('You')");
$odbc->Sql("SELECT frobval=\@\@identity");
$odbc->FetchRow;
$frobval = $odbc->Data('frobval'), "\n";
print qq[Frobval: $frobval\n];
Hope this helps,
--
Brian Jepson * (bjepson@ids.net) * http://www.ids.net/~bjepson
Int(ra|er)net Database Developer, Author, Crypto-Fluxologist
Non-Prophet Arts Technology Flux: http://www.ids.net/~as220
WWW/Database/NT,Java/Database: http://www.ids.net/~bjepson/books
------------------------------
Date: 30 Jun 1997 09:19:00 GMT
From: sascha@ella.ww.tu-berlin.de (Sascha Ottolski)
To: pnibbs@icd.com.au
Subject: Re: Pattern matching question
Message-Id: <5p7tm4$ic1$2@news.cs.tu-berlin.de>
[Posted and mailed]
Hi Phil,
In article <33B75900.719E@icd.com.au>,
P Nibbs <pnibbs@icd.com.au> writes:
> if ($ENV{REMOTE_ADDR} == /203.[0-63].[0-255].[0-255]/){
>
> This isn't working - can anyone please tell me what i am doing wrong?
this must be "=~" instead of "==".
Greetings Sascha
------------------------------
Date: Mon, 30 Jun 1997 09:06:47 GMT
From: ddurand@hpplus02.cern.ch (Jean-Damien Durand)
To: pnibbs@icd.com.au
Subject: Re: Pattern matching question
Message-Id: <ECKzzB.DDq@news.cern.ch>
> The IP number is held within the variable $ENV{REMOTE_ADDR} and I am
> testing for it as follows:
> if ($ENV{REMOTE_ADDR} == /203.[0-63].[0-255].[0-255]/){
^ you meant ~ ?
> This isn't working - can anyone please tell me what i am doing wrong?
# regexp:
if ($ENV{REMOTE_ADDR} =~ /^203\.(\d*)\.(\d*)\.(\d*)$/) {
($v1,$v2,$v3) = ($1,$2,$3) ;
}
# or splitting (I'd better use it):
($v1,$v2,$v3) = (split(/\./,$ENV{REMOTE_ADDR}))[1..3] ;
# then
if ($v1 <= 63 and $v1 <= 255 and $v1 <= 255) {...}
Cheers, Jean-Damien.
--
*******************************************************
* Jean-Damien Durand (Jean-Damien.Durand@cern.ch) *
* www : http://wwwcn.cern.ch/~ddurand/ *
*******************************************************
------------------------------
Date: Mon, 30 Jun 1997 09:19:03 GMT
From: tcyang@netcom.com (Tung-chiang Yang)
Subject: Re: Pattern matching question
Message-Id: <tcyangECL0Jr.9tB@netcom.com>
[0-63] does not mach 0, 1, 2, 3, 4, ...., 62, 63. That's why.
It matches 0, 1, 2, 3, 4, 5, 6. Similarly, [0-255] matches
0, 1, 2, 5 (one of them). Check out page 64 of the blue camel book.
================
P Nibbs wrote on his Best Friend's Wedding:
: Hi All,
: Just a simple pattern matching question.
: I would like to test for IP numbers between a certain range (203.63.0.0
: -> 203.63.255.255)
: The IP number is held within the variable $ENV{REMOTE_ADDR} and I am
: testing for it as follows:
: if ($ENV{REMOTE_ADDR} == /203.[0-63].[0-255].[0-255]/){
: This isn't working - can anyone please tell me what i am doing wrong?
: thanks,
: Phil.
: --
--
========= Try the low-crossposting robomoderated 'alt.culture.taiwan' ===
soc.culture.taiwan, soc.culture.china (by SCC FAQ Team) FAQ's:
http://www.iglou.com/tcyang/Taiwan_faq.shtml, China_faq.shtml
------------------------------
Date: 30 Jun 1997 09:16:42 GMT
From: sascha@ella.ww.tu-berlin.de (Sascha Ottolski)
To: Steve.Blackmon@SciAtl.COM
Subject: Re: Perl 5.003 setuid -- please!
Message-Id: <5p7thq$ic1$1@news.cs.tu-berlin.de>
[Posted and mailed]
Hi Steve,
have a look at _man perlsec_:
If you try to do something insecure, you will get a fatal
error saying something like "Insecure dependency" or
"Insecure PATH". Note that you can still write an
insecure system call or exec, but only by explicitly doing
something like the last example above. You can also
bypass the tainting mechanism by referencing
22/Jan/96 perl 5.003 with 2
PERLSEC(1) Perl Programmers Reference Guide PERLSEC(1)
subpatterns--Perl presumes that if you reference a
substring using $1, $2, etc, you knew what you were doing
when you wrote the pattern:
$ARGV[0] =~ /^-P(\w+)$/;
$printer = $1; # Not tainted
This is fairly secure since \w+ doesn't match shell
metacharacters. Use of /.+/ would have been insecure, but
Perl doesn't check for that, so you must be careful with
your patterns. This is the ONLY mechanism for untainting
user supplied filenames if you want to do file operations
on them (unless you make $> equal to $< ).
For "Insecure $ENV{PATH}" messages, you need to set
$ENV{'PATH'} to a known value, and each directory in the
path must be non-writable by the world. A frequently
voiced gripe is that you can get this message even if the
pathname to an executable is fully qualified. But Perl
can't know that the executable in question isn't going to
execute some other program depending on the PATH.
Greetings, Sascha
------------------------------
Date: Mon, 30 Jun 1997 12:28:24 +0200
From: ip <ip@cybernet.dk>
Subject: Problem: NTMAIL and Perl
Message-Id: <33B78A48.4CAD@cybernet.dk>
I have problem getting access to my NTMAIL
registry key values.
I want to change NTmails "IPAllowed" value, but the program can not see
the keys and values. The words (key) is defintly correct. I have checked
with "RegEdt32" to see if I have spelled the key correctly and bla bla
bla.
What is wrong with this program, see below:
----------------------- START OF SOURCE -------------------------------
##########################################################
#
# Perl program, to add not allowed ip-address to registry
#
# But i can't modify it
#
##########################################################
use Win32::Registry;
my %RegType = ( 0 => 'REG_0',
1 => 'REG_SZ',
2 => 'REG_EXPAND_SZ',
3 => 'REG_BINARY',
4 => 'REG_DWORD',
5 => 'REG_DWORD_LITTLE_ENDIAN',
6 => 'REG_DWORD_BIG_ENDIAN',
7 => 'REG_MULTI_SZ',
8 => 'REG_RESOURCE_LIST',
9 => 'REG_FULL_RESOURCE_DESCRIPTION');
my $Register = "Software\\InternetShopper\\Mail\\Parameters";
#my $Register = "Software\\Activeware\\Perl5";
my $RegType, $RegValue, $RegKey, $value;
my %values;
my $IPNotAllowed;
undef $garbage;
$IPNotAllowed = "100.100.100.100";
$HKEY_LOCAL_MACHINE->Open($Register,$hkey)|| die "can't open registry";
$hkey->GetValues(\%values);
foreach $value (keys(%values))
{
$RegType = $values{$value}->[1];
$RegValue = $values{$value}->[2];
$RegKey = $values{$value}->[0];
next if ($RegType eq ''); #do not print default value if not assigned
$RegKey = 'Default' if ($RegKey eq ''); #name the default key
print "$RegKey = $RegValue\n";
# Add ip-adress to the RegValue IPAllowed, but with a ! in front
# if it not already exist.
if ($RegKey eq "IPAllowed")
{
@ipadresser = split / /,$RegValue;
if (!($ipadresser{"!$IPNotAllowed"}))
{
$RegValue = $RegValue." !".$IPNotAllowed;
$hkey->SetValueEx("IPAllowed",$garbage,REG_SZ,$RegValue);
$fejl = Win32::GetLastError();
print "ERROR:$fejl\n";
}
}
}
$hkey->Close();
----------------------- END OF SOURCE -------------------------------
If you can see the problem, please write.
Regards
Ivan Petersen
Programmer - cybernet.dk
------------------------------
Date: Mon, 30 Jun 1997 12:27:47 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: references
Message-Id: <ECL9AB.8GC@world.std.com>
dpuryear@usa.net (Dustin Puryear) writes:
[stuff deleted]
> $n = read(HANDLE, $$scalarref, $size, 0);
[stuff deleted]
>But I keep getting "Use of uninitialized value at C:\WIP\NEW.PL line
>27." The only thing this could be is the $$scalarref. I THOUGHT that
>in this context it would supply read() with a scalar to use by
>dereferencing $scalarref. I guess I'm wrong. Someone see the problem?
Some versions of perl emit spurious warning on the second parameter of
read(). They complain if a scalar that contains the undefined value is
the second parameter, even though it is writing, never reading that
scalar.
A workaround is to say:
$$scalarref = '';
$n = read(HANDLE, $$scalarref, $size, 0);
--
Andrew Langmead
------------------------------
Date: 30 Jun 1997 11:53:34 +0100
From: Piers Cawley <pdcawley@aladdin.net>
Subject: Re: Trickey Regex... need thoughts
Message-Id: <54en9kgy4x.fsf@gunnar.aladdin.net>
Simon Fairey <sfairey@adc.metrica.co.uk> writes:
> I wrote:
> >
> > Try this
> >
> > #!/bin/perl
> > open(DB_FILE, 'db_filename') or die "Unable to open file: $!.";
> > while(<DB_FILE>){
> > # Extract the bit inside the parentheses.
> > /^[^(]*\(([^)]*)/;
>
> Or even simpler change above line to:
> /.*\((.*)\)/;
Simpler to parse for a human maybe, but the original is probably
faster since you're not bouncing in and out of the () all the time.
--
Piers Cawley -- Systems Genie for Aladdin
If a `religion' is defined to be a system of ideas that contains
unprovable statements, then Godel taught us that mathematics is not
only a religion, it is the only religion that can prove itself to be
one. -- John Barrow
------------------------------
Date: 23 Jun 1997 22:57:02 GMT
From: Frank Sheiness <sheiness@es.pea.eigh.em>
Subject: Re: what is my, lc and etc and where to learn it?
Message-Id: <5omuvu$12aq$2@ausnews.austin.ibm.com>
mike mah <esupu@warwick.ac.uk> wrote:
> hi perl gurus,
> I feel so strange, you know. Although I finished reading Learning
> Perl, I never encounter my, lc and etc. Why is that so? Where can I get to
> learn complete (probably advance features) set of command (like above)?
> Any help is very appreciated. Thanks in advance.
probably because it's a perl4 book and those are perl5 functions. download
the latest man pages from a cpan mirror.
--
i before e except in caffeine
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 685
*************************************