[22345] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4566 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 14 00:05:58 2003

Date: Thu, 13 Feb 2003 21:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 13 Feb 2003     Volume: 10 Number: 4566

Today's topics:
        -d not identifying directories <bcolby@attbi.com>
        -d not identifying directories (Chas Friedman)
    Re: -d not identifying directories (Jay Tilton)
    Re: -d not identifying directories <bcolby@attbi.com>
        Bad Output from Perldoc (Chas Friedman)
    Re: DB2 Connect and DBD::DB2 <a_bordia@hotmail.com>
    Re: DB2 Connect and DBD::DB2 <goldbb2@earthlink.net>
    Re: error in comparing user supplied data to database (Jay Tilton)
    Re: error in comparing user supplied data to database <urzaserra@home.com>
    Re: error in comparing user supplied data to database <urzaserra@home.com>
    Re: error in comparing user supplied data to database (Jay Tilton)
    Re: How to report progress on command line <spamfilter@cheiron-it.nl>
        Launch two programs simultaneously and continue when fi (Seth Brundle)
    Re: Launch two programs simultaneously and continue whe <ddunham@redwood.taos.com>
        Must escape characters for SSI 'include' emulator! (Chris Koenig)
    Re: Must escape characters for SSI 'include' emulator! <jkeen@concentric.net>
        nested file handlers <istink@real.bad.com>
    Re: newbie date comparison <Jodyman@hotmail.com>
    Re: newbie date comparison <bwalton@rochester.rr.com>
    Re: Perl+Tk+MySQL for Win32 that *works*? (Jim Seymour)
    Re: print <<HERE; <istink@real.bad.com>
    Re: Raw Access to the Parallelport (Si Ballenger)
    Re: stripping part of a string <Jodyman@hotmail.com>
    Re: Using a variable to create a slice <crgutierNO@SPAMdcc.uchile.cl>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 14 Feb 2003 02:10:19 GMT
From: "Bill Colby" <bcolby@attbi.com>
Subject: -d not identifying directories
Message-Id: <beY2a.91363$SD6.4879@sccrnsc03>

I am writing a simple CGI script to show directories as hyperlinks.  For
some reason not every directory is being identified when I test the file
name with the -d operator.  This is my script:

#!/usr/bin/perl -w

print "Content-type:text/html\n\n";
print "<html><head><title>Test Page</title></head>\n";
print "<body>\n";
print "<h2>Hello, world!</h2>\n";

$dir = "pictures";

#binmode(DIR);

@AllFiles = readdir(DIR);

closedir(DIR);

print("<h1>In Directory $dir<br>\n");

foreach $file (@AllFiles)
{
    @entry = stat($file);
    print("@entry\n");
    print "Readable\n" if -r _;
    print "Writable\n" if -w _;
    print "Executable\n" if -x _;
    print "Setuid\n" if -u _;
    print "Setgid\n" if -g _;
    print "Sticky\n" if -k _;
    print "Text\n" if -T _;
    print "Binary\n" if -B _;
    print "Directory\n" if -d _;
    print "Exists\n" if -e _;
   if(-d $file)
   {
      print "<a href=\"$file\">$file</a><br>\n";
      next;
   }
   print("$file<br>\n");
}

I have a folder called pictures and in it I have 3 other folders called,
XMAS, PRIVATE, OTHER.  PRIVATE is the only directory that is determined to
be a directory.  The other 2 are directories and have files in them.  They
also will come up with a null string if I do a stats($file) but PRIVATE
comes up saying directory, read, write, executible.  This is the case on a
WIN32 box running Active Perl version 616 (Perl 5.6) and on a UNIX box
running PERL 5.6.

Any help anybody can give would be great or if you need more information let
me know!!

Thanks,
Bill





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

Date: Fri, 14 Feb 2003 02:51:02 +0000 (UTC)
From: friedman@math.utexas.edu (Chas Friedman)
Subject: -d not identifying directories
Message-Id: <b2hlim$k1v$1@geraldo.cc.utexas.edu>



__________
Bill wrote:
>I am writing a simple CGI script to show directories as hyperlinks.  For
>some reason not every directory is being identified when I test the file
>name with the -d operator.  This is my script:
>
>#!/usr/bin/perl -w
>
>print "Content-type:text/html\n\n";
>print "<html><head><title>Test Page</title></head>\n";
>print "<body>\n";
>print "<h2>Hello, world!</h2>\n";
>
>$dir = "pictures";
>
>#binmode(DIR);
>
>@AllFiles = readdir(DIR);
>
>closedir(DIR);
 .......
 You need to open a directory handle before reading it (using
opendir (D,"pictures") or die "Can't open directory: $!"; for example);
since you don't seem to have done that, i don't see why @AllFiles contains
anything!
             chas




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

Date: Fri, 14 Feb 2003 02:36:08 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: -d not identifying directories
Message-Id: <3e4c5510.30672502@news.erols.com>

"Bill Colby" <bcolby@attbi.com> wrote:

: I am writing a simple CGI script to show directories as hyperlinks.  For
: some reason not every directory is being identified when I test the file
: name with the -d operator.  This is my script:
: 
: #!/usr/bin/perl -w
: print "Content-type:text/html\n\n";
: print "<html><head><title>Test Page</title></head>\n";
: print "<body>\n";
: print "<h2>Hello, world!</h2>\n";
: $dir = "pictures";
: #binmode(DIR);
: @AllFiles = readdir(DIR);

Where is the opendir()?  Is this really the program you're running?

: closedir(DIR);
: print("<h1>In Directory $dir<br>\n");
: foreach $file (@AllFiles)
: {
[snip]
:    if(-d $file)
:    {
:       print "<a href=\"$file\">$file</a><br>\n";
:       next;
:    }
:    print("$file<br>\n");
: }

from perldoc -f readdir

    If you're planning to filetest the return values out of a 
    readdir, you'd better prepend the directory in question. 
    Otherwise, because we didn't chdir there, it would have been 
    testing the wrong file.



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

Date: Fri, 14 Feb 2003 03:53:58 GMT
From: "Bill Colby" <bcolby@attbi.com>
Subject: Re: -d not identifying directories
Message-Id: <qLZ2a.95245$tq4.3465@sccrnsc01>

Thanks for your help guys.  A couple people commented on there being no
opendir() call but There definitely is one.  It must have gotten cut out
accidentally when I posted this up and edited to make it easier to read, I
took out stuff that wasn't relevant to the problem).  I figured out what I
was doing wrong (Forgot to include the $dir with the file name!) The reason
it was confusing was that a couple of the folders were also in the same
folder as the one the script was running from!!  Sorry for all the confusion
and thanks again for your help!!

Bill


"Bill Colby" <bcolby@attbi.com> wrote in message
news:beY2a.91363$SD6.4879@sccrnsc03...
> I am writing a simple CGI script to show directories as hyperlinks.  For
> some reason not every directory is being identified when I test the file
> name with the -d operator.  This is my script:
>
> #!/usr/bin/perl -w
>
> print "Content-type:text/html\n\n";
> print "<html><head><title>Test Page</title></head>\n";
> print "<body>\n";
> print "<h2>Hello, world!</h2>\n";
>
> $dir = "pictures";
>
> #binmode(DIR);
>
> @AllFiles = readdir(DIR);
>
> closedir(DIR);
>
> print("<h1>In Directory $dir<br>\n");
>
> foreach $file (@AllFiles)
> {
>     @entry = stat($file);
>     print("@entry\n");
>     print "Readable\n" if -r _;
>     print "Writable\n" if -w _;
>     print "Executable\n" if -x _;
>     print "Setuid\n" if -u _;
>     print "Setgid\n" if -g _;
>     print "Sticky\n" if -k _;
>     print "Text\n" if -T _;
>     print "Binary\n" if -B _;
>     print "Directory\n" if -d _;
>     print "Exists\n" if -e _;
>    if(-d $file)
>    {
>       print "<a href=\"$file\">$file</a><br>\n";
>       next;
>    }
>    print("$file<br>\n");
> }
>
> I have a folder called pictures and in it I have 3 other folders called,
> XMAS, PRIVATE, OTHER.  PRIVATE is the only directory that is determined to
> be a directory.  The other 2 are directories and have files in them.  They
> also will come up with a null string if I do a stats($file) but PRIVATE
> comes up saying directory, read, write, executible.  This is the case on a
> WIN32 box running Active Perl version 616 (Perl 5.6) and on a UNIX box
> running PERL 5.6.
>
> Any help anybody can give would be great or if you need more information
let
> me know!!
>
> Thanks,
> Bill
>
>
>




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

Date: Fri, 14 Feb 2003 04:03:44 +0000 (UTC)
From: friedman@math.utexas.edu (Chas Friedman)
Subject: Bad Output from Perldoc
Message-Id: <b2hpr0$ml8$1@geraldo.cc.utexas.edu>



__________
James wrote:
 >I have just installed Perl 5.8.0, ActivePerl build 804, on a machine running
>Windows95 and I am experiencing problems with the 'perldoc' command running
>from the command prompt.  Under each of the following three, very common
>situations:
>
>    perldoc -f [builtinfunction]
>    perldoc -q [word relating to FAQ]
>    perldoc [ModuleName]
>
>the text is not properly left-aligning.  Instead, it is skewing across the
>page as if it were a stack of playing cards being tilted to the right.   
 
 I noticed exactly the same thing when I upgraded to the Siemens Perl 5.8.0
from Siemens Perl 5.6.1 (both obtained from CPAN.)  I also noticed that
if I used the perldoc.bat from the 5.6.1 distribution then I didn't have the
problem even if I changed the reference in the perldoc.bat file from
5.6.1 to 5.8.0 and also even if I changed my path so that the 5.8.0 perl
was the only one included. This makes me think it is the perldoc.bat file
itself that is the problem and not the pod files. I also noticed that there
are a lot of differences between the 2 perldoc.bat files.
               chas


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

Date: Thu, 13 Feb 2003 18:32:29 -0800
From: "Aakash Bordia" <a_bordia@hotmail.com>
Subject: Re: DB2 Connect and DBD::DB2
Message-Id: <b2hkk6$7i$1@hanover.torolab.ibm.com>

Trying to understand your problem, What exactly is DBD:DB2?
Thanks
Aakash

"Wonderinguy" <wonderinguy@hotmail.com> wrote in message
news:6950e82.0302101333.6668881d@posting.google.com...
> I have a db2 connect server (windows) installed which is used to
> connect to db2 on OS/390.
> I have db2 connect personal edition on a Redhat 8.0
> A perl script using DBD::DB2 use the datasource in the redhat computer
> to query db2 on os/390.
> When I go directly from linux computer(installed with db2 connect PE)
> it works, but when I route it thru the DB2 Connect EE on a windows
> server, it gives me segmentation fault.
> How ever if I do db2 connect to db2 OS/390 via the db2 connect EE it
> works. Just the perl DBD:DB2 application gives segmentaion fault.
> Any ideas...
>
> Thanks




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

Date: Thu, 13 Feb 2003 22:59:20 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: DB2 Connect and DBD::DB2
Message-Id: <3E4C6998.54F10171@earthlink.net>

Aakash Bordia wrote:
> 
> Trying to understand your problem, What exactly is DBD:DB2?
[snip]

It's a module that needs to be installed in order for perl's DBI module
to be able to access a DB2 database.

And before you ask what DBI, it's the Database Independent Interface
that perl uses for accessing relational databases.

There exist a whole slew of DBD:: modules for the numerous databases
which people use.  See the results of:

   http://search.cpan.org/search?mode=module&query=DBD::

-- 
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
 landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"


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

Date: Thu, 13 Feb 2003 23:05:59 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: error in comparing user supplied data to database
Message-Id: <3e4c2195.17490772@news.erols.com>

"matt" <urzaserra@home.com> wrote:

: This is part of an email list signup script I purchased directly from the
: author who also installed it onto my host's server. Since he installed it
: and has been paid, he no longer responds to my emails to him about a defect
: I found in the script. 

That sucks.  Care to name the rogue?

The program sucks too.  Only one stinky comment in the whole thing,
and it tells nothing useful.  Did you get any kind of documentation
with it?

: The problem is that although the script works, no
: more than one person should be able to signup using a particular "USERID"
: but unfortunately any numbers of people can signup using the same "USERID".
: Per line 36, there is this statement:
: 
: if ($d_userid ne "") { $message .= "The 'User ID' you have chosen is already
: on our database.<br>\n"; $found_err++; }

Where does $d_userid ever get a value?  It's nowhere else in the code
shown.  Perhaps it's in one of the require()d files.  What sort of
code is in "user-lst.inc" ?

: The script you see here is the complete signup.cgi script.

[snip]

In future, please don't post entire files here.  If it's necessary to
share that much code, put it in a text file on your site, then post a
link to that.

Extra benefit there, a text file can be removed from public view more
easily than a Usenet article, should the author ever come after you
for giving away his crummy program.  Was there any license agreement
on it?

Maybe the author will start replying to email when he sees his
precioussss code held up for peer review.



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

Date: Thu, 13 Feb 2003 23:16:23 GMT
From: "matt" <urzaserra@home.com>
Subject: Re: error in comparing user supplied data to database
Message-Id: <bHV2a.1137$QU2.68008@news2.west.cox.net>


"Jay Tilton" <tiltonj@erols.com> wrote in message
news:3e4c2195.17490772@news.erols.com...
> "matt" <urzaserra@home.com> wrote:
>
> : This is part of an email list signup script I purchased directly from
the
> : author who also installed it onto my host's server. Since he installed
it
> : and has been paid, he no longer responds to my emails to him about a
defect
> : I found in the script.
>
> That sucks.  Care to name the rogue?
>
> The program sucks too.  Only one stinky comment in the whole thing,
> and it tells nothing useful.  Did you get any kind of documentation
> with it?

Not really.

>
> : The problem is that although the script works, no
> : more than one person should be able to signup using a particular
"USERID"
> : but unfortunately any numbers of people can signup using the same
"USERID".
> : Per line 36, there is this statement:
> :
> : if ($d_userid ne "") { $message .= "The 'User ID' you have chosen is
already
> : on our database.<br>\n"; $found_err++; }
>
> Where does $d_userid ever get a value?  It's nowhere else in the code
> shown.  Perhaps it's in one of the require()d files.  What sort of
> code is in "user-lst.inc" ?

The d_userid, I assume, is the userid lists in the database or is supposed
to be.

Compare with the other email verification blocks

>
> : The script you see here is the complete signup.cgi script.
>
> [snip]
>
> In future, please don't post entire files here.  If it's necessary to
> share that much code, put it in a text file on your site, then post a
> link to that.
>
> Extra benefit there, a text file can be removed from public view more
> easily than a Usenet article, should the author ever come after you
> for giving away his crummy program.  Was there any license agreement
> on it?
>
> Maybe the author will start replying to email when he sees his
> precioussss code held up for peer review.
>




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

Date: Thu, 13 Feb 2003 23:25:34 GMT
From: "matt" <urzaserra@home.com>
Subject: Re: error in comparing user supplied data to database
Message-Id: <OPV2a.1139$QU2.69881@news2.west.cox.net>


"matt" <urzaserra@home.com> wrote in message
news:bHV2a.1137$QU2.68008@news2.west.cox.net...
>
> "Jay Tilton" <tiltonj@erols.com> wrote in message
> news:3e4c2195.17490772@news.erols.com...
> > "matt" <urzaserra@home.com> wrote:
> >
> > : This is part of an email list signup script I purchased directly from
> the
> > : author who also installed it onto my host's server. Since he installed
> it
> > : and has been paid, he no longer responds to my emails to him about a
> defect
> > : I found in the script.
> >
> > That sucks.  Care to name the rogue?
> >
> > The program sucks too.  Only one stinky comment in the whole thing,
> > and it tells nothing useful.  Did you get any kind of documentation
> > with it?
>
> Not really.
>
> >
> > : The problem is that although the script works, no
> > : more than one person should be able to signup using a particular
> "USERID"
> > : but unfortunately any numbers of people can signup using the same
> "USERID".
> > : Per line 36, there is this statement:
> > :
> > : if ($d_userid ne "") { $message .= "The 'User ID' you have chosen is
> already
> > : on our database.<br>\n"; $found_err++; }
> >
> > Where does $d_userid ever get a value?  It's nowhere else in the code
> > shown.  Perhaps it's in one of the require()d files.  What sort of
> > code is in "user-lst.inc" ?

User-1st is just  some paths that are already at the top of the script

>
> The d_userid, I assume, is the userid lists in the database or is supposed
> to be.
>
> Compare with the other email verification blocks
>
> >
> > : The script you see here is the complete signup.cgi script.
> >
> > [snip]
> >
> > In future, please don't post entire files here.  If it's necessary to
> > share that much code, put it in a text file on your site, then post a
> > link to that.
> >
> > Extra benefit there, a text file can be removed from public view more
> > easily than a Usenet article, should the author ever come after you
> > for giving away his crummy program.  Was there any license agreement
> > on it?
> >
> > Maybe the author will start replying to email when he sees his
> > precioussss code held up for peer review.
> >
>
>




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

Date: Fri, 14 Feb 2003 02:02:03 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: error in comparing user supplied data to database
Message-Id: <3e4c2d6c.20522859@news.erols.com>

[Please trim reply-quoted material to the minimum necessary to
establish context.]

"matt" <urzaserra@home.com> wrote:

: > > Did you get any kind of documentation with it?
: >
: > Not really.

That's bad.  Very bad.

How did you decide that this program was worth spending money to have?

: > > : if ($d_userid ne "") { $message .= "The 'User ID' you have chosen is
: > already
: > > : on our database.<br>\n"; $found_err++; }
: > >
: > > Where does $d_userid ever get a value?  It's nowhere else in the code
: > > shown.  Perhaps it's in one of the require()d files.  What sort of
: > > code is in "user-lst.inc" ?
: 
: User-1st is just  some paths that are already at the top of the script

So you just stopped there.

Come on, now.  Look at the bigger question.

<bigger_question>
Where is a value assigned to $d_userid ?
</bigger question>

What's going on in the other require()d files?
AffPayOut.pm ?  
html_head.inc ?
html_foot.inc ?
If those files require() even more files, what's in them?

: > The d_userid, I assume, is the userid lists in the database or is supposed
: > to be.

Well duh.

But where does it get a value?

: > Compare with the other email verification blocks

Don't care about those.  The hangup is with the 
if($d_userid ne ""){...} part.  If that block never executes, then
$d_userid is an empty string when it should not be, so debugging
begins where $d_userid gets its value.

This is pointless.  You're going to need to learn some Perl to
competently assist with debugging.



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

Date: Fri, 14 Feb 2003 00:06:25 +0100
From: "Frank Maas" <spamfilter@cheiron-it.nl>
Subject: Re: How to report progress on command line
Message-Id: <3e4c24f3$0$135$e4fe514c@dreader5.news.xs4all.nl>


"Seth Brundle" <brundlefly76@hotmail.com> schreef in bericht
news:53e2ec95.0302131208.5bcb8c10@posting.google.com...
> Let's say you want to process a file with many lines, and its takes a
> while and you would like to report status in realtime ala:
>
> bash> Processing line #2,345,999...
>
> Where this line is constantly updated on the same line of the display
> without creating a newline - i.e. it appears as if only the number
> itself is changing. Hope this makes sense...
>
> How would one go about this?

You could try Term::ProgressBar (see CPAN)

--Frank




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

Date: 13 Feb 2003 17:17:46 -0800
From: brundlefly76@hotmail.com (Seth Brundle)
Subject: Launch two programs simultaneously and continue when finished?
Message-Id: <53e2ec95.0302131717.6f5099b7@posting.google.com>

In the middle of a Perl script, I would like to execute two external
programs running simultaneously ( i.e. both programs will run
simultaneously) which will take about 20 minutes to finish each, and
then continue the rest of my script when they are both finished.

Anyone got a pointer on how to do this?


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

Date: Fri, 14 Feb 2003 02:03:45 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: Launch two programs simultaneously and continue when finished?
Message-Id: <58Y2a.342$6i5.140839966@newssvr13.news.prodigy.com>

Seth Brundle <brundlefly76@hotmail.com> wrote:
> In the middle of a Perl script, I would like to execute two external
> programs running simultaneously ( i.e. both programs will run
> simultaneously) which will take about 20 minutes to finish each, and
> then continue the rest of my script when they are both finished.

> Anyone got a pointer on how to do this?

fork(), exec(), and wait().

# Run multiple background processes.

my @processes = ("process one", "process two");
foreach (@processes) {
  unless (fork) {
    # running as child process
    exec $_;
    die "Exec of $_ failed!";  # shouldn't happen
  }
  # only parent runs here
}

# wait for all launched processes to exit.
foreach (@processes) {
  wait();
}

# all children have exited

You can easily add some more logic to record the PIDs of the children, 
perhaps report when a particular child has returned, mention the exit
status of the child...
 
-- 
Darren Dunham                                           ddunham@taos.com
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >


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

Date: 13 Feb 2003 19:12:02 -0800
From: chrisko33@hotmail.com (Chris Koenig)
Subject: Must escape characters for SSI 'include' emulator!
Message-Id: <afcc5932.0302131912.7776f588@posting.google.com>

Hi all,
   This is something I got from pScripts
(http://pscripts.psyon.org/psinclude/index.shtml) to emulate server
side includes and 'paste' some HTML text into another HTML file. I got
the Savant web server (open source at
http://savant.sourceforge.net/index.html), which has really been great
so far except it doesn't support SSI as of v3.1. So instead I have to
use a CGI with this Perl code. The problem is that I get an error in
the resulting HTML document about expecting a close bracket, so
obviously there is a problem when it encounters an apostrophe in the
template file.
   So here's my question: how would I use Perl to escape all the
characters that need it? I've looked at URI::Escape and a few other
things, and my best bet so far is CGI::escapeHTML. But alas! I haven't
yet taken the time to learn Perl, so I've got no clue how to implement
it or anything else.
   Here's the code:

#!"C:\Perl\bin\perl"
##################################
# psInclude.cgi            v1.41 #
# http://pscripts.psyon.org      #
# Copyright pScripts!  2000-2004 #
##################################

# Set this to the path where templates will be stored
$PATH  = "C:/Savant/Root";

###############################
# Script                      #
# Do not edit below this line #
###############################
@pairs = split(/&/, $ENV{'QUERY_STRING'});
foreach $pair (@pairs)
{
  ($name, $value) = split(/=/, $pair);
  $value =~ tr/+/ /;
  $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
  $value =~ s/~!/ ~!/g;
  $FORM{$name} = $value;
}
$FORM{'template'} =~ s/\.\.//g;

print "Content-Type: application/x-javascript\n\n";
$file = "$PATH/$FORM{'template'}";
open(TEMPLATE, "$file") || &err("Could not open $FORM{'template'}");
foreach(<TEMPLATE>) {
  chomp($_);
  $_ =~ s/#%(.*?)%#/$FORM{$1}/gise;
  $_ =~ s/(['"])/\\$1/g;
  $_ =~ s/[\n\r]/ /gise;
  print "document.write(\'$_\');\n"; ### [Looks like it'd have to be
around here]
}
&PrintEnd;
close(TEMPLATE);
exit;

sub err {
  $msg = shift;
  print "document.write(\'[Error processing directive: $msg]\');\n";
  &PrintEnd;
  exit;
}

sub PrintEnd {
  print "/*\n";
  print "<!--#echo banner=\"\"-->\n";
  print "*/\n";
}

	Thanks for any help!
                              - Chris K.


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

Date: 14 Feb 2003 04:00:42 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: Re: Must escape characters for SSI 'include' emulator!
Message-Id: <b2hpla$17g@dispatch.concentric.net>


"Chris Koenig" <chrisko33@hotmail.com> wrote in message
news:afcc5932.0302131912.7776f588@posting.google.com...
> Hi all,
>    So here's my question: how would I use Perl to escape all the
> characters that need it? I've looked at URI::Escape and a few other
> things, and my best bet so far is CGI::escapeHTML.

At this point I would normally say:  Have you tried 'perldoc HTML::Entities'
?  But continuing to read ...

> But alas! I haven't
> yet taken the time to learn Perl, so I've got no clue how to implement
> it or anything else.

If you haven't taken the time to learn Perl, this is not the appropriate
forum to pose this question.

>    Here's the code:
>
> #!"C:\Perl\bin\perl"
> ##################################
> # psInclude.cgi            v1.41 #
> # http://pscripts.psyon.org      #
> # Copyright pScripts!  2000-2004 #
> ##################################

I'd be suspicious of any script copyrighted one year in the future.





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

Date: Thu, 13 Feb 2003 20:38:53 -0500
From: istink <istink@real.bad.com>
Subject: nested file handlers
Message-Id: <3E4C48AD.75A4F57C@real.bad.com>

This my works:

# start ##############################
$x="orig";
&mysub;

sub mysub {
  my($x)="private";
}
# end ##############################



how can I do this:
pseudo code
# start ##############################
open (READ, "file.txt");
 ...
&mysub;
close (READ);

sub mysub{
  open (READ, "i_should_be_private.txt");
 ....
  close (READ);
# end ##############################
how can I make READ local and private ?


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

Date: Fri, 14 Feb 2003 04:03:56 GMT
From: "Jodyman" <Jodyman@hotmail.com>
Subject: Re: newbie date comparison
Message-Id: <MUZ2a.573$_c6.40456@newsread2.prod.itd.earthlink.net>


"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:b2fl4p$n6o$1@mamenchi.zrz.TU-Berlin.DE...
> Tintin <me@privacy.net> wrote in comp.lang.perl.misc:
> >
> > "Jodyman" <Jodyman@hotmail.com> wrote in message
> > news:vrB2a.13647$tO2.1288826@newsread1.prod.itd.earthlink.net...
> > > "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
>
> > > > or do all three in one go:
> > > >
> > > >     $_ = sprintf "%02d", $_ for $new_month, $new_day, $new_year;
> > >        ^^^^                        ^^^^^^
> > > Anno, can you explain what his is doing and how it works?  Didn't find
> > > the answer in perldoc -f sprintf.
> >
> > It's a different way to write
> >
> > $_ = sprintf "%02d%02d%02d", $new_month, $new_day, $new_year;
>
> No, that's not what it does.  $_ is unchanged after the loop, but the
> variables $new_month, $new_day and $new_year now contain the formatted
> date.  It uses the fact that in a for-loop $_ is an alias to the
> current list element, so assigning to $_ really assigns to $new_month,
> etc.

Anno,

        That's pretty cool.  Where can I read more about this little trick?
I thought
first to look at $_ and noticed there wasn't anything in it... but... as you
stated
all the other variables contained the 0 (zero) justified numbers as
required.  I don't
recall seeing or reading about this in the camel or any other book for that
matter.

TIA

Jody




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

Date: Fri, 14 Feb 2003 05:01:46 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: newbie date comparison
Message-Id: <3E4C77A8.6020806@rochester.rr.com>

Jodyman wrote:

 ...
>         That's pretty cool.  Where can I read more about this little trick?
 ...

> Jody
 ...


Check out:


    perldoc perlsyn

particularly the section on "foreach loops".


-- 
Bob Walton



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

Date: Fri, 14 Feb 2003 00:31:22 -0000
From: gort@LinxNet.com (Jim Seymour)
Subject: Re: Perl+Tk+MySQL for Win32 that *works*?
Message-Id: <v4oe6qmi8l9la3@corp.supernews.com>

In article <slrnb4nsot.qpm.randy@theoryx5.uwinnipeg.ca>,
	randy@theoryx5.uwinnipeg.ca (Randy Kobes) writes:
[snip]
>                                                          ... I've 
> now added such a script to our DBD-mysql package that will offer,
> if the user wants, to fetch and install libmySQL.dll.

Great!  Maybe I'll give it a try on a vict^H^H^H^Huser's machine
tomorrow at work.  Took today off, so might be too busy with other
things, but I'll try to fit it in.

> 
> Thanks for persisting in this -

Thank *you* :).

>                                 hopefully this post-install
> script will help future users avoid the difficullties you
> had ...

I imagine it will.

Regards,
Jim
-- 
Jim Seymour                    | PGP Public Key available at:
WARNING: The "From:" address   | http://www.uk.pgp.net/pgpnet/pks-commands.html
is a spam trap.  DON'T USE IT! |
Use: jseymour@LinxNet.com      | http://jimsun.LinxNet.com


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

Date: Thu, 13 Feb 2003 20:28:23 -0500
From: istink <istink@real.bad.com>
Subject: Re: print <<HERE;
Message-Id: <3E4C4637.A663119A@real.bad.com>



Shane McDaniel wrote:
> 
> istink wrote:
 ...........
> >
> > I know it won't work literally.
> 
> According to the Camel Book 3rd ed pg 67   you need an = sign
> 
> $foo = <<HERE
> etc...
> 
> -shane
sorry, still on the llllllama book


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

Date: Thu, 13 Feb 2003 23:32:08 GMT
From: shb*NO*SPAM*@comporium.net (Si Ballenger)
Subject: Re: Raw Access to the Parallelport
Message-Id: <3e4c2824.354793776@news.comporium.net>

On 13 Feb 2003 03:22:28 -0800, lvu00sjg@rdg.ac.uk (theartist)
wrote:

>Arno
>I have just posted a follow up to my recent posting regarding this
>subject.
>It is at http://groups.google.com/groups?q=parallelport+group:comp.lang.perl.*&hl=en&lr=&ie=UTF-8&selm=ec1ad04e.0301280115.707ac4ac%40posting.google.com&rnum=1
>In case this link doesn't work the title of the post is -
>'Device::ParallelPort Problem - Win98' posted on 28th jan 2003
>Steve

If you want to settle for a workaround, I've got a page below
that has some info on controlling the parallel port pins with
batch files. You would have to have perl run the batch file.
NT/2K/XP won't allow direct access to hardware, so you would need
to run something like UserPort to get access. If you have win98
you should be good to go. When you double click on the below
batch file, it should set parallel port pin #2 high (+5V) on LPT1
(378).

http://www.geocities.com/zoomkat/ppswitcher.htm

===copy below into notepad and save it as pin2.bat===

GOTO BEGIN
o 378 01
G
:BEGIN
DEBUG < pin2.bat



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

Date: Fri, 14 Feb 2003 04:03:49 GMT
From: "Jodyman" <Jodyman@hotmail.com>
Subject: Re: stripping part of a string
Message-Id: <FUZ2a.572$_c6.40456@newsread2.prod.itd.earthlink.net>


"Ryan" <scheller@student.umass.edu>
> I'm sure this is an easy task, but I jsut seem to be stuck on it.
> Here's the problem:
> I have a string in a "format" such as this, where there will always be
> a " - " seperating the two parts, if you will.
>
> $name = "My Cat - Brown Dog.txt";
>
> Now what I'd like to have is:
> $name = "My Cat";
>
> I'd like to be able to delete everything in the string after and
> including the " - ".  That's "Space-Space".  I've been looking at
> using s///, but it jsut doesn't seem to come out right.  Can anyone
> help!!  Is there a beter operation to use?  Thanks so much,

Here's another way to do it:

#!c:\perl\bin\perl

use strict;                                  # Use these so noone yells at
you! LOL!
use warnings;
use diagnostics;

while (<DATA>) {
 (my $name) = $_ =~ (m/^(.*) - /);
 print "\$_=$_\n";
 print "\$name=$name\n";
}

__DATA__
My Cat - Brown Dog.txt
My Car - Blue Horse.txt
My Wife - Red Mistress.txt
My Friend - Yellow Enemy.txt
My Paper - Green Portal.txt
My Best Friend - Purple Idiot.txt
My - Teal You.txt

# Hope that helps
# Jody




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

Date: Fri, 14 Feb 2003 02:19:01 +0000 (UTC)
From: Cristian Gutierrez <crgutierNO@SPAMdcc.uchile.cl>
Subject: Re: Using a variable to create a slice
Message-Id: <b2hjml$et9$2@helcaraxe.dcc.uchile.cl>

Terry Bolands posteo' asi':
> Hi,

> I want to do something like this:

>   @array[1,2,3] = (stuff);

> with a variable like this:

>   $v = "1,2,3";
>   @array[$v] = (stuff);

> but it doesn't work.  Can anyone give me a hint?

Try:

$array[$_] = (stuff) foreach split(",",$v) ;

May be you'll need to index the (stuff) stuff with $_ as well.

-- 
Cristian Gutierrez                                 Linux user #298162
crgutier[@]dcc.uchile.cl           http://www.dcc.uchile.cl/~crgutier

Programming is like sex: One mistake and you have to support it for the 
rest of your life.


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 4566
***************************************


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