[6461] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 86 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 11 03:07:44 1997

Date: Tue, 11 Mar 97 00:00:32 -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           Tue, 11 Mar 1997     Volume: 8 Number: 86

Today's topics:
     Re: [Q] modules <wkuhn@uconect.net>
     Re: ANNOUNCE: eZone Online Interactive Courses (with ce <jstrick@mindspring.com>
     Re: cgi db or random access ? (Geoffrey Hebert)
     flock() problem yili@cse.bridgeport.edu, yli@eccubed.com
     flushing input ? (perl 4) (Jim Clements)
     Form to File .cgi dvess@grafxfactory.com
     Re: Guestbook Entry Numbering (Geoffrey Hebert)
     help with printing to a socket (Rachel Polanskis)
     How to delete a file? Or/and By date. <sbt@tiac.net>
     malformed header (Jonathan Faber)
     Re: malformed header (Erik Braun)
     Re: Need FILE1 copied to FILE2 (minus the spaces, tabs, (Geoffrey Hebert)
     needed DBM examples (Geoffrey Hebert)
     Numeric Output, format help. <sbt@tiac.net>
     Parsing a CSV file into 2 arrays... <smcclure@quake.net>
     Re: Parsing a form with enctype=multipart <tchrist@mox.perl.com>
     Perl running on a VMSserver... <a.willis@tay.ac.uk>
     Reading an HTML file using P <jeep@rahul.net>
     Scope? (Jonathan C. Willeke)
     Re: Semantics of hashes and NIS+ combined. (multiple ke (Michael De La Rue)
     Shadow passwords and perl <tc@space.net.au>
     So easy they do not explain pattern match. (Geoffrey Hebert)
     Using format for output? (Mikael Hallendal)
     Re: Who makes more $$ - Windows vs. Unix programmers? <liuwayne@earthlink.net>
     Re: Win32::ODBC & MS SQL Servers IMAGE data type, anyon <rothd@roth.netX>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Mon, 10 Mar 1997 21:45:24 -0500
From: Bill Kuhn <wkuhn@uconect.net>
Subject: Re: [Q] modules
Message-Id: <3324C744.6FDA749B@uconect.net>

# first add /usr/home/wouter/lib
# to @INC
use lib '/usr/home/wouter/lib' ;
# now use module
use test ;

Hope this helps.
-- 
Bill Kuhn
Chief Developer
Wired Markets, Inc.
http://www.buyersindex.com


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

Date: Mon, 10 Mar 1997 23:26:52 -0500
From: John Strickler <jstrick@mindspring.com>
Subject: Re: ANNOUNCE: eZone Online Interactive Courses (with certification!)
Message-Id: <3324DF0C.81F8C64@mindspring.com>

Steven Katz wrote:

> The eZone is an innovative approach to online education, offering courses
> in scripting and programming languages. Current courses include: Perl 5,
> HTML 3, C++, Java, JavaScript, and Visual Basic Scripting Edition. Coming
> soon: Office 97, Visual Basic 5, and ActiveX Scripting.
The subject says "(with certification!)". Hmmmm.
What kind of certification is available. Is there a non-partial
institution out there that
certifies HTML ~programmers, Office 97 users, ActiveX scripters, and, oh
yeah, Perl 
programmers? 

To recap: WHOSE certification? And what organizations demand or prefer
this certification?
--
John Strickler --  Perl/UNIX/C Trainer, Consultant
Jeffersonian Consortium            Voice:     919-682-3401     
HTTP://WWW.JCINC.COM               Facsimile: 919-682-3369


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

Date: Tue, 11 Mar 1997 04:40:28 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: Re: cgi db or random access ?
Message-Id: <5g2mru$929$1@news3.microserve.net>

see www.microserve.com/~soccer/casl/
I think there are multiple examples of what you are looking for.

How big is the user record.  How often will it get hit?
Examples above are just simple perl code using sequencial file.


richard ferry <102646.1641@CompuServe.COM> wrote:

>i want to post a scrollable list of my users on my intranet. i 
>want the user to be able to enter a partial name and then select 
>from the list. i have about 1000 users.

>i was thinking about using a unix random access db unless there 
>is a cgi db product out there.


>thanks in advance. 




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

Date: 10 Mar 1997 11:23:46 -0800
From: yili@cse.bridgeport.edu, yli@eccubed.com
Subject: flock() problem
Message-Id: <5g1n42$j4r@lana.zippo.com>

I also have a lock problem with perl

in one program, I write:
open (FH, "/path/file/);
flock(FH, $LOCK_EX);
sleep(100);
flock(FH, $LOCK_UN);
close(FH);

in another program, I write
open (FH, ">> /path/file/);
flock(FH, $LOCK_EX);
print FH "TEST LINE\n";
flock(FH, $LOCK_UN);
close(FH);

the file will still be written "TESTLINE" althought the firt program's
process is alive; I also tested the returned value of those flock()s,
they are 0's. Do you know how I can get it work?

Thanks & Regards,
Yi Li


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

Date: 11 Mar 1997 06:00:05 GMT
From: clements@xmission.com (Jim Clements)
Subject: flushing input ? (perl 4)
Message-Id: <5g2sd5$k54$1@news.xmission.com>


I have been struggling with this for the last couple weeks and would
appreciate any constructive suggestions.

The script is to communicate with an alpha pager companies interface
prompts for input.

The script connects to the paging company via a pipe to a telnet
connection to a server with dial-out modem attached.

The first prompts from the pagers program are ended with a carriage return
and I have no problem recieving the text.  Unfortunately other queries
do not end with a carriage return so somewhere along the way the text is
not making it back to the script.  My guess is that it is held in some
buffer awaiting a carriage return before dumping.

I am restricted to using perl 4 in writing this script.

Thanks for any suggestions.
Jim
__________________________________________________________________________
Jim Clements               "Improved health begins with improved water."
clements@xmission.com         Your personal satisfaction is guaranteed.
Total Health Marketing         http://www.xmission.com/~total/health/



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

Date: Mon, 10 Mar 1997 21:33:12 -0600
From: dvess@grafxfactory.com
Subject: Form to File .cgi
Message-Id: <858049763.18986@dejanews.com>

I have been searching the net for a perl script that will
take data from an html form and add it to a .data file that
can be accessed via server side includes. More specifically,
the data contained in the .data file would require a configuration
file that would allow control of how the data would be displayed
in the html document. I know this sounds confusing, but a file
called form-file.cgi is available at Concentric.net, but they
will not allow anyone to use the .cgi program.
It would also be necessary to be able to select only the LAST
set of data elements in the .data file or the ability to
clear the data before appending the NEW data that is entered
in the form. Any help or suggestions would be greatly appreciated.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Tue, 11 Mar 1997 04:30:23 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: Re: Guestbook Entry Numbering
Message-Id: <5g2m91$8q7$1@news3.microserve.net>

arthurs@blkbox.com (Stephen Arthur) wrote:

>I hava an HTML guestbook that uses a PERL script to return data,
>and I wanted to know if anyone knows of a way
>that I can use PERL to consecutively number the guestbook entries.
>Any ideas would be greatly appreciated.
>Thanks,
>Stephen
>arthurs@blkbox.com


You are probably using:
  open(GUESTBOOK,">>filename)

Which simply appends the next wirte to the end of the file.

You could have a second file that only has the count of entries and
every time you are going to add an entry:
  open(COUNTHERE,"<countfile"
  read $cnt
  close(COUNTHERE)
  $cnt=++$cnt
 open(COUNTHERE,">countfile")
 write
 close(COUNTHERE)

  now write the $cnt to GUESTBOOK with other data

 Many other ways to do this.
   



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

Date: 10 Mar 1997 10:38:36 GMT
From: rachel@virago.org.au (Rachel Polanskis)
Subject: help with printing to a socket
Message-Id: <5g0obc$592@janis.virago.org.au>

Hello,
I copied the exact bit of code out of the 2nd edition of 
Programming Perl, and it does not work the way I thought it should.

When I run my script below, on port 7 (echo) I expected it
to return whatever I print out.

It doesn't!

It hangs there, waiting for something.

If I adjust the code to just connect to say, port 13 (daytime),
I get a connection and the result returned, as expected.

What am I missing in my code to allow me to print to the 
socket, and return a result?

here's my sample:

#!/opt/local/bin/perl  -w
#
# 
require 5.002;
use strict;
use Socket;

my ($remote, $port, $iaddr, $paddr, $proto);

##
# Straight out of the perl 5 Camel - pp. 349
#
# talk to myself
$remote ="localhost";

# connect to the "echo" port - it's enabled.
$port = "7";

if ($port =~ /\D/) {$port = getservbyname ($port, 'tcp')}
die "No port" unless $port;

$iaddr = inet_aton($remote) or die "no host: $remote";
$paddr = sockaddr_in($port, $iaddr);

$proto = getprotobyname ('tcp');

socket (SOCK, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
connect (SOCK, $paddr) or die "connect: $!";
##
# 
while (<SOCK>){

print SOCK "hello world\n";
print "$_\n";

    }

close (SOCK);
exit 0;
##
#

Please help!

rachel

                 defghijklmnopqrstuvwxyz:  What? No ABC?
--
Rachel Polanskis                 Kingswood, Greater Western Sydney, Australia 
grove@zeta.org.au                http://www.zeta.org.au/~grove/grove.html
r.polanskis@nepean.uws.edu.au    http://www.nepean.uws.edu.au/ccd/
                Witty comment revoked due to funding cuts


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

Date: Mon, 10 Mar 1997 23:25:25 -0500
From: Scott Tilton <sbt@tiac.net>
Subject: How to delete a file? Or/and By date.
Message-Id: <3324DEB5.4194@tiac.net>

Ok, I have searched in the few Perl 5 books that I have on how to do the
following:

I need to be able to search in a directory for any file with the .ord
extension and delete them by date, or time.  I need to be able to delete
them if they are older than the current date, or if possible if the file
is older than like 3-4 hours or so.

Is this possible in Perl?  If so, could some one either show me an
example, or point me in the right direction?

Any help would be great!

Thanks,

Scott Tilton

Please respond to mailto:sbt@tiac.net
-- 
Virtual Web Works
http://www.tiac.net/users/sbt
A member of the HTML Writers Guild


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

Date: Tue, 11 Mar 1997 05:42:46 GMT
From: jaber@panix.com (Jonathan Faber)
Subject: malformed header
Message-Id: <5g2rjf$qci@news1.panix.com>

Hey I'm no programmer.  I'm just trying to knock out a form.

The error message I am getting says malformed header from script.  The
header reads

#!/usr/local/bin/perl

which is what I received when I typed in "which perl"  Does anyone
have an answer for this error message?

Thanks Jon Faber



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

Date: 11 Mar 1997 07:21:08 GMT
From: erik@paxp01.mipool.uni-jena.de (Erik Braun)
Subject: Re: malformed header
Message-Id: <slrn45ia1v5.k45.erik@paxp01.mipool.uni-jena.de>

On Tue, 11 Mar 1997 05:42:46 GMT, Jonathan Faber <jaber@panix.com> wrote:

>#!/usr/local/bin/perl
>
>which is what I received when I typed in "which perl"  Does anyone
>have an answer for this error message?

This is not an perl error message. I assume, you got errors within
your Perl-Skript and started it via CGI. You should read these errors
in your error_log file (depending on the server you use).

erik
-- 
erik@minet.uni-jena.de


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

Date: Tue, 11 Mar 1997 04:12:37 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: Re: Need FILE1 copied to FILE2 (minus the spaces, tabs, CR, or any other invisible characters)
Message-Id: <5g2l7p$8c4$1@news3.microserve.net>

mas@cyberspy.com (michael allen smith) wrote:

>This is my 1st day using PERL and my goal is remove all spaces, tabs,
>and line feeds from a DATA file.  I've played with the ~ s and have
>been able to remove spaces, tabs, and some CR, but not without
>corrupting the data.  Is PERL the right choice for the job?       

>thanks,
>mas

Just take it one step at a time.
What do you mean by corrupting the data?
is this perl on the comman line or as a program?
There is room here show us the code.  

Do simple steps
   $field=~ s/\s//g;

and look at result



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

Date: Tue, 11 Mar 1997 04:19:04 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: needed DBM examples
Message-Id: <5g2ljr$8hp$1@news3.microserve.net>

I was just about to code dbm code - dbmopen etc when perl-5 came out.

Now dbmopen is out and something else is in - 

Can someone point me to examples - 
I have the Perl 2nd Edition.  I could use a simple example like a name
and address file keyed on last name or ssn. 

Thanks



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

Date: Mon, 10 Mar 1997 23:30:14 -0500
From: Scott Tilton <sbt@tiac.net>
Subject: Numeric Output, format help.
Message-Id: <3324DFD6.1DF2@tiac.net>

This is major problem, but I would like to fix this.

In Perl, my output for a total is a price.  On certain calculations, the
output looks like $00, or $0.0.  I would like to make the output for
this variable $price to always have 2 digits after the decimal point. 
Could someone help me with this?

Thanks,
Scott Tilton
Please respond to: mailto:sbt@tiac.net
-- 
Virtual Web Works
http://www.tiac.net/users/sbt
A member of the HTML Writers Guild


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

Date: Mon, 10 Mar 1997 21:50:52 -0800
From: Stuart McClure <smcclure@quake.net>
Subject: Parsing a CSV file into 2 arrays...
Message-Id: <3324F2BC.6535@quake.net>

Can any of you gurus help out?

I want to read a line at a time from a text file and then strip the
field (from within double quotes) as a comma as the field delimiter and
push the first field into array1 and the second field into array2.

I can strip each field from the text file (or CSV) and push into a
single array, but don't know how to distinguish between the first field
and the second (to put into the second array).

Here's a sample CSV file:
"Tom","Cruise"
"Nicole","Kidman"

And a sample of the push code to an array.

open(NAMES, "names.txt") or die "Can't open names.txt: $! \n";
while (<NAMES>) {
	#chomp;
	push @fullnames, ($1||$+)
            while /\s*"(([^"\\]|\\"|\\\\)*)"\s*|\s*([^",]+)\s*/g;
}

Thanks in advance for any help.

-- 
Stuart McClure


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

Date: 11 Mar 1997 01:28:45 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Parsing a form with enctype=multipart
Message-Id: <5g2cgd$h6b$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Luis Torres <ltorres@campus.ruv.itesm.mx> writes:
:Hi, anyone know if there's a difference between parsing a form with
:enctype = multipart and one without enctype? I tried to parse the form
:contents with the sub I was using before and now with multipart I dont
:get any data!

Oye, ?nos explicas por donde en tu mensaje aparece la palabra "perl",
de la cual este newsgroup se trata? 

Pues, ?no?

Entonces sugiero que busques la respuesta a tu pregunta en un sitio que
mas pertenezca a lo de CGI, o sea, comp.infosystems.www.authoring.cgi.
Me imagino que alla tendrmas mas suerte que aca.

Pero te diri cuatro cosas (ok, una sola :-) -- Lo primero que debermas
hacer es adquirir CGI.pm, que ya entiende la tarea que has mencionado.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    "Just because you're into control doesn't mean you're in control."
    	--Larry Wall


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

Date: Mon, 10 Mar 1997 09:46:21 +0000
From: Alan Willis <a.willis@tay.ac.uk>
Subject: Perl running on a VMSserver...
Message-Id: <3323D86D.723B@tay.ac.uk>

 Hi all,

hope someone out there can help me. I am looking for a way of returning
the name of the current VMS node under Perl into a simple scalar
variable. Obviously I cannot use something like

        $node=chop(`hostname`);

'cos that command (Unix-based) don't exist under VMS. Does anyone have
any ideas hwo to go about this? Preferably I'd like the full domain name
returned, i.e. "machine.inst.ac.uk" rather than just the plain ol'
"machine", such is the case in OpenVMS.

Thanks for all your help.

-Alan

--
===========================================================================

    Alan S. Willis, Information Services, University of Abertay Dundee,
                      Bell Street, Dundee DD1 1HG
     Phone: 01382-308821  Fax: 01382-308880 Email: a.willis@tay.ac.uk
   Computer Support Assistant (Library MAN Applications) - TAFIS project

===========================================================================



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

Date: 11 Mar 1997 07:00:12 GMT
From: California Man <jeep@rahul.net>
Subject: Reading an HTML file using P
Message-Id: <5g2vts$f1a@samba.rahul.net>

I read somewhere here before that the way you read an HTML file
from the web was to use get('$urlname');

I tried this, but get() gives me an error both in perl 4 and perl5.

A) why do I get an error?

B) How do I read a file from the web via PERL?

TIA
-- 
---------------------------------------------------------------------------
Hello? is this thing working?
---------------------------------------------------------------------------


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

Date: Tue, 11 Mar 1997 01:32:18 GMT
From: jwilleke@ix.netcom.com (Jonathan C. Willeke)
Subject: Scope?
Message-Id: <3324b591.586569@nntp.ix.netcom.com>

According to the Camel book and the man pages, lexically scoped
variables declared with my are not visible to to routines called in
the current block.  However, check out this bit of code:

    #!/usr/bin/perl -w
    my $a = 1234;
    print "called from main, \$a: $a\n";
    scopeTest();

    sub scopeTest() {
        print "called from scopeTest, \$a: $a\n";
    }

Here's the resulting output:

    called from main, $a: 1234
    called from scopeTest, $a: 1234

Am I misunderstanding the docs. on this?
Jon Willeke <jwilleke@ix.netcom.com>


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

Date: Thu, 6 Mar 1997 19:07:10 GMT
From: mikedlr@tardis.ed.ac.uk (Michael De La Rue)
Subject: Re: Semantics of hashes and NIS+ combined. (multiple keys in hv)
Message-Id: <E6MyG2.KH1.0.staffin.dcs.ed.ac.uk@dcs.ed.ac.uk>
Keywords: hash perl key value multiple DB_File CDB_File 

Courtesy copy to Philip by email.

In article <331BD152.1CFE@ntex.com>,
Philip A. Prindeville <philipp@ntex.com> wrote:
>[..]
>I'm writing a tied hash module to work with the NISPlus-0.05
>package for use with certain NIS+ maps like group, passwd, etc.
>
>In some of these maps, it is possible to have multiple entries
>with the same search key.
>
>My question is how does this affect the semantics of a hashed
>array?  Can "keys" return the same key more than once?  And
>when one does a delete, which entry does it delete?  The oldest?
>All of them?

Basically hashes don't fit with repeated keys at all given the present
interface.  I think it would be possible to improve this so that they did.

There is a precedent for this in the DB_File module in which the BTREE type of
dbm can have multiple keys.  The problem is the behavior of each which is
defined as something like this.

	each {
		$key = NEXTKEY ( $lastkey)
		ifdef ( $key ) {
			$value = FETCH ( $key )
			return ($key , $value);
		}
		return () ; 
	}

Note that it goes through fetch..  so if we have

	{ a => 1
	b => 2
	b => 3
	c => 4 }

what we get as we go through is

	(a, 1) 
	(b, 2)
 retur	(b, 2) #repeated value, not second one
	(c, 4)

And this must be so, because at any time at all you can always call 

	$hash{"b"}  which means FETCH("b")

and that should always return the same value for reasons of sanity.

Now my feeling is that we should implement a new function in tied hashes 

	EACH {
		my $self=shift;
		#don't care about last key
		...do stuff to look up the key AND value...
		return ( $the_next_key #and
			 $the_next_value )
	}

And that tie should recognise this function when if available and use
it (use present system otherwise)

As it is, you can get by with two functions

	iterate - does an each
and
	multi_get - gets all of the values..

Why do you need two functions?  Well, during normal iteration,
you will probably want to access (read) some other values in the hash .  If
you have multiple keys, then you might want to access all of the values
associated with a given key in the same way.  My multiget returns a reference
to an array of the values in the order they are in the database.  I'm open to
persuasion that it should return a list.

I've designed a similar interface for the CDB_File module which I'm
using (it's partially contributed back to the CDB_File author and I
have what seems to be a fully working version myself)

One thing to notice is that this is different from the interface to DB_File
and seems - to me - better.  In particular, you can use my iterate function
just like you would each 

	while ( ($key,$value) = $h->iterate()) {
		#do stuff
	}

where the DB_File interface deliberately mirrors the C much more closely.

I'd really appreciate comments on this stuff, since I'm getting fairly
committed to releasing stuff like this, and I wouldn't like to get the
interfaces wrong.

	Michael De La Rue

P.S. Philip, could you please copy me any replies you get which might
help me.
-- 

            <http://www.tardis.ed.ac.uk/~mikedlr/biography.html>
  Scottish Climbing Archive: <http://www.tardis.ed.ac.uk/~mikedlr/climbing/>
Linux/Unix clone@ftp://src.doc.ic.ac.uk/packages/linux/sunsite.unc-mirror/docs/


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

Date: 11 Mar 1997 06:59:07 GMT
From: "Trevor Clout" <tc@space.net.au>
Subject: Shadow passwords and perl
Message-Id: <01bc2de9$a1e1f020$05a83fcb@jabba.space.net.au>


Howdy,

The perl function getpwuid is meant to return with an encrypted password
from the /etc/passwd file. In a shadow password system this entry in the
/etc/passwd file is just a * and the real encrypted password is stored in
the /etc/shadow file. Does anybody know how to make perl deliver the
correct entry under shadow. Please Help :(

Thanks in advance

Trevor



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

Date: Tue, 11 Mar 1997 03:50:42 GMT
From: soccer@microserve.net (Geoffrey Hebert)
Subject: So easy they do not explain pattern match.
Message-Id: <5g2jul$80k$1@news3.microserve.net>

Searching for an easy answer.  It must be easy, because the book did
not explain what was meant.

Perhaps if I were born into UNIX I would obviously know what is meant
below.  

What do these mean -
s/^/< /
$var=~s/\^/\n/          

Thanks for the help. 

 I looked and looked for the meaning of \^ 
How it is used I am guessing it replaces end of file or end of record.




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

Date: 10 Mar 1997 20:52:54 GMT
From: micke@cel95mhl.campus.mdh.se (Mikael Hallendal)
Subject: Using format for output?
Message-Id: <5g1sb6$r3p@aragorn.mdh.se>

Hi!

I want to use format-write to format my output .. is there anyway to
do this and still have control-seq's (so that the variable becomes longer than 
the outfield?

/Micke

-- 
-----------------------------------------------------------
E-mail                 : <cel95mhl@mds.mdh.se>
                       : <micke@cel95mhl.campus.mdh.se>
HomePage               : <http://mds.mdh.se/~cel95mhl>
PGP-Key available from : <http://www.mds.mdh.se/~cel95mhl>
                         or finger cel95mhl@legolas.mdh.se
-----------------------------------------------------------


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

Date: 11 Mar 1997 05:38:23 GMT
From: "Wayne Liu" <liuwayne@earthlink.net>
Subject: Re: Who makes more $$ - Windows vs. Unix programmers?
Message-Id: <01bc2dde$ccf92180$8d67face@liuwayne>

Rich James <jamesr@remove_this.bscc2.agw.bt.co.uk> wrote in article
<3324463f.1057298164@news.axion.bt.co.uk>...
> On Sun, 9 Mar 1997 13:32:11 -0800, brtaylor   @   qtpi.lakewood.ca.us
> ("Bob Taylor") wrote:
> 
> 
> >I would recommend learning BOTH. Why put all your eggs in one basket?
> 
> Hell, I'd recommend learning the Novell API too...
> There are fewer products out there, and the market's just as large...
> 
> Rich
> 

Hey, don't forget the AS/400 and S390! You can earn pretty good money
there!

wayne



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

Date: 11 Mar 1997 06:39:20 GMT
From: "Roth Consulting" <rothd@roth.netX>
Subject: Re: Win32::ODBC & MS SQL Servers IMAGE data type, anyone used it?
Message-Id: <01bc2de6$8cba5140$0100a8c0@www>


Craig Humphrey <humphric@akcity.govt.nz> wrote in article
<33236761.7ADA@akcity.govt.nz>...
> Hi People,
> 	I'm playing around with storing web pages in an MS SQL Server (6.5) DB
> and retreiving them through Win32::ODBC and Perl 5.001m (build 110) all
> on an NT Server (3.51 SP4) platform.
> 
> I've manged to work with SQL Server's TEXT data type OK, and a workmate
> has retreived an IMAGE, but just how do I insert something of IMAGE type
> into the DB?
> 
> At the moment I've tried just reading a binary file (gif) into a
> variable and then used an INSERT sql statement to add it to the DB, but
> it's complaing about quotes.  Here's a code snipit:
> 
> $Data->Sql("Insert Into Images ( keyref, size, binary ) Values (
> $keyref, $inline_length, '0x".$inline."')");
> 
> and here's the error message:
> 
> Error is 105, [Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed
> quote before the character string '0x'., 1
> 
> I'm guessing that it's compaining because there will be some
> "interesting" chars in the IMAGE field ('binary' field).
> 
> According to the SQL Server Transact SQL manual I have to use the
> WRITETEXT command, but all the examples they give only ever extract
> IMAGE data from one field and insert it into another, never taking
> "fresh" IMAGE data from an external data source (ie file).
> 
> And I'm not sure that the WRITETEXT command will be compatable with the
> Win32::ODBC as it's not standard SQL and use some special text pointer
> variable.

DOH! I was afraid this was going to happen. I am looking at implementing
the ability to bind a perl variable to an SQL query. Something like...
$db->Bind(\$Var);
$db->Sql("Insert Into Images ( keyref, size, binary ) Values ($keyref,
$inline_length, ?)");

PLEASE don't hold me to this in syntax or even in implementation. I have no
idea when I will find the time to do this. 

BTW: I am moving this weekend to start a new job and will no longer have my
wonderfull & cheap cable modem connection to the Inet. My site will
probably be down for awhile.

Cheers,
dave
-- 
================================================================
Dave Roth                               ...glittering prizes and
Roth Consulting                     endless compromises, shatter
rothd@roth.net                         the illusion of integrity

 My email address is disguised to fool automailers. Remove the
                 trailing 'X' to send me email.
****************************************************************
Use of  this message or  email address  for commercial  purposes
(including "junk" mailings) is strictly prohibited and protected
under  current  international  copyright laws  and United States
Code, Title 47, Chapter 5, Subchapter II.

 


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

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

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