[15473] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2883 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 27 18:10:47 2000

Date: Thu, 27 Apr 2000 15:10:24 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <956873424-v9-i2883@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 27 Apr 2000     Volume: 9 Number: 2883

Today's topics:
        HELP! I need a copy of the CGI script forms-lib.pl  ASA <larry@lwoods.com>
        How do I MsAccess Permission without using ODBCAdmin <patahul@tm.net.my>
        How to display all records in flat-file db using HTML iamdannon@my-deja.com
    Re: How to display all records in flat-file db using HT <rootbeer@redcat.com>
    Re: How to display all records in flat-file db using HT <jeff@vpservices.com>
    Re: Internal Error? (Tad McClellan)
    Re: is there sendmail on Win32 platform <you.will.always.find.him.in.the.kitchen@parties>
        Need help with file uploading script rockit7515@my-deja.com
    Re: Need help with file uploading script <rootbeer@redcat.com>
        Need help with the regex <Greg@LibertyMarketing.com>
    Re: Need help with the regex <lr@hpl.hp.com>
    Re: newbie q: Reassign STDOUT/ERR in DOS <Jonathan.L.Ericson@jpl.nasa.gov>
        Perl POD problem swaroop_g@my-deja.com
    Re: Perl POD problem <do.not.mail.me@null.net>
    Re: Perl POD problem <rootbeer@redcat.com>
    Re: Posting MIME articles from scripts <flavell@mail.cern.ch>
    Re: Problem FTPing tar file via PERL script <adam@netsetdesign.com>
    Re: Put Variable Initializations In Other File (Tad McClellan)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 27 Apr 2000 20:21:45 GMT
From: "Larry Woods" <larry@lwoods.com>
Subject: HELP! I need a copy of the CGI script forms-lib.pl  ASAP!
Message-Id: <tj1O4.80195$U4.739948@news1.rdc1.az.home.com>

Hi,

I have received a script that uses forms-lib.pl  and I don't have a
copy...and can't find one on the Web.

If you have a copy of forms-lib.pl  would you please send me a copy?

Thanks.

Larry Woods




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

Date: Fri, 28 Apr 2000 06:04:36 +0800
From: "Patahul Ariffin Abas" <patahul@tm.net.my>
Subject: How do I MsAccess Permission without using ODBCAdmin
Message-Id: <3908b8b3.0@news2.tm.net.my>

Hello,

I have a proble .... I AM A new bie. How to set a dsn in the virtual server?




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

Date: Thu, 27 Apr 2000 18:20:39 GMT
From: iamdannon@my-deja.com
Subject: How to display all records in flat-file db using HTML
Message-Id: <8ea0d4$g4n$1@nnrp1.deja.com>

Is there any place on the web or anybody who can tell me how to display all
records in a flat-file database?

I am using a very simple cgi script which keeps records in a pipe-delimited
database.  The script came with a search function, but it doesn't have the
capability to show all the records in the database.  I have been able to pull
each record into an array, but I can't figure out how to make each field
display as a separate field rather than as part of the larger array.

So rather than getting a pretty table with each field in a <TD> cell, I am
just getting rows that look like this: 1|04/25/00|Joe Smith|Joe's Comments

How do you pull the pieces of an array out into separate entities (I know
that's not the right terminology, but you know what I mean)?

Thanks,
Dannon


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 27 Apr 2000 11:48:20 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: How to display all records in flat-file db using HTML
Message-Id: <Pine.GSO.4.10.10004271147030.21722-100000@user2.teleport.com>

On Thu, 27 Apr 2000 iamdannon@my-deja.com wrote:

> Is there any place on the web or anybody who can tell me how to
> display all records in a flat-file database?

It sounds as if you want to search for the docs, FAQs, and newsgroups
about databases in general, and perhaps flat-file databases in particular.

> How do you pull the pieces of an array out into separate entities

Have you seen the entry on 'split' in the perlfunc manpage? Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 27 Apr 2000 12:13:29 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: How to display all records in flat-file db using HTML
Message-Id: <39089159.C29DB194@vpservices.com>

iamdannon@my-deja.com wrote:
 
> Is there any place on the web or anybody who can tell me how to display all
> records in a flat-file database?

You can go about this (at least) two ways.  One way is to use the
split() function which you can read about in the standard Perl
documentation.  A second way, illustrated below, uses database routines
which will also allow you to use advanced search and sorting
capabilities with no extra coding.
 
> So rather than getting a pretty table with each field in a <TD> cell, I am
> just getting rows that look like this: 1|04/25/00|Joe Smith|Joe's Comments

This 20 line script creates "a pretty table" from a "pipe-delimited"
database.  To make it work for any file, just install DBI and DBD::RAM
and change the name of the file_source:

#!perl -w
use strict;
use DBI;
use CGI qw(:standard);
my $dbh=DBI->connect('DBI:RAM:',,,{RaiseError=>1});
$dbh->func({
    file_source => 'test_db.pipe',
    sep_char    => '\|',
},'import');
my $sth  = $dbh->prepare('SELECT * FROM table1');
$sth->execute;
my $data = $sth->fetchall_arrayref;
print header,
      table(
          {Border => 1, Cellspacing => 0, Cellpadding => 2},
          Tr( {bgcolor=>'#cccccc'}, th( $sth->{NAME} ),
          map Tr(td($_)), @{$data} )
      )
;
__END__


-- 
Jeff


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

Date: Thu, 27 Apr 2000 16:26:27 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Internal Error?
Message-Id: <slrn8gh8jj.rn.tadmc@magna.metronet.com>

On Wed, 26 Apr 2000 22:57:50 -0700, Marcus Ouimet <mouimet@direct.ca> wrote:

>I am getting an internal server error when running my script 


Perl does not have a "server".

I think you have found the wrong newsgroup.


>for my web
>browser. I have checked the perl path by typing "which perl" in Red Hat
>Linux. The path was "/usr/bin/perl" so that is correct in my script. The
>script runs perfectly locally with no errors by typing "perl myscript.cgi".

Perl FAQ, part 9:

   "My CGI script runs from the command line but not the browser."


>I am rather confused on why this would be happening (I had this script on
>another web server and it worked fine) 


Then your Perl program must be fine.

So the problem must be related to the web server in some way.


>Any suggestions would be most
>appreciated as I am puzzled and may be overlooking something.


Ask web server questions in a newgroup related to web servers,
clpmisc is not such a newsgroup:

      comp.infosystems.www.servers.unix

You likely have some problem related to how you have
configured your server.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 28 Apr 2000 07:49:47 +1200
From: "Tintin" <you.will.always.find.him.in.the.kitchen@parties>
Subject: Re: is there sendmail on Win32 platform
Message-Id: <956864916.258576@shelley.paradise.net.nz>


"Philip Monitor" <brilliance201@hotmail.com> wrote in message
news:4hbggsga6d050pl72kf5u936979v14t039@4ax.com...
> On Thu, 27 Apr 2000 20:07:05 +0800, "netnews"
> <ya_hsiung@ms2.url.com.tw> wrote:
>
> >as title. so that I use it to send mail and receive mail in my perl
script
> >running on win98.
> >
>
> I'd check out Blat by Tim Charon.  I use it and it seems to work
> great.
>
> http://www.interlog.com/~tcharron/

But please remember that blat != sendmail and blat certainly will not
receive mail.




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

Date: Thu, 27 Apr 2000 18:14:01 GMT
From: rockit7515@my-deja.com
Subject: Need help with file uploading script
Message-Id: <8ea00p$fmi$1@nnrp1.deja.com>

I put free file uploading script on my server. Everything works fine
except little but very impotant detail:
after a .JPG image (I need only images to upload) is uploaded, it can't
be opened. Can anybody tell me what's the reason for this?

Thanks for your time.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 27 Apr 2000 11:32:45 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Need help with file uploading script
Message-Id: <Pine.GSO.4.10.10004271130470.21722-100000@user2.teleport.com>

On Thu, 27 Apr 2000 rockit7515@my-deja.com wrote:

> I put free file uploading script on my server. Everything works fine
> except little but very impotant detail: after a .JPG image (I need
> only images to upload) is uploaded, it can't be opened. Can anybody
> tell me what's the reason for this?

You did it wrong. :-)

Without seeing something more, like some source code, it's pretty hard to
tell from here. Maybe you should cut your code down to the smallest
example which demonstrates your problem, then post it here.

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 27 Apr 2000 20:31:56 GMT
From: "Gregory D. Fox" <Greg@LibertyMarketing.com>
Subject: Need help with the regex
Message-Id: <0t1O4.47485$MZ2.555047@news1.wwck1.ri.home.com>

Hi All,

I need help with the regex. I want to loop through the file and any matches
on the $keyword variable in any field in the file will be pushed into the
@searchresults array.

-------- Code ---------
 open(FILE,"<$productfile") or die "Can't open $productfile $!\n";
    while (<FILE>){
        ($itemcode, $category, $price, $shipping, $itemname, $description,
$keywords, $status, $imagename, $colors, $sizes, $comments, $dummy) = split
(/\|/);

 if ($keyword =~ /^.*/oi  && $adminbutton eq "Search By keyvar" ){
               push @searchresults, $_;
             }
}
------ End code -----

$keyword =~ /^.*/oi
                   ^^^^^^^
This is where i am having the problem.

Any help will be much appreciated.

Greg
Greg@LibertyMarketing.com






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

Date: Thu, 27 Apr 2000 14:08:47 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Need help with the regex
Message-Id: <MPG.13724c3a5e4219bd98a99b@nntp.hpl.hp.com>

In article <0t1O4.47485$MZ2.555047@news1.wwck1.ri.home.com> on Thu, 27 
Apr 2000 20:31:56 GMT, Gregory D. Fox <Greg@LibertyMarketing.com> 
says...
> Hi All,

Hi You,
 
> I need help with the regex. I want to loop through the file and any matches
> on the $keyword variable in any field in the file will be pushed into the
> @searchresults array.
> 
> -------- Code ---------
>  open(FILE,"<$productfile") or die "Can't open $productfile $!\n";

You are off to a fine start, though I might write the second argument as 
simply $productfile.

>     while (<FILE>){
>         ($itemcode, $category, $price, $shipping, $itemname, $description,
> $keywords, $status, $imagename, $colors, $sizes, $comments, $dummy) = split
> (/\|/);

I like to see 'my' ahead of that, which means you are using 'use 
strict;'.  Get in that habit (and using '-w') and many of your problems 
will fade away before they begin.

You don't need $dummy if you don't use it, because trailing values from 
the split() will be discarded.
 
>  if ($keyword =~ /^.*/oi  && $adminbutton eq "Search By keyvar" ){

Note how $keywords in the split() has become $keyword here?  Use '-w' 
and 'use strict;'.  (Repeat mantra over and over and over and ...)

>                push @searchresults, $_;
>              }
> }
> ------ End code -----
> 
> $keyword =~ /^.*/oi
>                    ^^^^^^^
> This is where i am having the problem.

Indeed.  What are you trying to match?  Your regex matches a string that 
has a beginning followed by anything at all, i.e. it matches anything at 
all.

My crystal ball says that you are trying to do a case-independent match 
against some user-supplied variable, which is constant for the run of 
the program, and in which metacharacter interpretation isn't desired.  
So:

  $keyword =~ /\Q$variable/oi

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 28 Apr 2000 14:16:26 -0700
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: newbie q: Reassign STDOUT/ERR in DOS
Message-Id: <3909FFA9.1A2DBB0@jpl.nasa.gov>

pt wrote:
>   I want to redirect STDERR (or STDOUT) before doing a "system" cmd,
> then restore these streams.  I'm running a Win98 DOS shell, so I can't
> use the usual redirection.  

I'm not sure why not (assuming I understand what you mean by 'usual
redirection'):

C:\TEMP>perl -e "system('ls 2> ls.err')"

C:\TEMP>type ls.err
The name specified is not recognized as an
internal or external command, operable program or batch file.

C:\TEMP>perl -e "system('dir *.err > dir.out')"

C:\TEMP>type dir.out
 Volume in drive C is Groucho
 Volume Serial Number is 5CDB-7997

 Directory of C:\TEMP

04/28/00  02:02p                   107 ls.err
               1 File(s)            107 bytes
                            109,967,360 bytes free

> This code will compile, but is it the "right" way (error handling left
> out for simplicity).

Error handling is always the "right" way.  Also '-w' and 'use strict;'. 
If you are making a bunch of system calls that you want to capture
exactly the same way, than opening STDOUT and STDERR to point to a file
is the way to go.  If you are making one system call, then save a few
keystrokes and use a simple redirect.
 
Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King


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

Date: Thu, 27 Apr 2000 19:58:08 GMT
From: swaroop_g@my-deja.com
Subject: Perl POD problem
Message-Id: <8ea646$mt3$1@nnrp1.deja.com>



hi,
 i am having following problem

 in my program (prog.pl) i have
 require "a.pl"

 pod documentation embedded at end
 of prog.pl.

 =head1

  xyz ...etc


 When i execute prog.pl it says

 a.pl did not return a true value at prog.pl line
19.

 i removed pod documentation and
 prog.pl executes OK !

 Can anyone give me a clue what is going on.


 a.pl has the last line as
 1;

thanks in advance
swaroop.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 27 Apr 2000 13:16:14 -0700
From: Mike Ayers <do.not.mail.me@null.net>
Subject: Re: Perl POD problem
Message-Id: <3908A00E.5EB6A4CB@null.net>


	Try:

#
#   Code at beginning
#

1;

__END__

=head1

xyz, etc.


	...but what you probablly want is just...


>  require "a.pl"
> 
>  pod documentation embedded at end
>  of prog.pl.
> 
=pod

>  =head1
> 
>   xyz ...etc
> 

	where the "=pod" directive tells the interpreter "ignore everything
between me and  the =cut directive.  That should clear you up.

	HTH,


/|/|ike


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

Date: Thu, 27 Apr 2000 13:20:59 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Perl POD problem
Message-Id: <Pine.GSO.4.10.10004271318570.21722-100000@user2.teleport.com>

On Thu, 27 Apr 2000 swaroop_g@my-deja.com wrote:

>  a.pl did not return a true value at prog.pl line

>  i removed pod documentation and
>  prog.pl executes OK !

>  a.pl has the last line as
>  1;

Is that last line part of the pod, or part of the code? I suspect that you
forgot to put a line like "=cut" before that line. (But maybe you and perl
have different ideas about what's pod. :-)

Unless you're intermixing pod and code, just put all of your pod after
that true value line. Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Thu, 27 Apr 2000 19:57:09 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Posting MIME articles from scripts
Message-Id: <Pine.GHP.4.21.0004271955330.28438-100000@hpplus01.cern.ch>

On 27 Apr 2000, CUESTA CUESTA wrote:

>   I only want to write an article using several formats at a same time.

And I "only" don't want to receive several formats at the same time.

It's as simple as that.  I reckon I have the netiquette on my side,
and you don't.



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

Date: Thu, 27 Apr 2000 20:02:55 GMT
From: Adam Zihla <adam@netsetdesign.com>
Subject: Re: Problem FTPing tar file via PERL script
Message-Id: <ma7hgsgvebhod8fmcr1v6ie26ckuvuued4@4ax.com>

The default transfer mode of Net::FTP is ASCII. Unfortunately,
I found that out the hard way when I found out that the backups
I did with my perl script were useless. The solution is to switch to
binary transfer mode:

$ftp->binary();

Hope it works out :)

On Thu, 27 Apr 2000 09:33:03 -0700, Tom Phoenix <rootbeer@redcat.com>
wrote:

>On Thu, 27 Apr 2000 kooloholic@my-deja.com wrote:
>
>> Depending on which machine I send it to, the tar file loses a byte
>> during the transfer. This happens for some destinations, but not
>> others.
>
>Sounds like a serious bug, probably(?) in those sites' FTP daemons. Just
>to be certain, though, are you sure you're sending it in binary mode? Can
>you send the same file to those sites without problems when you use
>another client than Net::FTP?
>
>> This doesn't through any errors, but of course completely corrupts the
>> tar file.
>
>Your spelling 'through' me for a moment there. :-)  You are checking for
>errors during the transfer, right?
>
>Good luck!



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

Date: Thu, 27 Apr 2000 16:31:12 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Put Variable Initializations In Other File
Message-Id: <slrn8gh8sg.rn.tadmc@magna.metronet.com>

On Wed, 26 Apr 2000 22:08:20 -0700, Anonymous <nobody@newsfeeds.com> wrote:

>  --------== Posted Anonymously via Newsfeeds.Com ==-------
>     Featuring the worlds only Anonymous Usenet Server
>    -----------== http://www.newsfeeds.com ==----------


Cool!

There are more posts here than I can read anyway.

It is very helpful to have posts identify themselves for deletion.

This newsite will be a boon to Usenet.


-- 
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 2883
**************************************


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