[11995] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5595 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 7 14:07:21 1999

Date: Fri, 7 May 99 11:00:29 -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           Fri, 7 May 1999     Volume: 8 Number: 5595

Today's topics:
    Re: "Text file busy" error michield@my-dejanews.com
        ==> help with using strict <== <khowe@performance-net.com>
    Re: About perlre... <uri@sysarch.com>
    Re: Array - List of List <rhardicr@hotmail.com>
    Re: Editing a file "in-place" (M.J.T. Guy)
    Re: Excel graph using PERL ? (Scott McMahan)
    Re: Frequent Posters: new group for WWW applications of <design@raincloud-studios.com>
        HASH references... <keighvin@urjet.net>
    Re: having problems getting this script to work... <aqumsieh@matrox.com>
    Re: Help with Reading/descending directories... <dvsone@proaxis.com>
    Re: How process a file? (Bart Lateur)
    Re: how to grep -v ?? <dgris@moiraine.dimensional.com>
    Re: How to keep travelled path in hash ? (Benjamin Franz)
        How to match a variable in pattern - Help a newbie ! <antich@quantum.che.nsk.su>
    Re: How to use multi dimensional array in Perl <aqumsieh@matrox.com>
    Re: Increment a variable's name <aqumsieh@matrox.com>
    Re: MS Access database (Scott McMahan)
    Re: MS Access database <design@raincloud-studios.com>
        Need help with hash tables <vince@oxxfordinfo.com>
    Re: ODBC and Access memo fields (Scott McMahan)
        Oops, here is the script <khowe@performance-net.com>
        Oraperl question (newbie) (Jared Hecker)
    Re: Perl script as "cat" - but slower (Bart Lateur)
    Re: PERLFUNC: binmode - prepare binary files on old sys <uri@sysarch.com>
    Re: Problem with Net::Telnet and its output kinda resol <jay@rgrs.com>
    Re: Q Re Negation in Regular Expressions (Andrew Johnson)
        Real Time file access <givenc@rmci.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 07 May 1999 16:55:35 GMT
From: michield@my-dejanews.com
Subject: Re: "Text file busy" error
Message-Id: <7gv5u4$hjd$1@nnrp1.deja.com>

In article <7gn5hr$e11$1@nnrp1.dejanews.com>,
  vajsejtl@my-dejanews.com wrote:

> I was encountering the same problem in PHP.
> It might be because of the reverse CR-LF ordering in Unix/Windows machines.
> Since when I saved the script in Linux environment (pico) it happened to run
> smoothly. But when saved in Windows-Homesite (via samba), I got the 500 Apache
> error... You might try to save your script in linux.

And so did I. I use the exact setup Windows-Homesite via samba to Linux. The
error occurred. But when you use Options-Setting-File Settings-Unix Format the
error doesn't occur. Maybe useful?

MD


>
> JV
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
>


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 7 May 1999 13:56:59 -0300
From: "Kevin Howe" <khowe@performance-net.com>
Subject: ==> help with using strict <==
Message-Id: <%UEY2.27755$134.324953@tor-nn1.netcom.ca>

Why doesn't "strict" allow you to use 1,2,3,etc.  as scalar references to
the variables $1, $2, $3. etc?
In the following script, is strict is commented out, it will work fine, but
without it commented out, it gives me the error I mentioned above.

Does anyone know why this is, and is there any way to get around it?

Much appreciated,
Kevin Howe




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

Date: 07 May 1999 13:17:10 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: About perlre...
Message-Id: <x7zp3gu7e1.fsf@home.sysarch.com>

>>>>> "TM" == Tad McClellan <tadmc@metronet.com> writes:

  TM> $_ = 'hello34 5hola 222 que tal3 ar22e you';

  TM> while ( /([a-zA-Z]+|\d+)/g ) {
  TM>    print "token: '$1'\n";
  TM> }
  TM> ------------------

but that prints tokens of just letter or just numbers. i think he wanted
them combined, but he wasnt too clear. you could just split on white
space too given the string.

so a single char class would be better IMO

	while ( /([a-zA-Z\d]+)/g ) {

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Fri, 07 May 1999 16:19:07 +0100
From: Richard H <rhardicr@hotmail.com>
Subject: Re: Array - List of List
Message-Id: <3733046B.9BD5198D@hotmail.com>

Dave Lundborg wrote:
> 
> I am Working  on a cgi script that reads from a database and then builds
> two arrays of lists.  The problem is that I  setup both arrays as
> different names but when i print out the arrays both have the exact same
> data.  Here is the code and the output.    It seems that I am printing
> the same array.  What am i Dooin Wrong?? Thanks in advance!!
> 
> code:
> 
> my @custarray;
> my @locarray;
> 
>  use Win32::ODBC;
>  $DSN = "DSN=CMAP;UID=sa;PWD=1top1;";
>  if (!($dbclient = new Win32::ODBC("DSN=CMAP;UID=sa;PWD=1top1;")))
>  {
>   print "Error connecting to $DSN\n";
>   print "Error: " . Win32::ODBC::Error() . "\n";
>   exit;
>  }
> 
>  $SqlStatement0 = "SELECT customer_number
>  from cmap_customer where customer_number <> '2034'";
> 
>  if ($dbclient->Sql($SqlStatement0))
>  {
>   print "SQL failed.\n";
>      print "Error: " . $dbclient->Error() . "\n";
>      $dbclient->Close();
>      print "exited in SQL statment EXEC";
>   exit;
>  }
> 
>  $customercount = 0;
> 
>     while ($dbclient->FetchRow())
>  {
>      $customernumber = $dbclient->Data;
>   @customernumber = $dbclient->Data;
>   $custarray[$customercount] = $customernumber;
>   $locarray[$customercount] = $customernumber;


Did you really have to post all that?? doesnt make finding the actual
problem any easier to find.

>      $customernumber = $dbclient->Data;
>   @customernumber = $dbclient->Data;

do you really want to do these two assignments on successive lines
are you tryin to extend the array od overwrite the contents?

Richard H


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

Date: 7 May 1999 17:01:18 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Editing a file "in-place"
Message-Id: <7gv68u$4p1$1@pegasus.csx.cam.ac.uk>

In article <36190807.14828281@news.ses.cio.eds.com>,
Tom Tingdale <tingdale@c2o.com> wrote:
>Thanks Jim. 
>What if I want to use this in a function only. Could I do it like this
>by stuffing the file name into @ARGV???
>
>sub change_text {
>    $file = shift;
>    $ARGV[0] = $file;
>    while (<>) {
>        s/text/newtext/;
>        print;
>    }
>}

That assumes that @ARGV currently contains at most one element.   You'll
have a nasty surprise otherwise.

Better is         @ARGV = $file;


Mike Guy


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

Date: 7 May 1999 17:12:02 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: Excel graph using PERL ?
Message-Id: <37331ee2.0@news.new-era.net>

tvn007@my-dejanews.com wrote:
> Time         speed

> 0            0
> 2            10
> 5            18
> 9            22
> 12           25

> I would like to have these data read in MS-Excel table and
> automatically graph Time VS. speed.

> Would someone help me on this ?

Write it to a comma-delimited file, and write an Excel sub
to read the file and plug the numbers in and graph it.
(Hint: use the macro recorder to generate a lot of the code.)
Then, use Automation and call this macro from Perl using
Application.Run. You do NOT want to get into trying to use
the Excel object model from Perl if you can help it.
Any time I've done that the result has been disaster.

Scott


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

Date: Fri, 07 May 1999 16:57:13 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: Frequent Posters: new group for WWW applications of Perl?
Message-Id: <JXEY2.47$vP2.138@news.rdc1.tn.home.com>

>B] The newsgroup comp.lang.perl.misc is IMO a bit too narrowly focused
>on Perl. It's not just CGI; it's ANYTHING in the "real world". Want to
>learn more about sockets? Then, clpm is not for you. Damned. Even
>questions about proper file locking don't really belong here.
>Aren't we being just a bit too narrow-minded?


I don't think so. I think the FP'ers have a good thing going, but as the web
grows even more it's gonna get worse. They can keep pushing the misposters,
but a well thought out alternative group would probably take a load off.

I'm going to stick my neck out and just say what's on my mind. With web
development..

1) I don't always have the option of the newest release of Perl.
(Yeah..sometimes 5.000 pre 4 )
2) I cannot always use modules because of version issues.
3) I usually end up needing only 5% of most modules' functionality so I write
code myself.

4) Most of what I do is on 'virtual' or 'shared' servers, so
'get-in'-'get-out' efficient Perl code with very little overhead is essential.

5) We (web developers) are governed by things like CPU usage time and memory,
etc. One too many modules can consume a bit too much CPU and your script is
banned until you streamline it. When you develop for clients, this cannot
hapopen.

This is the real world I live in, the FP'ers may find it laffable... but it's
how I make my living.

Most of my solutions have to be written out line by line to fit the enviroment
I'm thrown in. (Yeah I do use my own reusable libraries... I'm not a total
idiot). It changes monthly depending on the job I'm on.

There needs to be an area where those of us who cannot be on the cutting edge,
or use the bloated modules can talk about web-based issues with Perl. This is
mainly concerned with performance on the web-server.

>C] I can understand Tad's feeling that it's doesn't belong in the
>comp.lang.* hierarchy. OTOH, other newsgroups in the heirarchy aren't so
>picky. Want to know how to get the images dimensions from a GIF file in
>Delphi? Ask in the Delphi newsgroup. Nobody minds (except if it's a FAQ
>;-).


It's funny you should mention this, because it helps illustrate the point.
Someone asked about GIF dimensions with Perl in cgi yesterday. They got their
answer. Now imagine if it had taken place here, or in another *Perl Specific*
NG... it needed to. A GIF-Perl question is perfectly valid in Perl.misc, or a
web-based Perl NG because GIF is a frequently used image type of the web. It
has nothing to do with CGI.

>Anyway, something like this may be nice:
> comp.programming.realworld.perl
>Where ANY programming problem, provided that the solution must be
>produced in perl, would be acceptable.

>That's what people not accustomed to clpm would expect from it.

Umm.. I think Tad may have a word or two on that. Because it steals the
thunder from here. ANY problem also encompasses problems here. We have a
phrase we turn in my business that involves any business problem that we solve
on the web...

I was thinking...

comp.programming.perl.websolutions

Doesn't that encompass FTP, HTTP, HTML, CGI etc... and the Perl language in
one nice neat package and strip out the non-web related content? It also meets
Tad's criteria of not being in the lang.perl heirarchy. Perl coming first
illustrates that the NG isn't just a catch all for web programming. It's a
Perl group.

Anyone have feedback?

CT




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

Date: Fri, 7 May 1999 11:23:40 -0600
From: "Paul L Tomlinson" <keighvin@urjet.net>
Subject: HASH references...
Message-Id: <926097562.578.90@news.remarQ.com>

There've got to be so many newbie questions on here, I apologize.  Now that
I've got you buttered up I can solicit wisdom:

    I have a script reading a form; a lot of the elements in this form are
incrementally named, i.e. "desc1", "desc2", "desc3", etc...  These and their
values (desc1=whatever) are all transferred successfully into %FORM.  I want
to write a loop that will refer to these elements incrementally instead of
having to write $FORM{'desc1'} ... $FORM{'desc50'} and have a routine for
each; that's bad code.  How can I refer to elements in a hash using a
pointer, reference, or variable?  Maybe I'm thinking too JavaScript on this
one but there's got to be a way.  This excerpt doesn't work but it does
explain what I'm trying to do:

    $i=0;
    $j=1;
    while($i < 50){
         $priorities[$i] = "priority$j";
         $dls[$i] = "deadlineselect$j";
         $dl[$i] = "deadline$j";
         $descs[$i] = "desc$j";
         $i++;
         $j++;
    }
     while($i < 50){
         if($FORM{$descs[$i]} ne ""){
            .....
         }
    }

    Any takers?

    Paul L. Tomlinson
    keighvin@urjet.net




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

Date: Fri, 7 May 1999 11:08:34 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: having problems getting this script to work...
Message-Id: <x3yk8ukyl1p.fsf@tigre.matrox.com>


Uri Guttman <uri@sysarch.com> writes:

> so show me where $, is more useful than join.

I never said $, was more useful or faster than join(). But if I ever
find such a situation, then I'll let you know :-)

Ala




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

Date: Fri, 7 May 1999 09:44:52 -0700
From: "DeviousOne" <dvsone@proaxis.com>
Subject: Re: Help with Reading/descending directories...
Message-Id: <926095615.917.5@news.remarQ.com>

A simple solution in the world of confusion....MIS will get you...LOL

Steve Linberg <linberg@literacy.upenn.edu> wrote in message
news:linberg-0305991243140001@ltl1.literacy.upenn.edu...
> In article <7gkg3n$421$1@nnrp1.dejanews.com>, abrinson@my-dejanews.com
wrote:
>
> > I am trying to perform a simple file check for directories.
> >
> > The end goal is to create a mechanism for my program do descend
directories
> > and search for .html files.
>
> It already exists.  Why reinvent the wheel?
>
> use File::Find.
>
> --
> Steve Linberg, Systems Programmer &c.
> National Center on Adult Literacy, University of Pennsylvania
> email: <linberg@literacy.upenn.edu>
> WWW: <http://www.literacyonline.org>




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

Date: Fri, 07 May 1999 15:59:11 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: How process a file?
Message-Id: <373a0d06.1980375@news.skynet.be>

dtillaud@hotmail.com wrote:

>The problem is that Everplay becomes true only if the string is twice inside.

Wrong diagnosis.

Let's cut the crap and go straight to the real offender:

>   while(<FILE>)

You read one line of text and assign it to $_;

>   {
>      $Line = <FILE>;

You read another line but this time assign it to $Line.

>   }
>   close (FILE);

Quick fix: replace the second line with

	$Line = $_;

but you should really either assign directly to $Line in your "while"
conditional, or use $_ directly.

	Bart.


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

Date: 07 May 1999 11:33:07 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: how to grep -v ??
Message-Id: <m3so98eqek.fsf@moiraine.dimensional.com>

[mailed and posted]
brian@helka.mutagenic.org (Brian Peisley) writes:

> Being fairly new to Perl, I like trying to figure out things like this for
> myself.  I typed in 'perldoc -f grep' to see if I could figure this one out.
> Unfortunatly, right there in the documentation was exactly how to do it:
> 
>     @foo = grep(!/^#/, @bar);    # weed out comments
> 
> I'm sure you can imagine my frustration at finding documentation so good...

Those damn perl documentation hackers.  :-)

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Fri, 07 May 1999 17:25:52 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: How to keep travelled path in hash ?
Message-Id: <AmFY2.9066$ny.790708@typhoon-sf.snfc21.pbi.net>

In article <7gskak$qpq$1@news.mch.sbs.de>,
Michel Dalle <michel.dalle@usa.net> wrote:
>Hi,
>
>here is a little brain teaser. :-)
>
>I want to keep track of the number of times a certain PATH is travelled 
>through a website/city/forrest/..., and I have a file containing the
>the different pages/pubs/trees/... by each visitor.
>
>E.g. : (who when where)
>mike 01:52 post1
>mike 01:53 post2
>john 01:53 post3
>mike 01:54 post1
>john 01:55 post1
>john 01:56 post2
>mike 01:57 post3
>john 01:58 post2
>..

Hmmmm....

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

my $paths = {};
my $users = {};

while (my $line = <STDIN>) {
    chop $line;
    my ($who,$when,$where) = split(/ /,$line,3);
    if (not defined $users->{$who}) {
        my $user = User->new;
        $user->set({ -who => $who, -last_where => '', -last_when => '' });
        $users->{$who} = $user;    
    }
    my $user = $users->{$who};
    my ($last_where,$last_when) = $user->get('-last_where','-last_when');
    if (($last_where eq '') and ($last_when eq '')) {
        $user->set({ -last_where => $where, -last_when => $when });
        next;
    }
    $paths->{$last_where}->{$where}->{-count}++;
    $paths->{$last_where}->{$where}->{-users}->{$who}->{-count}++;
    $user->set({ -last_where => $where, -last_when => $when });
}

my @path_list = sort keys %$paths;
foreach my $from (@path_list) {
    my @targets = keys %{$paths->{$from}};
    foreach my $to (@targets) {
        my $path = $paths->{$from}->{$to};
        my $count = $path->{-count};
        my @visitors = sort keys %{$path->{-users}};
        print "$from -> $to (Total: $count,";
        foreach my $who (@visitors) {
            my $user = $path->{-users}->{$who};
            my $visits = $user->{-count};
            print  " $who ($visits)";
        }
        print ")\n";
    }
}

package User;

sub new {
    my ($class) = shift;
    my $self    = bless {},$class;
    
    if ($#$_ > -1) { 
        $self->set(@_);
    }
    $self;
}

sub set {
    my ($self) = shift;

    my ($parm_ref) = @_;

    my $parm_list = [];
    @$parm_list = keys (%$parm_ref);
    foreach my $parm (@$parm_list) {
        my $key = lc ($parm);
        my $value = $parm_ref->{$parm};
        $self->{$key} = $value;
    }
}

sub get {
    my ($self) = shift;

    my (@parm_list) = @_;

    my (@result) = ();
    foreach my $parm (@parm_list) {
        my $value = $self->{lc($parm)};
        if (defined $value) {
            push (@result,$value);
        } else {
            push (@result,'');
        }
    }
    return @result;
}

[snowhare@long-lake perl]$ ./path-trace.pl < path-test-data.txt 
post1 -> post2 (Total: 2, john (1) mike (1))
post1 -> post3 (Total: 1, mike (1))
post2 -> post2 (Total: 1, john (1))
post2 -> post1 (Total: 1, mike (1))
post3 -> post1 (Total: 1, john (1))

-- 
Benjamin Franz


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

Date: Sat, 8 May 1999 00:40:31 +0700
From: "Anton V. Antich" <antich@quantum.che.nsk.su>
Subject: How to match a variable in pattern - Help a newbie !
Message-Id: <Pine.LNX.4.10.9905080036070.31789-100000@quantum.che.nsk.su>


Hello!

I've got a following problem. There is a formatted text file, something
like:

 O1  1  S    1   ......... 
 O1  2  S    2   .........
 O1  3  X    3   .........
 C1  1  S    4   ........  here go unimportant columns
 C1  2  S    5    .......
 C1  3  Y    6    ........

I have to choose lines which columns 1 and 3 match given values:

$f1 = 'O1';
$f3 = 'S';

Then i want to pass them to a sub and print matching lines. A question -
is it possible to check variables in the pattern/reg.exp.? I couldn't
manage to do that, and wrote something like:

 ...
if (  (/(\w+)\s+\d+\s+(\w+)/) && ($1 eq $f1) && ($2 eq $f3))
 { print $_;
 };

Well, that didn't work either... Please help!
Thanks.
A.




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

Date: Fri, 7 May 1999 12:36:24 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
To: Nitesh Jhaveri <jhaveri_nitesh@jpmorgan.com>
Subject: Re: How to use multi dimensional array in Perl
Message-Id: <x3yg158ygzc.fsf@tigre.matrox.com>


[posted and CCed]

Nitesh Jhaveri <jhaveri_nitesh@jpmorgan.com> writes:

> I need to create a two dimensional array to store a result of the sql
> query.
> 
> can someone help me with some demo code on how to acomplish this using
> Perl Array?

Have a look at the perldsc (Perl Data-Structures Cookbook)
documentation which is already installed on your system.

HTH,
Ala



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

Date: Fri, 7 May 1999 11:17:13 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Increment a variable's name
Message-Id: <x3yiua4ykna.fsf@tigre.matrox.com>


Tom Pape <tom@ernieball.com> writes:

> Is there a way I can increment a variable's name?   The form I am
> processing can have a different number of quantity variables depending
> on the number of items listed.  If I have $i number of items can I
> assign values to a variable that might look like qty$i?  I need to
> incerment the variables name by 1 each time a loop runs, for example:
> qty1, then qty2, then qty3 ....

Why not just use an array @qty ?
Then you can access any element $j where 0 <= $j < $i simply by:

		$qty[$j]

Does this help?
Ala



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

Date: 7 May 1999 17:17:31 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: MS Access database
Message-Id: <3733202b.0@news.new-era.net>

howard dierking (hdierking@email.msn.com) wrote:
> I'm building a simple web app right now where the client wants me to take an
> MS Access database (that he has written) and make it into the driving force
> behind an interactive Internet solution.

Are you serious, or is this a troll? If they're serious, laugh at
them. Access couldn't be the driving force behind a grocery list. It
is one of the worst databases I've ever seen. It is not up to driving
anything. It's okay for Office mail merge and other non-serious
applications, but as a production quality database, forget it.
(This is from bitter personal experience.)

> The problem that I'm having is
> that the client wants to run the site off of Linux/Apache -- and I don't
> know how Access works on this kind of scenario.

It does not. Access has absolutely no way to be accessed over a network
like a client/server database does. Access is strictly single-user.

The only way to do it would be to run Access on a Windows host, and use
a TCP/IP client/server pair to passthru the SQL and the query results
over the network.

But Access is not made for this. It only supports one connection at a
time, and its SQL ODBC driver is pathetically limited compared to a real
SQL database.

Tell them to get a real database and run it on the Linux box.

Scott


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

Date: Fri, 07 May 1999 17:22:55 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: MS Access database
Message-Id: <PjFY2.75$vP2.163@news.rdc1.tn.home.com>

>I'm building a simple web app right now where the client wants me to take an
>MS Access database (that he has written) and make it into the driving force
>behind an interactive Internet solution. The problem that I'm having is
>that the client wants to run the site off of Linux/Apache -- and I don't
>know how Access works on this kind of scenario.

Beware of clients who ignorantly define your design limitations. In this
situation, it's painfully obvious they need a consultant (stand up for
yourself) to explain to them what's wrong with this picture. I'm sure one of
these days someone will hack a module or library for Access, but even then you
are talking way too much overhead for an Internet site. The problem is
compounded further if it's a virtual server which takes a beating when
compared to a stand-alone.

>I would like to use Perl to
>do the data access.  However, I think the first step would be finding out if
>this is feasible.  So the questions are 1) is there any kind of DBM or ODBC
>driver for Access in a Linux/Apache scenario, 2) if so, where can I go about
>finding it, and how do I install it, and 3) what Perl modules are out there
>to provide support for the data access.  As always, any help is greatly
>appreciated.


My gut reaction is that your clients are using Access and want to update their
own database? I had the same situation about 6 months ago. Here's the
crosseyed compromise I used...

Use a flat-file export from Access(if it is a single table) with simple perl
db interface. I did so including some file upload utilities that would allow
the client to upload the newest export so they could maintain control of their
Access DB and not have version conflicts between the site and the store. It
was kind of 'hacky', but it works and they were happy with it.

So to answer a Perl question. Yes, you can do this if you use a flat file
export from Access or convert the Access DB to another Perl-enabled DB
solution.

CT




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

Date: Fri, 07 May 1999 16:24:54 GMT
From: "Vincent P. Mautone" <vince@oxxfordinfo.com>
Subject: Need help with hash tables
Message-Id: <qtEY2.78$2w3.44440@client.news.psi.net>

I need to enter a key that starts with a number into a hash table for the
HTTP::Request::Common module
$form_ref parameter (1stTypes=>). Does anyone know how I can do this. If
not, does anyone know a way to get around this problem.

$response2 = $ua2->request(POST $http,

 [ txtStreet => "", txtCity => "", txtState => "",
 txtZip => $line, txtAreaCode => "", hidSearch => "Search",
 txtHits => "2", txtRadius => "60", 1stTypes => "0",
 btnSubmit => "Search+For+States" ]

 );






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

Date: 7 May 1999 17:19:44 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: ODBC and Access memo fields
Message-Id: <373320b0.0@news.new-era.net>

gregarine (michaelw@palawnet.com) wrote:
> I am using Active Perl on NT using ODBC to access a memo field out of
> Access97. The problem is that I am only getting part of the memo field loaded
> into my perl variable.	Their is a long article in the memo field.  It seems
> due to some sort of character limitation because when i cut stuff out of the
> memo field I am able to load a bit more.  Thus I don't think it is due to
> some sort of unrecognizable caharacter or an EOF.

You may very well be hitting a limit on the amount of data that can go
through an Automation string. I think the limit is 255 bytes, but it has
been so long since I encountered that limit I can't remember. I don't
think this is an Access bug as much as it is the Automation system's bug.
I think the limit is built into the BSTR data type. It's been a long
time, though, since I dealt with that. 

Scott


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

Date: Fri, 7 May 1999 14:48:09 -0300
From: "Kevin Howe" <khowe@performance-net.com>
Subject: Oops, here is the script
Message-Id: <WFFY2.27762$134.324969@tor-nn1.netcom.ca>

use strict;
my ($string,$search);
my $count = "1";
my $count_ref  = \$count;

$string = "<a>this<b> <c>that<d>";

$string =~ s/<a>(.*?)<b>|<c>(.*?)<d>/&get_val/egi;

my $a = "kev";

sub get_val{
 my $val = $$$count_ref;
 $count += 1;
 return $val;
}

print $string;





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

Date: 7 May 1999 17:05:21 GMT
From: jared@pandora.planet.net (Jared Hecker)
Subject: Oraperl question (newbie)
Message-Id: <7gv6gh$87u@jupiter.planet.net>

Hi, all -

I am an Oracle DBA with light perl experience, getting to know Oraperl.

I have a perl script that writes a multi-column array to a flat file.  I
would like to amend it to write to an Oracle table.

I have the latest Oracle DBD installed, along with the latest perl
release.  I have been reviewing the 'commit.pl' example script included
with the DBD distribution and wondered how one inserts multiple records
into a table out of an array.   Does one set up a small loop and do it one
record at a time? That would be inefficient, and doesn't seem a perl-ish
approach to me.

If it is convenient, e-mail will reach me faster.

TIA -

Regards,
jh
--
Jared Hecker	| HWA Inc. - Oracle architecture and Administration
jared@hwai.com	|  ** serving NYC and New Jersey **


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

Date: Fri, 07 May 1999 15:59:10 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl script as "cat" - but slower
Message-Id: <37390aac.1535538@news.skynet.be>

caf wrote:

>while ( <> ) {
>        print $_;
>        system( sleep 1 );
>}

Heh! I thought you were complaining that "cat in Perl" is slower than
the "real thing".

BTW try

	perl -pe "sleep 1" FILELIST

and you don't need the system call.

>It goes through the LINES slowly, but unfortunatly because some of the escape
>codes make the cursor move to different points of the screen and insert text
>(with being a line) so bits of the file speed through.
>
>Is there are way to go through a configurable number of characters and then
>pause rather than be line based ?

well, yes. 

	while($file = shift) {
		open(FILE, $file); #or die...
		while(read(FILE,$_,256)) {
			print;
			sleep 5;
		}
	}

Something like this?

	Bart.


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

Date: 07 May 1999 13:36:01 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: PERLFUNC: binmode - prepare binary files on old systems
Message-Id: <x7wvyku6im.fsf@home.sysarch.com>

>>>>> "BL" == Bart Lateur <bart.lateur@skynet.be> writes:

  BL> Larry Rosler wrote:

  >> It is hard to believe that a 'programmer' doesn't know!  A text file 
  >> consists of a sequence of characters organized into lines (i.e., with 
  >> chunks terminated by line endings, whatever they may be).  A binary file 
  >> is a sequence of characters without such an organization.  Sheesh!

  BL> Makes you wonder why Unix (and Perl) needs the -T and -B filetest
  BL> operators anyway...

  BL>                 -T  File is a text file.
  BL>                 -B  File is a binary file (opposite of -T).

those are guesses based on percentages of printable/non-printable chars
in the first block. not something i have needed since i know what files
i am dealing with. but if you are scanning a large dir tree for strings,
it might be faster to skip binary files if you can't tell by their names
or suffixes. i am sure there are other uses for those tests.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: 07 May 1999 12:51:01 -0400
From: Jay Rogers <jay@rgrs.com>
Subject: Re: Problem with Net::Telnet and its output kinda resolved
Message-Id: <82iua4258q.fsf@shell2.shore.net>

"Tom Ashbrook" <tashbrook@edisonenterprises.com> writes:

> Actually the prompt is OK for now but I understand what you mean.
> 
> I think I actually fixed the problem by working around in the code.  By
> using input_log() and dump_log() I noticed that the HP servers and one or
> two of the AIX servers would echo each command back.  This echo must be
> discarded by the Telnet.pm.  If I look in the dump files of an HP server I
> will see my command input as "uptime" and the string "uptime" echoed back.
> On most of the AIX boxes there is not an echo of the command line.  This
> must be the setup of the individual servers.
> 
> The work around is shown below.  I used print and getline and looked for the
> actual echo of the command.  If there was an echo I grabbed the next line to
> get the actual output of the command I issued.
> 
> I hate to work things like this and it should be built into the Telnet
> module in my opinion.

The current version of Net::Telnet (3.01) does handle this.
Perhaps you have and older version.

The routine that runs and returns output from a remote command,
cmd(), will strip the first line of output based or whether or
not it thinks the remote side is echoing.  Net::Telnet figures
this out using TELNET option negotiation.  See the
cmd_remove_mode() entry in the manpage for more info.

--
Jay Rogers
jay@rgrs.com


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

Date: Fri, 07 May 1999 16:17:47 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Q Re Negation in Regular Expressions
Message-Id: <LmEY2.3924$bk1.375725@news2.rdc1.on.home.com>

In article <3732EB52.25D0@nist.gov>,
 Bill Fisher <william.fisher@nist.gov> wrote:
!  In implementing some spelling correction rules,
!  I want to change "grammer" to "grammar" except where
!  it's preceded by "kelsey".  SO,
!   
!     s/(\s+)(!kelsey)(\s+)grammer/$1$2$3grammar/gi;
!  
!    This try uses !STRING as abbreviation for whatever
!  is the right way to say "any string that doesn't match
!  STRING".  But it doesn't work, and nobody here knows a
!  way to do it.  Do you?
 
well, (?!kelsey) would be a negative look-ahead, But it is a
zero-width assertion (doesn't eat any of the target string) and
wouldn't work in the manner you want ... What you want is a negative
look-behind and Perl has one (in recent perl's) for fixed width
look-behinds such as yours:

s/(?<!kelsey)(\s+)grammer/$1grammar/gi;

I believe (?<!...) wasn't introduced till perl5.005. If you have an
earlier version that only supports look-ahead you can do it the poor
man's way by reversing the string, doing it all backwards using
negative look-ahead, and reversing the string back again:

    $_ = reverse;
    s/remmarg(?!\s+yeslek)/rammarg/gi;
    $_ = reverse;

Or, you could do further testing on the replacement side
with the /e modifier:

s/(kelsey\s+grammer|grammer)/($a=$1)=~m!^k!i?$a:"grammar"/gie;

And I'm probably overlooking one or two painfully obvious
ways to do it as well.

regards
andrew


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

Date: Thu, 6 May 1999 11:37:07 -0600
From: "TerminalBliss" <givenc@rmci.net>
Subject: Real Time file access
Message-Id: <cBFY2.1781$h3.210732@news21.ispnews.com>

How would I go about reading from a pipe in real time. I currently do
something like this
open(F,"cat somefile|") {
while(<F>) {
    print("$_\n");
}
close(F);

This currently works ok but it has pauses every few seconds then dumps a
bunch of output. then pauses again. Any suggestions on how to fix this would
be welcome.




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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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