[7937] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1562 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 1 12:07:30 1998

Date: Thu, 1 Jan 98 09:00:23 -0800
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, 1 Jan 1998     Volume: 8 Number: 1562

Today's topics:
     Re: 'flock'ing <dformosa@st.nepean.uws.edu.au>
     Re: Bugs in CGI/Perl Cookbook <dformosa@st.nepean.uws.edu.au>
     Re: Building perl XSUBs (Gurusamy Sarathy)
     Re: CGI y comandos SSI <moises@texas.net>
     Re: Effective Perl Contest... word game. (brian d foy)
     File test operators <skraemer@iil.intel.com>
     Re: File test operators (Mike Stok)
     HELP! Newbie needs advice on h2ph and SysV IPC <tem@energid.demon.co.uk>
     Re: How Do I Determine A Variable's Type? (Philosopher King)
     How do I exit <nazira@cadvision.com>
     Re: How to get unique list value <joseph@5sigma.com>
     http error <m9@sprynet.com>
     Re: http error (brian d foy)
     Interprocess Communication <allank@techone.com.au>
     Re: Interprocess Communication <merlyn@stonehenge.com>
     Re: newbie: what am i doing wrong? (Martin Vorlaender)
     ODBC and perl question chemcd@Rosie.UH.EDU
     Re: ODBC and perl question (Chris Winters)
     Re: Perl5 on NT4 with IIS4 (Martin Vorlaender)
     Re: reading in passwords <royl@netropolis.net>
     Running PerlIS on Win95 <baileyr@cinternet.net>
     Re: Sorting Data File (brian d foy)
     Re: SQL and PERL <joel@tou.com>
     Re: TX97 motherboard + linux + Perl (iLLuSioN)
     Use tr///cd, not s///g! [Re: Stripping non-alphanum's f <joseph@5sigma.com>
     Re: Win95 Perl <etta@worldnet.att.net>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 1 Jan 1998 12:17:37 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: 'flock'ing
Message-Id: <883657042.144995@cabal>

In <34AA9E46.54421165@mystech.com> "Mark S. Reibert" <reibert@mystech.com> writes:

[...]

>Network File System - remote mounted from another machine. Maybe the network
>traffic causes a problem with the flock(). Better yet, maybe flock() can't
>handle NFS because the file system may have different characteristics on the
>remote machine. [I don't know - I'm reaching here! :-)]

NFS can't handel locking as locking was not inclued in the NFS model.  As
NFS was created as a stateless it is difficalt to alter the model so that
it would have one.

I don't know if this has been sovled by anyone, normaly work arounnds are
used.

[...]

>You could try a semaphore. This will give you the same functionality and may
>work over NFS.

The problem with this is that semaphores only operate on one system, and
NFS allows multiapal systems to rea/write the file.


--
Please excuse my spelling as I suffer from agraphia see the url in my header. 
Never trust a country with more peaple then sheep. 
Support NoCeM http://www.cm.org/                   
I'm sorry but I just don't consider 'because its yucky' a convincing argument


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

Date: 1 Jan 1998 12:26:30 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Bugs in CGI/Perl Cookbook
Message-Id: <883657576.15187@cabal>

In <34AB1C02.7D95@billiardsdigest.com> Sven Davies <webmaster@billiardsdigest.com> writes:

>  My question, is - since I am still quite new to
>the language - is there a way to debug a PERL program using a utility
>that will show variable values step by step?

perl -d

--
Please excuse my spelling as I suffer from agraphia see the url in my header. 
Never trust a country with more peaple then sheep. 
Support NoCeM http://www.cm.org/                   
I'm sorry but I just don't consider 'because its yucky' a convincing argument


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

Date: 1 Jan 1998 16:30:32 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Building perl XSUBs
Message-Id: <68ggb8$du3@srvr1.engin.umich.edu>

In article <68bl71$18s_002@news.sentex.ca>,
Cory C. Albrecht <coryalbrecht@hotmail.com> wrote:
>What I have:
>        Perl 5.004_02 for Win32
>        Watcom C/C++ 11.0 (which has programmes to run to look like MSC)

Will this be able to use MS format import libraries?  If not, you may
have to create your own import library (perl.lib) using Watcom tools
to link against the supplied perl.dll.

>        Windows95

You'll need 4DOS/NT (I've been told).

>My problem:
>        The makefile which 'perl Makefile.PL' produces is always set    =20
>        for the Borland defaults, even if I change the config.mk so that=20
>        OS =3D win32 and OSRELEASE =3D microsoft. I can't get the CC, LIB, =
> =20
>        etc. defaults in the makefile to change to the Microsoft=20
>        defaults.

The config.mk file only affects what default tools dmake uses (you
generally don't need to fool with this, since perl makefiles set the
tool names explicitly).  config.mk has nothing to do with MakeMaker
(which generates your extension's makefiles).

>        Things like tlib, tlink32, bcc32, stuff like that is easy to=20
>        change by hand and rather obvious. However, I have not the=20
>        slightest idea what the cw32mti.lib library does in Borland's=20
>        scheme of things, and you know, I'd really rather not have to go=20
>        and edit by hand any XSUB makefile that I produce because that  =20
>        would waste too much time.

When you installed the binary distribution, you were asked to decide
which development compiler you have (and you either answered 'Borland',
or said you don't have a compiler).

Redo the install, and this time answer 'Visual C++', and you should
be all set for using Visual C++.  I don't know how compatible Watcom
is, so your mileage may vary.

 - Sarathy.
   gsar@umich.edu





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

Date: Thu, 1 Jan 1998 10:21:22 -0600
From: "Moises Solis" <moises@texas.net>
Subject: Re: CGI y comandos SSI
Message-Id: <68ggtq$57p$1@news3.texas.net>

I'm not fluent in Spanish, but here goes:
In the beginning, there is a discussion on how to use server side includes
using the exec statement.   This will execute the application before the
html page is sent to the client.

Next, there is a discussion on passing parameters.   This is generating an
error for them.   Since we don't have a clue to the server that the script
is running on, we can only guess as to the problem.   For IIS, you need to
use the "virtual address" which can be found under  the IIS manager -
Directories.   This may be what is generating their error.

Moises.


Clinton Bodine wrote in message <34AA6569.698332C3@mci.com>...
>I personally welcome non-English questions.  Unfortunately, I don't have a
>grasp of any other language except for a little German.  Could someone
>translate this question for us?
>
>NICOLAS wrote:
>>
>> Pregunta:
>> Para hacer que un CGI se ejecute automaticamente al cargar una pagina WEB
>> se consigue, mediante el uso de comandos SSI,  de la forma:
>>
>> <!--#EXEC CGI="cgi-bin/fichero.cgi"-->
>>
>> el problema es que el 'fichero.cgi' requiere un parametro y al hacer la
>> llamada de la forma:
>>
>> <!--#EXEC CGI="cgi-bin/fichero.cgi?parametro"-->
>>
>> da un mensaje de error
>>
>> ?Como se puede pasar un parametro al CGI ?
>> ?Existe otra forma de hacer que se auto-ejecute el CGI al cargar la
pagina
>> WEB?
>>
>> Gracias por vuestra ayuda y Feliz 1998
>
>--
>Clinton Bodine
>Email: Clinton.Bodine@mci.com




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

Date: Thu, 01 Jan 1998 04:59:33 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Effective Perl Contest... word game.
Message-Id: <comdog-ya02408000R0101980459330001@news.panix.com>
Keywords: from just another new york perl hacker

In article <qz$9712302256@qz.little-neck.ny.us>, Eli the Bearded <#@qz.to> wrote:

>Martin D Schweitzer <martin@matilda.vut.edu.au> wrote:
>> Here is a problem:
>> 
>> I have written a word game.  The user must find all words using
>> the letters given in a square, e.g:
>> 
>> H A N
>> D I W
>> O R K
>
>(1) All words using those letters? Eg "KIND" is allowed.
>(2) All words that you can trace a line through without leaving the box or
>    crossing lines? Eg "HAIR":
>
>        H A
>          I
>          R
>
>(3) All words that can be formed by dropping letters from "HANDIWORK"?
>    Eg. "ARK".
>
>Each of these will have a different solution.

is this basically scrabble?

what about solutions that use certain letters more than once?  nothing
about the frequency of use was mentioned.  

what is the interest in the code that does this?  for instance, why
would the brute force approach not be favored?

is this restricted to a certain language?  what's the definition 
of a word?  i like the perl definition - m/\w+/.  i contend that i
can find an infinite number of solutions with that definition.

what about the square:

   A L T
   F A N
   E T B

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
isn't enjoying the server migration


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

Date: Wed, 31 Dec 1997 09:40:45 +0200
From: Sefi Kraemer <skraemer@iil.intel.com>
Subject: File test operators
Message-Id: <34A9F6FD.41C6@iil.intel.com>

Hi,

I am trying to search for files with the * operator, but am unable to do
so.

Here is what I tried:

push @host_list,$host if (-e "$DB_Path/$server*");

I attempted to search for files just as I would with :

ls  sun*

So files like: sun, sun.sf, sun.ppd will show up.

In the perl program I wish to check if such files exist.


How can I do it?


Thanks,

Sefi.


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

Date: 1 Jan 1998 10:26:43 -0500
From: mike@stok.co.uk (Mike Stok)
Subject: Re: File test operators
Message-Id: <68gcjj$in$1@stok.co.uk>

In article <34A9F6FD.41C6@iil.intel.com>,
Sefi Kraemer  <skraemer@iil.intel.com> wrote:

>I am trying to search for files with the * operator, but am unable to do
>so.
>
>Here is what I tried:
>
>push @host_list,$host if (-e "$DB_Path/$server*");
>
>I attempted to search for files just as I would with :
>
>ls  sun*

That's because perl doesn't automatically do globbing of file names with
wildcards in them.  If you're using a recent perl then you'll be able to
use the glob function, the documentation in the perlfunc man page says:

       glob EXPR

       glob    Returns the value of EXPR with filename expansions
               such as a shell would do.  This is the internal
               function implementing the <*.c> operator, but you
               can use it directly.  If EXPR is omitted, $_ is
               used.  The <*.c> operator is discussed in more
               detail in the section on I/O Operators in the
               perlop manpage.

So you could use something like this untested fragment:

  foreach $file (glob "$DB_Path/$server*") {
    push @host_list, $host if -e $file;
  }

Hope this helps,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Thu, 1 Jan 1998 14:20:16 +0000
From: "Timothy E. Morgan" <tem@energid.demon.co.uk>
Subject: HELP! Newbie needs advice on h2ph and SysV IPC
Message-Id: <FCK8YDAgY6q0EwYo@energid.demon.co.uk>

Hello.

   I'm trying to put together a program using System V_IPC message calls
under Slackware Linux, and using h2ph to get the relevant headers.  The
problem is that when I try to use IPC_PRIVATE in msgget, the following
happens:
- when I try to use &IPC_PRIVATE, it gets read as a subroutine;
- when I try $IPC_PRIVATE, it gets treated as a variable (which I
  expected, but I wanted to try all possibilities);
- and plain old IPC_PRIVATE is expected to be numeric.

   The frustrating thing is that this is all in a model that was passed
around by my lecturer in order to aid understanding...  I don't want the
work done for me, though, it's just this one stumbling-block I need help
with.  (Which, of course, could result from something missing from my
Linux system.)
   I'd really appreciate knowing what I'm doing wrongly here - thanks in
advance.  The example's included below.

#!/usr/bin/perl -w
use diagnostics;
use strict;
push (@INC, "/usr/lib/perl5/i586-linux/5.003/sys");
#I added the three lines above for my system - TEM.
require ("ipc.ph");
require ("syscall.ph");

#error messages
$error1="Did not recieve event queue in READ\n";
$error2="Faliled to enqueue data in READ\n";

sub resume {
        $SIG{USR1}=\&resume;
        return;
};
$SIG{USR1} = \&resume;
$SIG{INT} = \&cleanup;
$QId = msgget(&IPC_PRIVATE , 00777);
die "Could not get queue: $!" unless defined $QId;

print "initialising eventcount";
sub initeventcount {
        $eventqueue=$_[0];
        $initialvalue=$_[1];
        $list=pack("LA*", $initialvalue,"Q");
        $message=pack("LA*", $eventqueue, $list);
        msgsnd($QId, $message, &IPC_NOWAIT) ||&cleanup($error2);
        return;
};

print "reading eventcount";

sub readeventcount {
        $eventqueue=$_[0];
        $list = pack ("LA*",$eventcount, $queue);
        $message=pack("LA*",$type,$list);
        msgsnd($QId,$message,&IPC_NOWAIT)||&cleanup(error2);
        return $eventcount;
};

sub advanceeventcount {
        $eventqueue=$_[0];
        msgrcv($QId,$message,256,$eventqueue,1) || &cleanup ($error1);
        ($type, $list)=unpack("LA*",$message);
        ($eventcount,$queue)=unpack("LA*",$list);
#do something
        $queue=join(':',@neweventlist);
        $list=pack("LA*",$eventcount,$queue);
        $message=pack("LA*",$type,$list);
        msgsnd($QId,$message,&IPC_NOWAIT) ||cleanup(error2);
        foreach $counter (@processlist) {
                kill(USR1, $counter);
        };
        return;
};

sub awaiteventcount {
        $eventqueue=$_[0];
        $countvalue=$_[1];
        msgrcv($QId,$message,256,$eventqueue,1)||&cleanup($error1);
        ($type,$list)=unpack("LA*",$list);
#do something else
        $queue=join(':',$queue,$$,$countvalue);
        $list=pack("LA*",$eventcount,$queue);
        $message=pack("LA*",$type,$list);
        msgsend($QId,$message,&IPC_NOWAIT)||&cleanup($error2);
        return;
};

sub cleanup {
        msgctl($QId,&IPC_RMID,0);
        die "cleaning up $_[0]";
        exit();
}
#missing final semicolon above??? -TEM

initeventcount(1,1);
$which=fork;
if ($which ==0) {
        print "BABY awaits counter = 5\n";
        await eventcount (1,5);
        print "CHILD TERMINATES AFTER WAKEUP\n";
        &cleanup;
} else {
        for ($loop=1; $loop < 8; $loop++) {
                $result=readeventcount(1);
                print "MOTHER advances counter to $result\n";
                advanceeventcount(1);
        };
        print "PARENT cleans up\n";
        cleanup ("OK - END");
}

-- 
Timothy E. Morgan


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

Date: Thu, 01 Jan 1998 06:01:37 GMT
From: holcojh5@REMOVE_MEwfu.edu (Philosopher King)
Subject: Re: How Do I Determine A Variable's Type?
Message-Id: <34ab2f24.2769952@snews.zippo.com>

On Wed, 31 Dec 1997 11:05:25 -0800, garya@printingcontrol.com (Gary
Affonso) wrote:

>Here's my problem:
>
>I have a subroutine that takes a Hash as input. The values corresponding
>to each of the Hash keys can be of varying types.  Some of the values in
>the hash could be scalars, others could be lists.  The subroutine that
>processes this hash needs to react differently based on the type of value
>associated with each key.  I've looked through the Camel book, the Perl
>FAQ and through this newsgroup and haven't found anything that talks about
>how to determine a variable's type.
>
>Apologies if this information is obviously available and I've simply
>failed to find it.
>
>Thanks in advance for any help!
>

I don't know if this is exactly what you are looking for, but have
you tried the "ref" function? It is mentioned in the Camel book on p.
204, and in the Panther book (Adv. Perl Programming), on pgs. 15-16.
It examines a scalar to see if it is a reference, and if it is, it
tells whether it's a reference to a scalar, hash, array, or whatever.
If you are using references to arrays to implement the lists in your
hash, this may help you.

Hope this helps,

Heath




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

Date: 1 Jan 98 00:45:01 GMT
From: "Aamer Nazir" <nazira@cadvision.com>
Subject: How do I exit
Message-Id: <01bd1657$7026d1c0$2977e4cf@default>

Hi,
I am a beginner in perl.I am using perl 5 on windows 95 based system.How do
I quit after I have written the program or script I want after typing perl.
Please reply to my email address:
nazira@cadvision.com
Thanks,
Aamer.


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

Date: Thu, 01 Jan 1998 00:31:40 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: How to get unique list value
Message-Id: <34AB4648.A4142A9@5sigma.com>

Yeah, there's so much progress you can make swimming upstream
against the syntax!  :-)

	-joseph
	 http://www.effectiveperl.com

Terry Michael Fletcher - PCD ~ wrote:
> 
> Joseph N. Hall (joseph@5sigma.com) so eloquently and verbosely pontificated:
> > Here's the grep-free, temporary-free version from my book:
> >
> >   @uniq = sort keys %{ { map { $_, 1 } @list } }
> >
> 
> i thought using a hash slice (mmm, tasty) seemed pretty cool:
> 
>  @uniq = keys %{ local @temp{@list} = @list; \%temp };
> 
> but i can't get rid of the %temp hash.  [...]e


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

Date: Wed, 31 Dec 1997 10:07:53 -0500
From: "m9@sprynet.com" <m9@sprynet.com>
Subject: http error
Message-Id: <34AA5FC9.6EEA@sprynet.com>

Get the following error when trying to run script:

http/1.0 501 not supported

Running NT4 and IIS3.0

Thanks in advance.
Jason
merit@meritsales.com


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

Date: Thu, 01 Jan 1998 10:50:15 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: http error
Message-Id: <comdog-ya02408000R0101981050150001@news.panix.com>
Keywords: from just another new york perl hacker

In article <34AA5FC9.6EEA@sprynet.com>, m9@sprynet.com wrote:

>Get the following error when trying to run script:
>
>http/1.0 501 not supported

is this an exam question? it's trivial to produce that error.
can i look at the CGI Meta FAQ or is this a closed browser exam?

>Running NT4 and IIS3.0

oh i get it.  i'd have to use NT to do it.  i'll pass (wait - i won't!).

-- 
brian d foy                                  <comdog@computerdog.com>
Institute For the Organically-Challenged
   <URL:http://computerdog.com/brian/Institute.html>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Thu, 1 Jan 1998 23:18:55 +1100
From: "Allan Krause" <allank@techone.com.au>
Subject: Interprocess Communication
Message-Id: <68g4q0$oas1@sol.connect.usq.edu.au>

I am trying to write a client/server application in perl which will allow a
client process (perl script) running on a unix (solaris) platform to
communicate with a server process (perl script) running on a WindowsNT
(i386) platform.

Basically, the client process should signal the server process to start
doing its thing, and wait.  The server process should send some indication
back to the client process when it has finished doing its thing so it can
resume.

I've looked at the sample 'client' and 'server' scripts supplied with perl
and which appear in the book 'Perl 5 for Dummies'.  When both scripts are
run on unix only, they seem to work ok.  When both are run on NT only, the
server seems to hum along ok, but the client fails on the 'bind' statement.
I've no idea how to modify the scripts (or even if I need to) to get them
communicating with each other on different platforms?????

If someone could help, I'd really appreciate it!!

Many thanks,

Allan Krause
allank@techone.com.au






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

Date: 01 Jan 1998 09:13:39 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: "Allan Krause" <allank@techone.com.au>
Subject: Re: Interprocess Communication
Message-Id: <8c90t05g0c.fsf@gadget.cscaper.com>

>>>>> "Allan" == Allan Krause <allank@techone.com.au> writes:

Allan> I've looked at the sample 'client' and 'server' scripts
Allan> supplied with perl and which appear in the book 'Perl 5 for
Allan> Dummies'.  When both scripts are run on unix only, they seem to
Allan> work ok.  When both are run on NT only, the server seems to hum
Allan> along ok, but the client fails on the 'bind' statement.  I've
Allan> no idea how to modify the scripts (or even if I need to) to get
Allan> them communicating with each other on different platforms?????

While my copy of "Perl 5 for Dummies" seems to be missing from my
shelf (:-), I would suspect that since you mentioned "bind" by name,
you are setting up a server the old-fashioned way.

See "man perlipc" or "perldoc perlipc" or Chapter 6 of the blue Camel
for better (probably far better) models to cut and paste from.

Or wait about seven months and you may just find a book on your shelf
written by some familiar people with some animal on the cover that is
*entirely* about the subject line. :-)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 242 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Thu, 01 Jan 1998 15:13:02 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: newbie: what am i doing wrong?
Message-Id: <34aba46e.524144494f47414741@radiogaga.harz.de>

jay (mocat@NOSPAM.best.com) wrote:
: I'm bored at work

I wish I could say that...
but right now, it's New Year's Day, and I'm at home.

[..code snipped..]

The following is a bit different (simpler?!), but works:

#!/usr/bin/perl -w
use strict;

srand;
my @caplet  = ('A'..'Z');
my @lowlet  = ('a'..'z');
my @numbers = ('0'..'9');
my @arrays = (@caplet, @lowlet, @numbers);
for (my $stat = 0; $stat < 8; ++$stat) {
        my $nextchar = $arrays[int(rand(@arrays))];
        if ($stat == 0) {
                print "new password: $nextchar";
        } else {
                print $nextchar;
        }
}

: jay... feeling stupid

Don't. Get yourself a copy of 'Learning Perl' (and _read_ it!)
and Read The Fine POD.

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: 1 Jan 1998 15:34:11 GMT
From: chemcd@Rosie.UH.EDU
Subject: ODBC and perl question
Message-Id: <68gd1j$3r2$1@Masala.CC.UH.EDU>

Can anybody tell me what's wrong with the following code? Or tell me where I
can find the most suitable newsgroup to post? Thank you.

The problem is, nothing gets printed. The EMPLOYEES table is defined and DSN 
is connected correctly. The commented lines would print available datasources
if # were removed.

Yong
--------------------------------------------------------
#!perl -w
use Win32::ODBC;
$DSN = "MyDSN";
if (!($db = new Win32::ODBC($DSN)))
  { print "Error connecting to $DSN\n";
    print "Error: ".Win32::ODBC::Error()."\n";
    exit;
  }
$SqlStatement = "SELECT * FROM EMPLOYEES";
if (($db->Sql($SqlStatement)))
  { print "Sql failed.\n";
    print "Error: ".$db->Error()."\n";
    $db->Close();
    exit;
  }
$Result=($db->Sql($SqlStatement));
print $db->Sql("select * from CATEGORIES");

#    print "\nHere are the available datasources...\n";
#    if (!(%DSNs = Win32::ODBC::DataSources())){
#        $Failed{'Test 2'} = "DataSources(): " . Win32::ODBC::Error();
#    }
#    foreach $Temp (keys(%DSNs)){
#        print "\tDSN=\"$Temp\" (\"$DSNs{$Temp}\")\n";
#    }

while ($db->FetchRow())
  { undef %Data;
    %Data = $db->DataHash();
    print %Data;
  }
$db->Close();


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

Date: Thu, 01 Jan 1998 16:03:39 GMT
From: cwinters@clark.net (Chris Winters)
Subject: Re: ODBC and perl question
Message-Id: <34abbcd1.2160566@news.clark.net>

Are you trying to dump the data from two tables or one? It seems
you're submitting two (actually, three, since you're doing the
first one twice) SQL statements. You might try seeing how many
items you're trying to print out -- if you don't get any lines
like "Item: 1" then you're simply not fetching anything. See
below.



chemcd@Rosie.UH.EDU wrote:

>Can anybody tell me what's wrong with the following code? Or tell me where I
>can find the most suitable newsgroup to post? Thank you.
>
>The problem is, nothing gets printed. The EMPLOYEES table is defined and DSN 
>is connected correctly. The commented lines would print available datasources
>if # were removed.
>
>Yong
>--------------------------------------------------------
>#!perl -w
>use Win32::ODBC;
>$DSN = "MyDSN";
>if (!($db = new Win32::ODBC($DSN)))
>  { print "Error connecting to $DSN\n";
>    print "Error: ".Win32::ODBC::Error()."\n";
>    exit;
>  }
>$SqlStatement = "SELECT * FROM EMPLOYEES";
>if (($db->Sql($SqlStatement)))
>  { print "Sql failed.\n";
>    print "Error: ".$db->Error()."\n";
>    $db->Close();
>    exit;
>  }

$count = 0;
while ( $db->FetchRow() ) {
	$count++;
	undef %Data;
	%Data = $db->DataHash();
	print "Item: $count\n";
	foreach $key (keys %Data) {
		print "$key: $Data{$key}\n";
	}
}

>$Result=($db->Sql($SqlStatement));
>print $db->Sql("select * from CATEGORIES");

 Why are these two lines here?

>#    print "\nHere are the available datasources...\n";
>#    if (!(%DSNs = Win32::ODBC::DataSources())){
>#        $Failed{'Test 2'} = "DataSources(): " . Win32::ODBC::Error();
>#    }
>#    foreach $Temp (keys(%DSNs)){
>#        print "\tDSN=\"$Temp\" (\"$DSNs{$Temp}\")\n";
>#    }
>
>while ($db->FetchRow())
>  { undef %Data;
>    %Data = $db->DataHash();
>    print %Data;
>  }
>$db->Close();

Good luck!

Chris

Chris Winters
Webmaster
cwinters@clark.net


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

Date: Thu, 01 Jan 1998 01:45:49 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Perl5 on NT4 with IIS4
Message-Id: <34aae73d.524144494f47414741@radiogaga.harz.de>

scott clark (scott_clark@merck.com) wrote:
: Mario Abela wrote:
: > Can anyone help me setting up Perl5 to run under IIS4 on NT
: > or from where I can get the info to set it up?

: I'll assume you already have Perl5 running command line scripts...

: Believe it or not Microsoft has a good Article on the subject:
: try this the following URL...
: http://support.microsoft.com/support/kb/articles/Q150/6/29.asp

Believe it or not Microsoft has changed it all from IIS(1..3) to IIS4;
they moved all info out of the registry into something called "metabase".
So this article won't be much help with IIS4.

I finally gave up installing IIS4 beta 3 (the "metabase" failed to
install correctly), so I can't help the original poster, apart from
giving the advice to install Apache or OmniHTTPd.

cu,
  Martin
--
                          | Martin Vorlaender | VMS & WNT programmer
 Ceterum censeo           | work: mv@pdv-systeme.de
 Redmondem delendam esse. |       http://www.pdv-systeme.de/users/martinv/
                          | home: martin@radiogaga.harz.de


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

Date: 01 Jan 1998 09:54:17 -0600
From: roy lewis <royl@netropolis.net>
Subject: Re: reading in passwords
Message-Id: <m2n2hgxk9i.fsf@netropolis.net>

Austin Schutz <tex@collegenet.spam-is-bad.com> writes:

> Devin P. Anderson wrote:
> > 
> > How can you read from STDIN and not display what is being typed on the
> > screen? Like a password. Is this possible though a socket?
> 
> Sure.. I'd recommend using IO::Stty, available on CPAN.
> 
> 
> print "Enter password: ";
> IO::Stty::stty(\*STDIN,'-echo');
> $password = <>;
> IO::Stty::stty(\*STDIN,'echo');
> print "\n"; # The user's newline wasn't echoed
> 
> 
> 	I'm not quite sure what you mean by 'through a socket'.
> 
> 	Hth,
> 
> 	Tex

or even

use Term::ReadKey;
ReadMode 2;
$_=ReadLine(10)||"timeout\n";
ReadMode 0;
print $_;


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

Date: Thu, 01 Jan 1998 11:26:56 -0500
From: Rick Bailey <baileyr@cinternet.net>
Subject: Running PerlIS on Win95
Message-Id: <34ABC3CF.CED945A1@cinternet.net>

I recently downloaded and installed perl and perlIS for Win95. I have
written and debugged some scripts using perl.exe in DOS.

Now that these scripts are debugged and working, I'd like to test them
out in the browser. Whenever I try to reference one of the scripts like
this (http://127.0.0.1/myscript.pl), the browser shows the text of the
perl script instead of executing it.

Is this something that's easy to fix? Any help would be greatly
appreciated.

Rick Bailey
baileyr@cinternet.net




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

Date: Thu, 01 Jan 1998 02:03:16 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Sorting Data File
Message-Id: <68femn$cgf@bgtnsc02.worldnet.att.net>
Keywords: just another new york perl hacker

In article <34AB2DAC.1F4AB2FA@cybernex.net>, hudson@cybernex.net posted:

> Hi, I have a data file that contains about 20k records (about 200bytes
> each) that I need sorted.  Unfortunately,
> I don't have access to a sort utility on my platform, and I need the
> file sorted (daily) so that I can compare it to
> the previous day's file.  Does anyone have a relatively efficient PERL
> algorithm that might help me order the
> file? 

an eficient algoithm isn't specific to Perl since Perl is simply a 
language.  there are all sorts (heh) of algorithms in Knuth's
"Sorting and Searching", especially for mostly sorted sets (since
you sorted the file the day before, it is mostly sorted already).

you can also peruse the wisdom in the answer to

   How do I sort an array by (anything)? 

in section 4 of the Perl FAQ.

good luck :)

-- 
brian d foy                                 <http://computerdog.com>


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

Date: Wed, 31 Dec 1997 14:48:01 -0800
From: Joel Shellman <joel@tou.com>
To: Peter Salomonsen <pesalomo@online.no>
Subject: Re: SQL and PERL
Message-Id: <34AACBA1.5A8B34B@tou.com>

We've been using mysql ( http://tcx.se/ ) and the mysqlperl module that
accesses it.  It's been working great for some time now.

Good luck,

Joel Shellman
TaoTree, Inc.
http://www.tou.com/

Peter Salomonsen wrote:
> 
> Does anyone know an easy and efficient way to connect Perl and a
> SQL-database in an unix/linux environment? Is there any free code
> available?
> 
> Please CC your answer to pesalomo@online.no
> 
> Peter


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

Date: Thu, 01 Jan 1998 16:13:38 GMT
From: brad@greenepa.net (iLLuSioN)
Subject: Re: TX97 motherboard + linux + Perl
Message-Id: <34abc045.50880617@news.greenepa.net>

Hello all,

   Does anyone have any perl scripts that would be able to read the
built in temp/fan/voltage monitors of an Asus TX97 motherboard? I
think these values would come in very handy, and I would like to
access them on my server via either a web page/perl CGI script or via
SNMP. Any suggestions?

Thanks,
brad



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

Date: Thu, 01 Jan 1998 00:28:02 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Use tr///cd, not s///g! [Re: Stripping non-alphanum's from within string?]
Message-Id: <34AB456E.2407B9FC@5sigma.com>

Now, look, you've got everyone doing it!  So long as you're arguing 
about it, you might as well use the feature that is designed to 
perform this task :-)

use Benchmark;

$orig = 'This#is%a!%#$%#test%(#*!#*';
timethese (100000, {
    's' => q{ (my $string = $orig) =~ s/\W//g; },
    'tr' => q{ (my $string = $orig) =~ tr/a-zA-Z0-9//cd; }
} )

Benchmark: timing 100000 iterations of s, tr...
         s:  9 secs ( 9.52 usr  0.00 sys =  9.52 cpu)
        tr:  3 secs ( 2.05 usr  0.00 sys =  2.05 cpu)

	-joseph
	 http://www.effectiveperl.com

brian d foy wrote:
> 
> In article <68du0h$m4c@bgtnsc02.worldnet.att.net>, hagani@worldnet.att.net posted:
> 
> > Let's say I have:  $string = "P#E!$R-  L"
> >
> > I'd like to remove all non-alphanumerics, the result being:
> >                 $string = "PERL"
> 
> have you tried a negated character class?
> 
>    s/[^a-zA-Z0-9]//g;


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

Date: 1 Jan 1998 07:01:49 GMT
From: "etta" <etta@worldnet.att.net>
Subject: Re: Win95 Perl
Message-Id: <68ff0t$jle@mtinsc03.worldnet.att.net>

What webserver are you using?

Eddie Brown <eddie@NOSPAMMING.cs.odu.edu> wrote in article
<34AAF65B.D28129BC@NOSPAMMING.cs.odu.edu>...
> I have a html file on my Windows 95 box that calls a perl program:
> 
> <form action="test.cgi" method="get">
> 
> When I use Netscape locally on my win95 box, netscape displays
> the source instead of executing it. I made it so that .cgi files open
> with
> perl but then an externaal dos shell  spawns from netscape and executes
> it.
> 
> ????
> 
> I know that the top line of the program has to be changed from the unix
> path to a win95 path :
> 
> #!/usr/bin/perl
> 
> but  #!C:/bin/perl
> 
> doesn't seem at all right.
> 
> HELP!! :^)
> 
> Thanks,
> Eddie
> 
> 


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

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 1562
**************************************

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