[15935] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3348 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 13 21:06:19 2000

Date: Tue, 13 Jun 2000 18:05:17 -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: <960944716-v9-i3348@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 13 Jun 2000     Volume: 9 Number: 3348

Today's topics:
        accessing file with samba <pjakobs@wt.net>
    Re: Another Regular Expression Question <wonderland@141.com>
    Re: Another Regular Expression Question (Craig Berry)
    Re: Another Regular Expression Question (Craig Berry)
    Re: ANSI Perl: No Way !!! <callgirl@la.znet.com>
    Re: ANSI Perl: No Way !!! <care227@attglobal.net>
    Re: ANSI Perl: No Way !!! <godzilla@stomp.stomp.tokyo>
    Re: ANSI Perl: No Way !!! (Jerome O'Neil)
    Re: Any function to include a HTML file into the Perl s <dzade@bellatlantic.net>
        Can't find the syntax error! <grichard@uci.edu>
    Re: Can't find the syntax error! <uri@sysarch.com>
        FileHandle simulation within a script? <johndoyle33@hotmail.com>
        help - redefined subroutine warning (David Krainess)
    Re: help - redefined subroutine warning (Bart Lateur)
    Re: help - redefined subroutine warning <lr@hpl.hp.com>
    Re: help - redefined subroutine warning (David Krainess)
        Installing Modules <todd@mrnoitall.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 13 Jun 2000 17:52:26 -0500
From: Paula Jakobs <pjakobs@wt.net>
Subject: accessing file with samba
Message-Id: <3946BB2A.26991561@wt.net>

I'm running a script from our NT machine that needs to access a file on
our linux machine. I have Samba set-up to do sharing on the directory
where the file is located, and I can get to it fine from windows
explorer. I'm having problems figuring out how to access it from the
perl script.

The windows path to the file is:

\\Www\RRS\data\1050-1104001.txt

And I've tried different variations of:

my $readfile="//Www/RRS/data/1050-1194001.txt";
open (BROWSE, "$readfile") or die "Can't open $readfile: $!";

but I always get the error "Invalid Argument" I've also tried

$readfile="\\Www\RRS\data\1050-1194001.txt";
$readfile="\\\\Www\\RRS\\data\\1050-1194001.txt";
$readfile="http://www.redrhinosports.com/data/1050-1194001.txt";
(the file is in a directory for another web site of ours)

I'd appreciate any suggestions.

Thanks,
Paula



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

Date: Tue, 13 Jun 2000 15:55:35 -0700
From: Wonderland Enterprises <wonderland@141.com>
Subject: Re: Another Regular Expression Question
Message-Id: <juedkso0m919novrcmc2a6ulcrqhp3c64j@4ax.com>

On Tue, 13 Jun 2000 20:16:44 GMT, pacman@defiant.cqc.com (Alan Curry)
wrote:

>In article <s85dkss9f5ovkulu69lr74l2k4f3rt04rp@4ax.com>,
>Wonderland Enterprises  <wonderland@141.com> wrote:
>>I want to replace any multiple appearance (more than three) of an
>>individual character with three of that character. 
>
>s/(.)\1{2,}/$1$1$1/gs;

Thanks much.

Dan




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

Date: Wed, 14 Jun 2000 00:12:18 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Another Regular Expression Question
Message-Id: <skdjf27mis4133@corp.supernews.com>

Wonderland Enterprises (wonderland@141.com) wrote:
: Is there a simple regular expression that would do the following?
: I want to replace any multiple appearance (more than three) of an
: individual character with three of that character. 

  s/(.)\1{3,}/$1 x 3/eg;

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Beauty and strength, leaping laughter and delicious
   |   languor, force and fire, are of us." - Liber AL II:20


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

Date: Wed, 14 Jun 2000 00:13:21 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Another Regular Expression Question
Message-Id: <skdjh1dgis4109@corp.supernews.com>

Alan Curry (pacman@defiant.cqc.com) wrote:
: In article <s85dkss9f5ovkulu69lr74l2k4f3rt04rp@4ax.com>,
: Wonderland Enterprises  <wonderland@141.com> wrote:
: >I want to replace any multiple appearance (more than three) of an
: >individual character with three of that character. 
: 
: s/(.)\1{2,}/$1$1$1/gs;

Using {2,} leads to no-op replacements for runs of 3; {3,} only replaces
runs of 4 or more.

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Beauty and strength, leaping laughter and delicious
   |   languor, force and fire, are of us." - Liber AL II:20


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

Date: Tue, 13 Jun 2000 15:06:15 -0700
From: "Godzilla!" <callgirl@la.znet.com>
Subject: Re: ANSI Perl: No Way !!!
Message-Id: <3946B057.A8ADEC12@la.znet.com>

Neil Kandalgaonkar wrote:
> Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
 
> >Consider, worthless -w warnings. Ain't good for nothing
> >but annoying the heck out of you and confusing newbies
> >till they scream along with wasting a lot space in core.

> >Envision -w with DOS like switches:

> >-w /l     (check lexical scoping)
> >-w /d     (check dynamic scoping)
> >-w /my    (check my usage of my)
> >-w /local (check my usage of local)
> >-w /anon  (check my anon references)
 
> Some of what you suggest was always available as 
> options to use strict. -w warnings were never useless,
> IMO, but you have a point.
 
Useless from my personal perspective. They annoy me
to no end. Still, I should qualify my position better
by stating warnings are great for those new to Perl
or intermediate skills. However, another qualification.
Warnings are pure gibberish, as is.

What I am suggesting is pulling everything possible
out of core, developed very specialized modules, as
suggested by my DOS switch examples. These specialized
modules would be of almost short story length, a tutorial
within each, all written in very Plain English by
a skilled Ghost Writer. Perl experts, as a general
rule, are not very good writers. This applies to all
technical fields and beyond.

As example, picking on myself, when I taught in 
high school, very often students would ask me to
lower my language level, which I did. Why this
happens is high level language is 'natural' to
me because of my education. Inherently, I speak
at a higher language level and never notice this
until it is pointed out. Same principle applies
to all tech fields. One last example, I would give
Mr. Schwartz's books a readability factor of 3,
meaning thirty percent of what he writes is easy
to read. Expanding, another forty percent of what
he writes is difficult but not impossible to read.
The remainder is simply beyond any person's reading
comprehension skill level. Techo-gibberish.

So you see when a specialist, in linguistics or
programming or any tech field, when a specialist
writes his or her own books, this is certainly a
guarantee of failure in communication, sans our
hero Cool Hand Luke.

Only exception are novelist such as myself. However,
writing stories is not technical in nature; it's natural.

Perl 5 core could be stripped down to a sleek and slim
hot rod of a language and, pragmas, whatever else, could
be greatly expanded into useful tools, for all skill
levels. These modules could be called in when needed
and left out when not, keeping core to a minimum.

 
> >Documentation could afford
> >paragraph length explanations with internal
> >links to expanded information and examples.
 
> I think it's clear that many pages of the docs
> are not for new users. This does suck.

Absolutely. Even at my skill level, there is much
documentation I simply cannot comprehend. It is
exceptionally poorly written. Clearly I am a
pro in English and am familiar with other languages.
If I cannot translate this documentation and truly
understand it, very few can.

Here, this is well exemplified. Those who are not
accustomed to finding documentation, those who are
not fully familiar with the tech language, might
follow a person's suggestion to check documentation.
Upon arrival, if he actually ever does find any
documentation after an hour of searching, this 
person thinks,

"What the F-word is this garbage?"

This snobbish elitist attitude amongst leaders
in Perl is reflected in documentation,

"You are a newbie? Tough luck Bud. Go away."

Isn't this the basic message of documentation?
It's an attitude problem beyond poor skills
in written communication.


> P.S. Ms. Schilitubi, I have been one of your vocal critics,

No, you are one of my numerous trolls and harassers.
Call it as it truly is if you wish to survive my
sharp tongue and biting wit.


> have a long record of anti-social behaviour in this newsgroup.

Mule manure. Look at the long history of abuse targeting
myself, perp'd by so many here. This abuse includes name
calling, personal insult, rumor mongering, harassment,
trolling, crimes and even racial slurs of such an abhorrent
nature, they constitute a federal hate crime.

What you don't see is the email harassment with which I am
contending, email bombing, break-in attempts at my sites and,
you don't see how many times I have had to contact both ISPs
and law enforcement to deal with these sociopathic events.
Even you suggested committing crimes against me, suggested
and encouraged others to setup a slander page specifically
targeting me. You did this. Care to deny this?

Incidently, do you know Anne Bennett at your college?

Absolutely nobody here has ever witnessed me engaging
in these types of activities, for good reason; I don't.
I have pride and dignity. You people do not.

However, there may be times I slip and refer to one
of you boys as a Neandertal or a Weenie Wagger, after
being sufficiently provoked by your constant harassment.

I will be quite candid with you. I don't like people here.
Be sure of this. I don't like you people save perhaps
for Ms. Ashton but she pushes my patience at times.
Nonetheless, Ms. Ashton and myself are working things
out, or I hope this is the case. I am trying. She
appears to be trying. This is appropriate behavior.

> My approval is surely meaningless to you, 

Absolutely meaningless and of no value. Your past
behavior has led me to personally categorize you
as a nobody, a troll, a harasser, a pseudo-criminal
deep into casting stones within your house of glass
enclosing your fragile testosterone laden ego.

Censorship is for fascists and those men willing to
blow their coins buying a DNS with an intent
of censorship or those willing to file falsified
complaints, with the same intent of censorship.

> but I wish more of your postings were like this.

If wishes were mules, your front yard would
be full of mule manure.

I don't deal in wishes, fantasies and denial.

I deal in reality. Want me to deal you another
hand of reality? I am a highly skilled poker
player and never bluff.

Quite curious, why are you boys not yelling
at this person pretending to be more than
a dozen different people here, both male
and female, posting fake articles with
concealed malice intent? 

Hypocrisy at play you think?


Godzilla!


He said, "Son I've made a life out of reading people's faces
 And knowing what the cards were, by the way they held their eyes.
 So if you don't mind my sayin', I can see you're out of aces.
 For a taste of your whiskey, I'll give you some advice."


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

Date: Tue, 13 Jun 2000 18:55:47 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: ANSI Perl: No Way !!!
Message-Id: <3946BBF3.520E33A7@attglobal.net>

"Godzilla!" wrote:
> 
> This abuse includes name
> calling, personal insult, rumor mongering, harassment,
> trolling, crimes and even racial slurs of such an abhorrent
> nature, they constitute a federal hate crime.

Will you be silnet already on this hate issue.  _If_ you are 
the victim of a crime, please press charges.  If not, end the 
topic.  

> What you don't see is the email harassment with which I am
> contending, email bombing, break-in attempts at my sites and,
> you don't see how many times I have had to contact both ISPs
> and law enforcement to deal with these sociopathic events.
> Even you suggested committing crimes against me, suggested
> and encouraged others to setup a slander page specifically
> targeting me. You did this. Care to deny this?

Proof?

(...)
> Censorship is for fascists and those men willing to
> blow their coins buying a DNS with an intent
> of censorship or those willing to file falsified
> complaints, with the same intent of censorship.

Maybe the purchaser of that domain thought the name clever,
and wanted it for his own.  I think it was right clever.

> If wishes were mules, your front yard would
> be full of mule manure.

Much like your postings?

Your posts are the same kind of self aggrandizing ego stroking 
that you constantly decry and accuse others of.  If you are
actually serious about your beliefs (which I doubt) you might
want to take a look back and see how often you speak of yourself
in lofty terms while speaking of others as "weenie waggers". 
The majority of insults spew forth from the tower of _babble_
(pun intended, poetic license on the spelling) that you have
crafted around yourself.  Then, if you could be so kind, spend
a few minutes in news.newusers.questions asking about such things
as posting on topic and not starting flamewars.

And then, after you've done all of this....  get lost.


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

Date: Tue, 13 Jun 2000 17:04:59 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: ANSI Perl: No Way !!!
Message-Id: <3946CC2B.9B4E8A97@stomp.stomp.tokyo>

Drew Simonis wrote:
 
> "Godzilla!" wrote:

(snipped trolling, harassment, personal insults)

As with others, I will ask you to not troll
and harass me. This sociopathic behavior of
yours only serves to anger people and cause
problems within this newsgroup.


Godzilla!


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

Date: Wed, 14 Jun 2000 01:03:06 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: ANSI Perl: No Way !!!
Message-Id: <eRA15.544$Kr1.56582@news.uswest.net>

"Godzilla!" <godzilla@stomp.stomp.tokyo> elucidates:
> Drew Simonis wrote:
>  
>> "Godzilla!" wrote:
> 
> (snipped trolling, harassment, personal insults)
> 
> As with others, I will ask you to not troll
> and harass me. This sociopathic behavior of
> yours only serves to anger people and cause
> problems within this newsgroup.

It's highly entertaining, watching people poke you.

You are our very own state machine!  What can we make you
do next?


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

Date: Tue, 13 Jun 2000 23:28:20 GMT
From: "David Zade" <dzade@bellatlantic.net>
Subject: Re: Any function to include a HTML file into the Perl script
Message-Id: <osz15.1517$vM.66256@typhoon1.ba-dsg.net>

If you mean like ASPs (Active Server Pages), yes on WIN32 platforms using
ActiveState's distribution.  You can use PerlScript instead of VBScript in
ASPs.  With regards to UNIX based systems I am not sure.

DAVid zADE
Chu <chus@netvigator.com> wrote in message
news:8hb9pf$bp53@imsp212.netvigator.com...
> Dear all Perl specialist,
>
>     In the PHP, you can include a HTML file inside the script.
>
>     Can the Perl do that?  If can, how?
>
> Best Rgds,
> Eddie Chu
> chus@netvigator.com
>
>




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

Date: Tue, 13 Jun 2000 15:03:03 -0700
From: "Gabe" <grichard@uci.edu>
Subject: Can't find the syntax error!
Message-Id: <8i6bab$o7n$1@news.service.uci.edu>

The error message is:

Global symbol "fldnames" requires explicit package name at quote.cgi line
47.

syntax error at quote.cgi line 64, near "}"

My code is:

  my @fldnames;
  for (my $i=0; $i<$fldnum->{NUM_OF_FIELDS}; $i++) {
   unless (($tbldef->[$i]->[0] eq 'prosid') || ($tbldef->[$i]->[0] eq
'reviewed') || ($tbldef->[$i]->[0] eq 'contacted') || ($tbldef->[$i]->[0] eq
'policy') || ($tbldef->[$i]->[0] eq 'complete')) {
    if (($tbldef->[$i]->[3] eq 'No') && (!$cgi->param($tbldef->[$i]->[0]))

     print
$cgi->redirect('http://www.bestinsuranceinc.com/incomplete.html');
    }
    elsif ($cgi->param($tbldef->[$i]->[0])) {
     push (@fldnames, $tbldef->[$i]->[0]);
    }
   }
  }
  my $fldstr;
  my $plcehldr;
  my @values;
  foreach my $i (@fldnames) { # This is line 47
   $fldstr .= "$i, ";
   $plcehldr .= '?, ';
   push @values, $cgi->param($i);
  }
  substr($fldstr, -2) = "";
  substr($plcehldr, -2) = "";
  my $insquery = qq{INSERT INTO prospects ($fldstr) VALUES ($plcehldr)};
  my $addpros = $dbh->prepare($insquery);
  $addpros->execute(@values) || die $dbh->errstr;
 }
} #This is lin 64

I don't see the problem. Please help. Any other comments on my program would
be appreciated as well.

Gabe




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

Date: Tue, 13 Jun 2000 23:10:31 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Can't find the syntax error!
Message-Id: <x78zw989ej.fsf@home.sysarch.com>

>>>>> "G" == Gabe  <grichard@uci.edu> writes:

  G> The error message is:
  G> Global symbol "fldnames" requires explicit package name at quote.cgi line
  G> 47.

you seem to have declared @fldnames in some block which is not including
line 47. 

  G> syntax error at quote.cgi line 64, near "}"

can't tell as the rest of the code is missing. could be a block/nesting
problem. fix your indenting. i have never seen 1 char indent. it is
almost useless. use at least 4 (i like good old 8 myself).

  G> My code is:

  G>   my @fldnames;
  G>   for (my $i=0; $i<$fldnum->{NUM_OF_FIELDS}; $i++) {
  G>    unless (($tbldef->[$i]->[0] eq 'prosid') || ($tbldef->[$i]->[0] eq
  G> 'reviewed') || ($tbldef->[$i]->[0] eq 'contacted') || ($tbldef->[$i]->[0] eq
  G> 'policy') || ($tbldef->[$i]->[0] eq 'complete')) {

you don't need parens around each eq expression. and sisnce you are
testing if a token is one of a set, a hash is much better than a list of
eq's

and besides, that is totally unreadable. format it like this (if you
must use this code):

	for (my $i=0; $i<$fldnum->{NUM_OF_FIELDS}; $i++) {

		unless ( $tbldef->[$i]->[0] eq 'prosid' || 
			 $tbldef->[$i]->[0] eq 'reviewed' || 
			 $tbldef->[$i]->[0] eq 'contacted') ||
			 $tbldef->[$i]->[0] eq 'policy' ||
			 $tbldef->[$i]->[0] eq 'complete' ) {


			if ( $tbldef->[$i]->[3] eq 'No' && 
			     !$cgi->param($tbldef->[$i]->[0]))

where is the open brace for that if? probably the cause of your
error. see how good formatting helps with debugging?

  G>   my $insquery = qq{INSERT INTO prospects ($fldstr) VALUES ($plcehldr)};

no need for qq there as there are no quotes in the string.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Wed, 14 Jun 2000 00:48:16 GMT
From: Chovy <johndoyle33@hotmail.com>
Subject: FileHandle simulation within a script?
Message-Id: <8i6kob$r8i$1@nnrp1.deja.com>

Hello,

I want to iterate through a loop, which basically will generate rows of
a table on the fly.

I can do this with a FileHandle, but I would rather append to a variable
within the script without using anything outside the script (like a
filehandle)....is there someway of simulating a FileHandle in perl?

Here's a sample script:

    while(@results = $sth->fetchrow_array()) {

      $print_links = qq(
    <a href="../commentary/feature/$db_file">$db_title</a><br>
      );

    }

I want to append this to the previous value of $print_links...any
suggestions?

--
Thanks,
Chovy
johndoyle33@hotmail.com


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


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

Date: Tue, 13 Jun 2000 22:18:43 GMT
From: davidkrainess@yahoo.com (David Krainess)
Subject: help - redefined subroutine warning
Message-Id: <8F52914D8davidkrainessyahooco@38.8.213.2>

The condensed (very condensed) code is like:

#!/usr/bin/perl -w

use strict;
use CGI;
use DBI;


sub a{

    b();

}

sub b{
#some expression

}

print a(1);

I get a redefined subroutine warning for sub b.  Everything seems to work 
OK and all varables are defined like main::var_1 so I don't have to worry 
about the nested subroutine lexical variable issue.  Is this warning OK or 
what can I do to fix it?

BTW: I am using perl 5.6 with ModPerl on Apache



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

Date: Tue, 13 Jun 2000 22:44:58 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: help - redefined subroutine warning
Message-Id: <394bb939.1573546@news.skynet.be>

David Krainess wrote:

>use CGI;

>sub b{
>}

>I get a redefined subroutine warning for sub b. 

That is because b() is a sub in CGI.pm ("<B>", remember?)

-- 
	Bart.


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

Date: Tue, 13 Jun 2000 16:22:09 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: help - redefined subroutine warning
Message-Id: <MPG.13b061f844be223998ab6e@nntp.hpl.hp.com>

In article <394bb939.1573546@news.skynet.be> on Tue, 13 Jun 2000 
22:44:58 GMT, Bart Lateur <bart.lateur@skynet.be> says...
> David Krainess wrote:
> 
> >use CGI;
> 
> >sub b{
> >}
> 
> >I get a redefined subroutine warning for sub b. 
> 
> That is because b() is a sub in CGI.pm ("<B>", remember?)

But why is it imported into the main:: namespace if he didn't use

   use CGI ':all';

or

   use CGI ':standard';

I'll wager he did use one of them, and didn't tell us!

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


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

Date: Wed, 14 Jun 2000 00:26:00 GMT
From: davidkrainess@yahoo.com (David Krainess)
Subject: Re: help - redefined subroutine warning
Message-Id: <8F52BC1C6davidkrainessyahooco@38.8.213.2>

bart.lateur@skynet.be (Bart Lateur) wrote in 
<394bb939.1573546@news.skynet.be>:
>
>That is because b() is a sub in CGI.pm ("<B>", remember?)
>

lr@hpl.hp.com (Larry Rosler) wrote in 
<MPG.13b061f844be223998ab6e@nntp.hpl.hp.com>
>
>But why is it imported into the main:: namespace if he didn't use
>
>   use CGI ':all';
>
>or
>
>   use CGI ':standard';
>
>I'll wager he did use one of them, and didn't tell us!
>


Sorry for the confusion (I should have used sub 1 and sub 2).
Actually a and b are only for example purposes and not actually used in my 
code.  I used main::var_1 because my variables were getting thrashed in the 
subroutines.  Another note is that there are no warnings in cgi-bin, only 
with the modperl handler.

Here is the actual error log to clarify:

###ERRORLOG
Subroutine display_cell redefined at /usr/local/apache/perl-bin/samp_browse
	line 67 (#1)
Subroutine display_table_list redefined at
	/usr/local/apache/perl-bin/samp_browse line 78 (#1)
Subroutine display_table redefined at /usr/local/apache/perl-
bin/samp_browse
	line 107 (#1)
###END ERRORLOG 

display_cell is "nested" (not in-line) in display_table_list and 
display_table.

Once again everything "appears" to be working great, so should I set no 
warnings on this, or is something very wrong with modperl redefining the 
functions.  Once again, variables are used like main::var_1.

Any advice would be greatly appreciated.

(Here is the actual code if anyone wants to see it)
(This is hacked code from the MySQL book that worked before I added some 
functionality to it.  MySQL was written by Paul DuBois and is a great book)

#! /usr/bin/perl -w

# samp_browse - Allow samp_db database browsing using Web browser

# PREAMBLE
use DBI;
use CGI;
use strict;
use diagnostics;

# default connection  parameters - all missing
my ($host_name, $user_name, $password) = ("localhost", "root", "test");
$main::db_name = "UNIDATA";

# construct data source
my ($dsn) = "dbi:mysql:$main::db_name";
$dsn .= ":hostname=$host_name" if $host_name;
$dsn .= ";mysql_read_default_file=/usr/local/apache/conf/samp_db.cnf";

# connect to server
my (%attr) = ( RaiseError => 1 );
$main::dbh = DBI->connect ($dsn, $user_name, $password, \%attr);
# PREAMBLE

# MAIN-BODY
$main::cgi = new CGI;

# put out initial part of page
my ($title) = "$main::db_name Database Browser";
print $main::cgi->header ();
print $main::cgi->start_html (-title => $title);
print $main::cgi->h1 ($title);

# parameters to look for in URL
my ($tbl_name) = $main::cgi->param ("tbl_name");
my ($sort_column) = $main::cgi->param ("sort_column");
$main::start_row = $main::cgi->param ("start_row");

if (!$main::start_row){
   $main::start_row = 0;
}

# if $tbl_name has no value, display a clickable list of tables.
# Otherwise, display contents of the given table.  $sort_column, if
# set, defines the sort column.

if (!$tbl_name)
{
	display_table_list ()
}
else
{
	display_table ($tbl_name, $sort_column);
}

print $main::cgi->end_html ();
# MAIN-BODY

$main::dbh->disconnect ();
#exit (0);

# DISPLAY_CELL
# display a value in a table cell; put non-breaking
# space in "empty" cells so borders show up

sub display_cell
{
my ($tag, $value, $encode) = @_;

	$value = $main::cgi->escapeHTML ($value) if $encode;
	$value = "&nbsp;" unless $value;
	print "<$tag>$value</$tag>\n";
}
# DISPLAY_CELL

# DISPLAY_TABLE_LIST
sub display_table_list
{
my ($ary_ref, $url);

	print "Select a table by clicking on its name:<BR><BR>\n";

	# retrieve reference to single-column array of table names
	$ary_ref =
		$main::dbh->selectcol_arrayref (qq{ SHOW TABLES FROM 
$main::db_name });

	# display table with a border
	print "<TABLE BORDER>\n";
	print "<TR>\n";
	display_cell ("TH", "Table Name", 1);
	print "</TR>\n";
	foreach my $tbl_name (@{$ary_ref})
	{
		$url = $main::cgi->script_name ();
		$url .= sprintf ("?tbl_name=%s", $main::cgi->escape 
($tbl_name));
		print "<TR>\n";
		display_cell ("TD", $main::cgi->a ({-href => $url}, $tbl_name), 
0);
		print "</TR>\n";
	}
	print "</TABLE>\n";
}
# DISPLAY_TABLE_LIST

# need the _X to make the listelim tag not a subset of the previous one
# DISPLAY_TABLE_X
sub display_table
{
my ($tbl_name, $sort_column) = @_;
my ($sth, $url);

	# if sort column not specified, use first column
	$sort_column = "1" unless $sort_column;

	# present a link that returns user to table list page
	print $main::cgi->a ({-href => $main::cgi->script_name ()}, "Show 
Table List");
	print "<BR><BR>\n";

	$sth = $main::dbh->prepare (qq{
				SELECT * FROM $tbl_name ORDER BY $sort_column
                                LIMIT $main::start_row, 10
			});
	$sth->execute ();

	print "<B>Contents of $tbl_name table:</B><BR>\n";

	# display table with a border
	print "<TABLE BORDER>\n";
	# use column names for table headings; make each heading a link
	# that sorts output on the corresponding column
	print "<TR>\n";
	foreach my $col_name (@{$sth->{NAME}})
	{
		$url = $main::cgi->script_name ();
		$url .= sprintf ("?tbl_name=%s", $main::cgi->escape 
($tbl_name));
		$url .= sprintf ("&sort_column=%s", $main::cgi->escape 
($col_name));
		display_cell ("TH", $main::cgi->a ({-href => $url}, $col_name), 
0);
	}
	print "</TR>\n";

	# display table rows
	while (my @ary = $sth->fetchrow_array ())
	{
		print "<TR>\n";
		foreach my $val (@ary)
		{
			display_cell ("TD", $val, 1);
		}
		print "</TR>\n";
	}
        my $urlnext;
        my $urlprev;
        $url = $main::cgi->script_name ();
        $url .= sprintf ("?tbl_name=%s", $main::cgi->escape ($tbl_name));
        $urlnext = $url . sprintf ("&start_row=%d", ($main::start_row+10));
        $urlprev = $url . sprintf ("&start_row=%d", ($main::start_row-10));
        print $main::cgi->a ({-href => $urlprev}, "Previous");
        print $main::cgi->a ({-href => $urlnext}, "Next");



	$sth->finish ();
	print "</TABLE>\n";
}
# DISPLAY_TABLE_X



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

Date: Tue, 13 Jun 2000 18:56:11 -0600
From: Todd Anderson <todd@mrnoitall.com>
Subject: Installing Modules
Message-Id: <3946D804.5030114C@mrnoitall.com>

Can a perl module normally be installed in public_html?
I've uploaded the package "PDF-Create" and when telneting to Makefile.PL
I get a "permission denied" message. When propted from the browser I get
a "500 error".
Any ideas on where to get installation help, more extensive than CPAN's?

Thanks in advance.



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

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


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