[22610] in Perl-Users-Digest
Perl-Users Digest, Issue: 4831 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 11 09:06:11 2003
Date: Fri, 11 Apr 2003 06:05:11 -0700 (PDT)
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, 11 Apr 2003 Volume: 10 Number: 4831
Today's topics:
Re: Allowing User to delete image files via HTML page i (Helgi Briem)
Re: Allowing User to delete image files via HTML page i <simon.andrews@bbsrc.ac.uk>
Re: compare elements of n lists (banjo)
Re: Convert curses screen output to space-delimited tex <dickey@saltmine.radix.net>
Re: extract the first word in a string (Tad McClellan)
Re: extract the first word in a string (Tad McClellan)
Re: hashes as lists (Tad McClellan)
Re: hashes as lists (Sara)
Help with script to parse a log file and run a command. (MichaelS)
Re: Help with Win32::Process <novastar@dtdns.net.nospam>
Re: How to standardize variable output length (Tad McClellan)
My 1st japh!! <bik.mido@tiscalinet.it>
Re: My 1st japh!! <bik.mido@tiscalinet.it>
Re: My 1st japh!! <kasp@epatra.com>
Re: My 1st japh!! (Anno Siegel)
Re: My 1st japh!! <tassilo.parseval@rwth-aachen.de>
Re: no backtick output on client-side perlscript under <me@privacy.net>
Re: Perl and large text files <george@object1.com>
Re: Perl command line and backticks (Anno Siegel)
Re: Perl command line and backticks (Anno Siegel)
Re: Perl DBD::DB2 and security? (Johann Sander)
Re: Questions about Perl's Unicode Model <flavell@mail.cern.ch>
Re: Sending Mail with HTML links news@roaima.freeserve.co.uk
Re: Session variables in PERL CGI programming <simon.oliver@nospam.umist.ac.uk>
Re: Session variables in PERL CGI programming <matthew@weierophinney.net>
simple script question <grobitaille@mail.com>
Re: simple script question <abigail@abigail.nl>
Re: simple script question <news@kverulant.net>
tab (rsegovia)
Re: tab <ian@WINDOZEdigiserv.net>
Re: tab (Anno Siegel)
Re: tab (Helgi Briem)
Re: tab (Tad McClellan)
Re: tab <ian@WINDOZEdigiserv.net>
Re: Weird behavior of PERL counter <D'oh@a.deer>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 11 Apr 2003 10:03:16 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Allowing User to delete image files via HTML page in flat text database
Message-Id: <3e9691e3.68666286@news.cis.dfn.de>
On Fri, 11 Apr 2003 02:33:18 -0400, "George"
<georgeconklin@NO.SpaM.re.move.this.ALL.comcast.net> wrote:
>Thanks very much, I will try it out. I just realized the server is a Windows
>NT or Windows2000 server and came back to post that -fast response, Jay!
>
>Will unlink() work on the Windows web servers?
>
>Something like this?
>
>the_file = (filename passed from form)
>unlink(the_file)
Yes, given the appropriate permissions.
Note two things:
The web server runs as a special user with restricted
privileges. Often called nobody or httpd on apache
web servers, IUSR_machinename on IIS servers
and so on.
Allowing anonymous users to delete files on
your web servers is a *very* hazardous thing.
Take extra, extra care that you can't enter
C: or *.* or ..\..\..\* into the file field and
have your program delete files there.
--
Regards, Helgi Briem
helgi DOT briem AT decode DOT is
------------------------------
Date: Fri, 11 Apr 2003 09:09:23 +0100
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: Allowing User to delete image files via HTML page in flat text database
Message-Id: <3E967833.5050201@bbsrc.ac.uk>
George wrote:
> Jay,
>
> Thanks very much, I will try it out. I just realized the server is a Windows
> NT or Windows2000 server and came back to post that -fast response, Jay!
>
> Will unlink() work on the Windows web servers?
Unlink works the same on any platform Perl works on.
> Something like this?
>
> the_file = (filename passed from form)
> unlink(the_file)
Well only in the loosest sense since that isn't Perl. Something like
this should work (read the caveat at the end!):
#!c:/perl/bin/perl.exe -wT
use strict;
use CGI;
my $query = CGI->new();
my $filename = $query->param('filename');
# Do some sanity / untaint checks on $filename
chdir ('C:/images') or die "Can't move to images dir: $!";
unlink ($filename) or die "Can't delete $filename: $!";
## WARNING ##
Code like this can open big security holes in your machine. Unles you
very carefully control what values are allowed for $filename you create
a mechanism for someone to delete any file on your machine from a web
form. Remember that it is a trivial task to pass pretty much any value
you like to a CGI script (eg '../WinNT/command.com' for filename), and
it is up to the script itself to determine whether to accept the values
passed to it. You can't rely on the client (browser) to only pass what
you expect.
Read perldoc perlsec for more info about this.
Simon.
------------------------------
Date: 11 Apr 2003 05:35:49 -0700
From: c_sheehanuk@hotmail.com (banjo)
Subject: Re: compare elements of n lists
Message-Id: <59387f51.0304102300.59e04a33@posting.google.com>
ok, I meant an array of array references.
>
> What do you mean by "compare?" Are you looking for the intersection
> of two lists? The difference of two lists?
Compare, I just need to evaluate whether element @list[0] eq @list1[0]
and so on. Based on the evaluation the elements of @list1 need shifted
as below(I think).
>
> The information in perlfaq4, "How do I compute the difference of two
> arrays? How do I compute the intersection of two arrays?" may be
> useful.
thanks I will look into it.
>
> : The result of the compare and list sorting
> : needs to be:
> :
> : list1 = a b c d e f g h i j k l
> : list2 = b g h k p
> : list3 = c d g x y z
>
> Not sure how to interpret that. Whitespace may or may not be
> significant to your meaning. Try writing it in real Perl, e.g.
>
> @list1 = ('a','b','c','d','e','f','g','h','i','j','k','l');
> @list2 = ( ... );
> @list3 = ( ... );
It would be best if I had the nul string
@list1 = ('a','b','c','d','e','f','g','h','i','j','k','l');
@list2 = ('','b','','','','','g','h','','','k','','p');
@list3 = ('','','c','d','','','g','','','','','','' ,'x','y','z');
>
> Perhaps this approximates what you want:
>
> #!perl -l
> use warnings;
> use strict;
> my @foo = (
> [qw/a b c d e f g h i j k l/],
> [qw/b g h k p/],
> [qw/c d g x y z/],
> );
> my %seen;
> for my $c ( 0 .. $#foo ) {
> $seen{$_} |= 1<<$c for @{$foo[$c]};
> }
> my @bar;
> for my $c ( 0 .. $#foo ) {
> $bar[$c] = [
> map $seen{$_} & 1<<$c ? $_ : ' ', sort keys %seen
> ];
> }
> print "@$_" for @bar;
thanks, I will try that
------------------------------
Date: 11 Apr 2003 10:47:57 GMT
From: Thomas Dickey <dickey@saltmine.radix.net>
Subject: Re: Convert curses screen output to space-delimited text output ?
Message-Id: <b766gt$mfo$1@news1.radix.net>
Sean O'Neill <sean@deletethistorespond.seanoneill.deletethistorespond.info> wrote:
> Does anyone know of a modules or combo of modules that will take
> curses screen output and convert it to space-delimited text output ?
> Basically, this:
> ^[[1;40r^[[m^[[?7h^[[H^[[J^[[6Cusers Load^M^[[2BMem:KB
> REAL^[[3;27HVIRTUAL^[[21CVN PAGER SWAP PAGER^[[4;9HTot
> Share^[[6CTot Share Free^[[9Cin out in
> out^M^[[BAct^[[43Ccount^M^[[BAll^[[43Cpages^[[7;59Hzfod
> Interrupts^M^[[BProc:r p d s w Csw Trp Sys Int Sof
> Flt^[[8Ccow^[[9Ctotal^[[9;59Hwire^[[B^H^H^H^Hact^M^[[B . %Sys .
> %Intr . %User . %Nice . %Idle^[[9Cinact^M^[[B| | | |
> | | | | | | |^[[7Ccache^[[13;59H
> to this:
you'd need something like a terminal emulator. If you limit it to the
20-or-so escape sequences that are used, it's just a big case statement
matching patterns in perl. Note that ^[[J is the erase-display, which
is a good starting point for a new page in the resulting output.
> users Load 0.11 0.20 0.24 Apr 10 16:19
> Mem:KB REAL VIRTUAL VN PAGER SWAP
> PAGER
> Tot Share Tot Share Free in out in
> out
> Act 46432 13140 186304 104904 14180 count
> Any thoughts or ideas appreciated :)
--
Thomas E. Dickey <dickey@radix.net> <dickey@herndon4.his.com>
http://dickey.his.com
ftp://dickey.his.com
------------------------------
Date: Fri, 11 Apr 2003 07:43:56 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: extract the first word in a string
Message-Id: <slrnb9de4c.5er.tadmc@magna.augustmail.com>
Raj Thejaswi <thejaswi@hotmail.com> wrote:
> Can someone help me figure out how I can get "Boston","New York","San
> Francisco"
> into a variable ?
>
> I am chopping of "Settled Date" and "Sale" from the string using
> substr() with index(), since these two strings are constant.
If you notice that the _length_ of the unwanted prefix and suffix
is constant, then you can use substr() to solve the problem.
----------------------------
#!/usr/bin/perl
use strict;
use warnings;
while ( <DATA> ) {
chomp;
substr($_, 0, 21) = '';
substr($_, -4) = '';
print "$_\n";
}
__DATA__
Settled Date:04/30/02BostonSale
Settled Date:04/30/02New YorkSale
Settled Date:04/30/02San FranciscoSale
----------------------------
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 11 Apr 2003 08:28:06 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: extract the first word in a string
Message-Id: <slrnb9dgn6.5j1.tadmc@magna.augustmail.com>
Tad McClellan <tadmc@augustmail.com> wrote:
> Raj Thejaswi <thejaswi@hotmail.com> wrote:
>
>> Can someone help me figure out how I can get "Boston","New York","San
>> Francisco"
>> into a variable ?
>>
>> I am chopping of "Settled Date" and "Sale" from the string using
>> substr() with index(), since these two strings are constant.
>
>
> If you notice that the _length_ of the unwanted prefix and suffix
> is constant, then you can use substr() to solve the problem.
>
> ----------------------------
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> while ( <DATA> ) {
> chomp;
> substr($_, 0, 21) = '';
> substr($_, -4) = '';
> print "$_\n";
> }
>
> __DATA__
> Settled Date:04/30/02BostonSale
> Settled Date:04/30/02New YorkSale
> Settled Date:04/30/02San FranciscoSale
> ----------------------------
Or, probably better, just snatch the part you want with a single substr():
my $city = substr($_, 21, -4);
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 11 Apr 2003 07:49:03 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: hashes as lists
Message-Id: <slrnb9dedv.5er.tadmc@magna.augustmail.com>
Sara <genericax@hotmail.com> wrote:
> %h = reverse %h
>
> makes the keys of %h the values and visa versa..
Better not do that if there are duplicated values in %h though.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 11 Apr 2003 05:48:52 -0700
From: genericax@hotmail.com (Sara)
Subject: Re: hashes as lists
Message-Id: <776e0325.0304110416.7952a03b@posting.google.com>
Eric Wilhelm <ericw@nospam.ku.edu> wrote in message news:<pan.2003.04.10.20.15.56.343013.23897@nospam.ku.edu>...
> On Thu, 10 Apr 2003 13:20:19 -0500, Sara wrote:
>
> > Eric Wilhelm <ericw@nospam.ku.edu> wrote in message
> > news:<pan.2003.04.10.07.52.06.315922.23897@nospam.ku.edu>...
> >> Perl never ceases to amaze me.
> >>
> >> %a = (%b, %c);
> > Along the same lines, something I picked up in like my 5th re-read of
> > Camel:
> >
> > %h = reverse %h
> >
> > makes the keys of %h the values and visa versa..
> Ah, yes. Page 776. I have not finished the first read (after using it
> for about 10 months, but I hang out in the Index a LOT (just noticed the
> hashes...inverting entry while trying to find this trick).
>
> Note to Larry: Kudos for the index.
>
> --Eric
Hey Eric-
My experience with Llama was pretty one one read, practicing as I went
along, and then I was done. But Camel- heck as you probably see there
is just too much there for LR parsing! I've been through some sections
probably dozens of times- others a few times.. And like a great movie
(like Spinal Tap for instance) no matter HOW MANNY times you see the
material, seems there is always something new.
Probably I'm just a slow learner :)
Cheers,
-Gx
------------------------------
Date: 11 Apr 2003 05:49:41 -0700
From: spivackm@calib.com (MichaelS)
Subject: Help with script to parse a log file and run a command.
Message-Id: <c5144b08.0304110420.420b9929@posting.google.com>
Hi All,
I am trying to write a shell script to parse through a mysql error log
and if it find's a specific error, one to do with replication, that it
will run a command to shutdown the current mysql server. I was
originally trying to do it with bash and borne shell. Unfortunately,
matching regular expressions with bash, especially when there are
spaces, doesn't work very nice.
Could someone point me to some pointers or examples of how to do this
in perl.
Essentially, it will parse through the error log file looking for
"error running query". If it see's that error, it will run the
shutdown command for mysql in init.d. It will also move the error log
file to a backup location and touch a new one. If it doesn't see the
error, the script will simply exit.
Thanks in advance for your help,
Michael
------------------------------
Date: Fri, 11 Apr 2003 10:59:52 +0300
From: "George Bouras" <novastar@dtdns.net.nospam>
Subject: Re: Help with Win32::Process
Message-Id: <1050047940.539001@athprx02>
Yes it create a suspended process but of cource the process does not do any
thing ( of course ... ) Thanks anyway.
------------------------------
Date: Fri, 11 Apr 2003 07:44:57 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: How to standardize variable output length
Message-Id: <slrnb9de69.5er.tadmc@magna.augustmail.com>
welchad <root@hines.welch.com> wrote:
^^^^
^^^^
If you are reading news as the superuser, then you are not
ready to have the root password yet.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 11 Apr 2003 09:28:29 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: My 1st japh!!
Message-Id: <rflc9vs17lac2f37e19jssfi69quh7l6i7@4ax.com>
Sorry, I've been away lately: too busy to read news... but yesterday,
without having planned it, I wrote my 1st (and only?) japh. OK, it has
nothing to do with the incredible things you see around, but for my
limited skills, IMHO it's not so bad after all: any comments?
Michele
$\=q.,.,$\.=$/,print qq,\112,,(qw,a c e h,,map{$_-=1<<5if/112/;chr}107..
117,32)[map {s/^/0/;hex} split//,join q,2B,,qw$ECDF078D3 F9 5F3014$,$,];
------------------------------
Date: Fri, 11 Apr 2003 09:47:27 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: My 1st japh!!
Message-Id: <6nsc9v44p4bm96r723b9hng7ekqh78s93f@4ax.com>
On Fri, 11 Apr 2003 09:28:29 +0200, Michele Dondi
<bik.mido@tiscalinet.it> wrote:
Sorry, I forgot the .sig separator!
Michele
--
$\=q.,.,$\.=$/,print qq,\112,,(qw,a c e h,,map{$_-=1<<5if/112/;chr}107..
117,32)[map {s/^/0/;hex} split//,join q,2B,,qw$ECDF078D3 F9 5F3014$,$,];
------------------------------
Date: Fri, 11 Apr 2003 13:19:46 +0530
From: "Kasp" <kasp@epatra.com>
Subject: Re: My 1st japh!!
Message-Id: <b75s30$6f3$1@newsreader.mailgate.org>
It will be more appealing if you can get me rid of this error msg that I get
when I ran your code.
ERROR -- "Use of uninitialized value at japh.pl line 1."
------------------------------
Date: 11 Apr 2003 08:25:19 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: My 1st japh!!
Message-Id: <b75u5f$mf7$1@mamenchi.zrz.TU-Berlin.DE>
Kasp <kasp@epatra.com> wrote in comp.lang.perl.misc:
> It will be more appealing if you can get me rid of this error msg that I get
> when I ran your code.
> ERROR -- "Use of uninitialized value at japh.pl line 1."
Hmmm? What are you talking about?
Anno
------------------------------
Date: 11 Apr 2003 08:28:10 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: My 1st japh!!
Message-Id: <b75uaq$i75$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Kasp:
> It will be more appealing if you can get me rid of this error msg that I get
^^^
Who is that?
> when I ran your code.
^^^^^^^^^
Whose and which code?
You should learn to quote properly.
> ERROR -- "Use of uninitialized value at japh.pl line 1."
That's a warning and no error. JAPHs are required to run cleanly under
strict nor warnings
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Fri, 11 Apr 2003 12:27:34 +0200
From: Norbert Schmidt <me@privacy.net>
Subject: Re: no backtick output on client-side perlscript under w2k
Message-Id: <1195n9j0qqd5s$.6owm6xia2p8m.dlg@40tude.net>
Hello Dave,
> I know, this is not a Perl question
well, IMHO it qualifies. ;-)
Sorry, I can't offer immediate help, just a few suggestions:
> (testing on v5.6.1 build 635 provided by ActiveState Corp)
Did you try AS-Perl 5.8?
> @x=`getmac`; # getmac = a simple exe, same results for `dir`
> in IE under W2k
Maybe it's a side effect of some internet security option in IE.
> Note that redirecting the command output (ie. `getmac >c:\\output.txt`)
> works fine.
You might try:
open XFILE, "getmac |";
@x = <XFILE>;
close XFILE;
And if that doesn't work either, bite the bullet and do something like:
`getmac >$tempfile`;
open XFILE, $tempfile;
@x = <XFILE>;
close XFILE;
Regards, Norbert
------------------------------
Date: Fri, 11 Apr 2003 12:03:11 +0100
From: "George Karpodinis" <george@object1.com>
Subject: Re: Perl and large text files
Message-Id: <b767nj$bat9o$1@ID-41471.news.dfncis.de>
This will not match if the pattern you are looking for is split in two
lines.
Jurgen is right that 5mb is not that much for a machine that is not toooo
old.
"Helgi Briem" <helgi@decode.is> wrote in message
news:3dc69981.1687781932@news.cis.dfn.de...
> On Mon, 4 Nov 2002 17:20:40 +0200, "JorkkiS"
> <jarkko.rantamaki@edu.stadia.no.spam.fi> wrote:
>
> >Hi!
> >
> >I'm supposed to write a sript that searches through a text file for a
given
> >string. The script it self will be very simple, but I was wondering will
I
> >run into problems, because the size of the text file is around 5
megabytes.
> >I was thinking of reading it into an array and then greping throug it...
> >will there be problems, other than it might take a while.
> >
> >Is there a better way to approach this?
>
> Yes.
>
> Something along these line (untested):
>
> #!perl
>
> use strict;
> use warnings;
> my $wanted = 'whatever';
>
> while (<>)
> {
> next unless /$wanted/;
> print;
> }
> __END__
> --
> Regards, Helgi Briem
> helgi AT decode DOT is
>
> A: Top posting
> Q: What is the most irritating thing on Usenet?
> - "Gordon" on apihna
------------------------------
Date: 11 Apr 2003 11:22:33 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl command line and backticks
Message-Id: <b768hp$4qb$1@mamenchi.zrz.TU-Berlin.DE>
Ben <newsgroup2.replies.benaltw@xoxy.net> wrote in comp.lang.perl.misc:
> Richard Gration wrote:
> > I have a script called get_cchange.pl, which looks like this:
> >
> > #!/usr/bin/perl
> > print "'print 23'";
> >
> > That's it. The output of this script is:
> >
> > 'print 23'
> >
> > Then I try to have this executed with
> >
> > perl -e `perl get_cchange.pl'
> >
> > The output from this is not what I expected:
> >
> > [root@richg ~]# perl -e `perl get_cchange.pl`
> > Can't find string terminator "'" anywhere before EOF at -e line 1.
> > [root@richg ~]#
>
> Try:
> eval perl -e `perl get_cchange.pl'
Or, alternatively:
perl get_cchange.pl | perl
Anno
------------------------------
Date: 11 Apr 2003 11:26:46 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl command line and backticks
Message-Id: <b768pm$4qb$2@mamenchi.zrz.TU-Berlin.DE>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote in comp.lang.perl.misc:
> Ben <newsgroup2.replies.benaltw@xoxy.net> wrote in comp.lang.perl.misc:
> > Richard Gration wrote:
> > > I have a script called get_cchange.pl, which looks like this:
> > >
> > > #!/usr/bin/perl
> > > print "'print 23'";
> > >
> > > That's it. The output of this script is:
> > >
> > > 'print 23'
> > >
> > > Then I try to have this executed with
> > >
> > > perl -e `perl get_cchange.pl'
> > >
> > > The output from this is not what I expected:
> > >
> > > [root@richg ~]# perl -e `perl get_cchange.pl`
> > > Can't find string terminator "'" anywhere before EOF at -e line 1.
> > > [root@richg ~]#
> >
> > Try:
> > eval perl -e `perl get_cchange.pl'
>
> Or, alternatively, leave the single quotes off of the output and do:
>
> perl get_cchange.pl | perl
>
> Anno
------------------------------
Date: 11 Apr 2003 05:31:46 -0700
From: jsander@puc-online.de (Johann Sander)
Subject: Re: Perl DBD::DB2 and security?
Message-Id: <ff2b8f88.0304110209.de0fdc7@posting.google.com>
Hi Hemant,
I don't think you absolutely need to pass on user and password from
perl. As a matter of fact, the DBI is quite comfortable with
DBI->connect("DBI:DB2:sample", "", "");
For this to work, you must tell the DB2 server to trust the
authorization that was performed on the web server. You should (though
never tried it myself) be able to achieve this by working the
authorization parameters in the dbm cfg (db2 get dbm cfg, search for
AUTH).
As you are concerned about the web server's security, this is probably
not what you want.
I don't think there is a way to keep intruders out of a database if
people are supposed to work with the database.
I would suggest sticking with the user/password thing from perl and
keeping authorized personnel away from the web server, and applying
tight database security (which can be a lot of work). Remember, you
can even revoke all table permissions from people and only grant them
package permissions. This way you keep account hijackers from issuing
dynamic sql against your tables. Unfortunately, you can't use DBI to
work with packages, I believe, because DBI is all about dynamic sql.
Johann
Hemant Shah <shah@typhoon.xnet.com> wrote in message news:<b5soai$of0$1@flood.xnet.com>...
> Folks,
>
> While accessing DB2 database from perl, I have to connect to the
> database using DBI->connect( "dbi:DB2:dbname", "user", "password");
>
> The password is in plain ASCII text. Any one who can read the perl
> script will be able to know the password of the user. I am concerned,
> because the perl script will be running on the web server and access
> the database on remote Linux system. If someone breaks into the web server
> he/she can get the username and password from the perl script and try to
> access/update the database.
>
> Is there another way to connect to the database without using password
> in plain text?
>
> Thanks.
>
> --
> Hemant Shah /"\ ASCII ribbon campaign
> E-mail: NoJunkMailshah@xnet.com \ / ---------------------
> X against HTML mail
> TO REPLY, REMOVE NoJunkMail / \ and postings
> FROM MY E-MAIL ADDRESS.
> -----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
> I haven't lost my mind, Above opinions are mine only.
> it's backed up on tape somewhere. Others can have their own.
------------------------------
Date: Fri, 11 Apr 2003 12:04:37 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Questions about Perl's Unicode Model
Message-Id: <Pine.LNX.4.53.0304111203370.26136@lxplus008.cern.ch>
On Thu, Apr 10, Benjamin Goldberg inscribed on the eternal scroll:
> That's strange -- I would expect it to fail due to the SJIS encoded text
> being incorrectly interpreted as latin-1 encoded text, *not* due to it
> being incorrectly interpreted as utf8 encoded text.
Consider, for example, RedHat 8 ?
cheers
------------------------------
Date: Fri, 11 Apr 2003 09:25:34 +0100
From: news@roaima.freeserve.co.uk
Subject: Re: Sending Mail with HTML links
Message-Id: <u5u57b.nek.ln@moldev.cmagroup.co.uk>
Mike <mshavel@optonline.net> wrote:
> I'm using Mail::Mailer to send mail.
Mail::Mailer generates non-MIME aware mail (implicit text/plain). You'll
need something like MIME::Lite to generate text/html email.
> When running this code below I get
> the HTML code displayed instead of the link in MS Outlook 2000.
Yes, that's correct. You've sent a non-MIME email so it's being
(correctly) displayed as plain text.
> The interesting
> thing is that it works correctly in Eudora 5.1.
No it doesn't. Eudora is guessing your plain text email that contains
HTML markup should be displayed as HTML. This is the same broken behaviour
that IE exhibits.
> I'm wondering if there is
> some special tag I need to include to make it work in Outlook 2000?
Yes. You should mark the email as being text/html. See MIME::Lite for
details.
> $mailer = Mail::Mailer->new();
For testing, try this (as per the docs):
$mail = Mail::Mailer->new('test');
> print $mailer "Content-type: text/html\n\n";
> print $mailer "<HTML>";
> print $mailer "<BODY>";
These three print statements are ignored because you've not yet "open"ed
the message. Even if they weren't ignored, though, you'd be writing to
the message body, not to the headers. (Re-read the documentation.)
Chris
--
@s=split(//,"Je,\nhn ersloak rcet thuarP");$k=$l=@s;for(;$k;$k--){$i=($i+1)%$l
until$s[$i];$c=$s[$i];print$c;undef$s[$i];$i=($i+(ord$c))%$l}
------------------------------
Date: Fri, 11 Apr 2003 09:19:49 +0100
From: Simon Oliver <simon.oliver@nospam.umist.ac.uk>
Subject: Re: Session variables in PERL CGI programming
Message-Id: <3E967AA5.30903@nospam.umist.ac.uk>
Kishor Babu wrote:
> Hi all,
> I am new to PERL programming. I would like to know if it is
> possible to maintain Session variables in PERL just like the way it is
> possible in ASP. I am using APACHE web server with Perl 5.0 on Windows
> 2000.
>
Yes.
You can use modperl to accomplish this. There a re various session
modules out there including an ASP module.
Alternatively you can use a backend database to store session info in and
cookies to keep the session alive.
--
Simon Oliver
------------------------------
Date: Fri, 11 Apr 2003 13:03:25 GMT
From: Matthew Weier O'Phinney <matthew@weierophinney.net>
Subject: Re: Session variables in PERL CGI programming
Message-Id: <slrnb9df8t.st.matthew@kavalier.weierophinney.net>
* Kishor Babu <g_kishor@yahoo.com>:
> I am new to PERL programming. I would like to know if it is
> possible to maintain Session variables in PERL just like the way it is
> possible in ASP. I am using APACHE web server with Perl 5.0 on Windows
> 2000.
You might want to check out the CGI::Session module.
--
Matthew Weier O'Phinney
matthew@weierophinney.net
http://matthew.weierophinney.net
------------------------------
Date: Fri, 11 Apr 2003 09:05:49 -0300
From: "Gary" <grobitaille@mail.com>
Subject: simple script question
Message-Id: <vbyla.42319$cB3.285610@nnrp1.uunet.ca>
If I have a perl/cgi script executing and displaying a form for a user to
fill out, how can I have the user directed to another page once they submit
the form and NOT be able to hit the back button to submit again? I thought
about the new page coming uip in a new window (so it would not have any
history to hit the back button) but it seems to me there is not an easy way
to close the original window.
Any ideas?
Gary
------------------------------
Date: 11 Apr 2003 12:21:18 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: simple script question
Message-Id: <slrnb9dcpu.9iu.abigail@alexandra.abigail.nl>
Gary (grobitaille@mail.com) wrote on MMMDX September MCMXCIII in
<URL:news:vbyla.42319$cB3.285610@nnrp1.uunet.ca>:
][ If I have a perl/cgi script executing and displaying a form for a user to
][ fill out, how can I have the user directed to another page once they submit
][ the form and NOT be able to hit the back button to submit again? I thought
][ about the new page coming uip in a new window (so it would not have any
][ history to hit the back button) but it seems to me there is not an easy way
][ to close the original window.
][
][ Any ideas?
I suggest going to the user and putting a loaded gun to its head,
threatening to pull the trigger if it pushes the back button.
The answer is, of course, no, you cannot do that. It's the users
choice to hit whatever button it likes. It's not your business
to create one way streets.
But this has nothing at all to do with Perl.
Abigail
--
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
------------------------------
Date: Fri, 11 Apr 2003 12:26:32 GMT
From: "Carl Stefan Grøtter" <news@kverulant.net>
Subject: Re: simple script question
Message-Id: <Xns935A92E9DA4F6newskverulantnet@212.83.64.229>
"Gary" <grobitaille@mail.com> wrote in
news:vbyla.42319$cB3.285610@nnrp1.uunet.ca:
> If I have a perl/cgi script executing and displaying a form for a user
> to fill out, how can I have the user directed to another page once
> they submit the form and NOT be able to hit the back button to submit
> again? I thought about the new page coming uip in a new window (so it
> would not have any history to hit the back button) but it seems to me
> there is not an easy way to close the original window.
>
> Any ideas?
One way to go around this is to put a hidden field in the form, which you
populate with a sequence number, checksum or whatever.. When you get the
input from the form you can check whether it is a duplicate. This works
well if you want to submit the data into a database, but may not be quite
as efficient if you plan to forward things in an e-mail...
--
Carl Stefan Grøtter
www.kverulant.net || news@kverulant.net
<Sett inn underfundig tankevekker her>
------------------------------
Date: 11 Apr 2003 04:25:58 -0700
From: rafasegovia@yahoo.com (rsegovia)
Subject: tab
Message-Id: <65fb86bd.0304110134.5f57b854@posting.google.com>
Hi there,
I have tried to split a tab-separated file record into an array, but
@rec = split ("/t", $line)
is not splitting the record. Any reason for that?
I am working with Perl 5.6.1 under DOS (Activeperl)
Thanks a lot,
------------------------------
Date: Fri, 11 Apr 2003 11:34:34 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: tab
Message-Id: <d0ad9vkeotosfkbet4jfl1ts390gusghh3@4ax.com>
Keywords: Remove WINDOZE to reply
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
In a fit of excitement on 11 Apr 2003 04:25:58 -0700,
rafasegovia@yahoo.com (rsegovia) managed to scribble:
> Hi there,
>
> I have tried to split a tab-separated file record into an array,
> but
> @rec = split ("/t", $line)
^
@rec = split("\t", $line);
> is not splitting the record. Any reason for that?
>
> I am working with Perl 5.6.1 under DOS (Activeperl)
>
> Thanks a lot,
HTH.
Regards,
Ian
-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0
iQA+AwUBPpaoK2fqtj251CDhEQLovQCYpiz6507vFVt7Z8b7pAZUP5BaZgCgjW3K
EsdA0iXp4fSvM2ZiLYSWayw=
=MImd
-----END PGP SIGNATURE-----
--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Scripting, Web design, development & hosting.
------------------------------
Date: 11 Apr 2003 11:41:00 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: tab
Message-Id: <b769kc$4qb$3@mamenchi.zrz.TU-Berlin.DE>
Keywords: Remove WINDOZE to reply
Ian.H [dS] <ian@WINDOZEdigiserv.net> wrote in comp.lang.perl.misc:
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
>
> In a fit of excitement on 11 Apr 2003 04:25:58 -0700,
> rafasegovia@yahoo.com (rsegovia) managed to scribble:
>
> > Hi there,
> >
> > I have tried to split a tab-separated file record into an array,
> > but
> > @rec = split ("/t", $line)
> ^
>
> @rec = split("\t", $line);
That happens to work, but only because Perl Does What I Mean and
interprets the string "\t" as a regular expression. The correct
way to specify the split parameter is
@rec = split /\t/, $line;
The only exception is the string " ", which split() interprets as /\s+/.
Anno
------------------------------
Date: Fri, 11 Apr 2003 11:44:18 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: tab
Message-Id: <3e96aa1e.74869296@news.cis.dfn.de>
On 11 Apr 2003 04:25:58 -0700, rafasegovia@yahoo.com
(rsegovia) wrote:
>I have tried to split a tab-separated file record into an array, but
> @rec = split ("/t", $line)
>is not splitting the record. Any reason for that?
Yes. The tab is encoded \t in regular expressions,
not /t.
BTW, it is usually cooler to split the line directly
into the variables you need, rather than go through
the intermediate step of the array.
my ($name,$address,$phone_num) = split "\t",$line;
I hope this helps.
--
Regards, Helgi Briem
helgi DOT briem AT decode DOT is
------------------------------
Date: Fri, 11 Apr 2003 07:50:45 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: tab
Message-Id: <slrnb9deh5.5er.tadmc@magna.augustmail.com>
rsegovia <rafasegovia@yahoo.com> wrote:
> I have tried to split a tab-separated file record into an array, but
> @rec = split ("/t", $line)
^
^
> is not splitting the record. Any reason for that?
Yes.
Your slash is leaning the wrong way.
But a pattern should *look like* a pattern, so I recommend:
my @rec = split (/\t/, $line)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 11 Apr 2003 12:10:35 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Re: tab
Message-Id: <k3cd9vg8ce9gl1pus51rm7g54674ffe0g5@4ax.com>
Keywords: Remove WINDOZE to reply
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
In a fit of excitement on 11 Apr 2003 11:41:00 GMT,
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) managed to scribble:
> > > @rec = split ("/t", $line)
> > ^
> >
> > @rec = split("\t", $line);
>
> That happens to work, but only because Perl Does What I Mean and
> interprets the string "\t" as a regular expression. The correct
> way to specify the split parameter is
>
> @rec = split /\t/, $line;
>
> The only exception is the string " ", which split() interprets as
> /\s+/.
Interesting point Anno (to me anyway). Thanks for this =)
Regards,
Ian
-----BEGIN xxx SIGNATURE-----
Version: PGP 8.0
iQA/AwUBPpawl2fqtj251CDhEQKSdwCfanBHLUPHDG/G5Bjy2FdQbRclFqUAn1Tp
OzNqu0QEcpLx3WbpAi5KhnFO
=LL5+
-----END PGP SIGNATURE-----
--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Scripting, Web design, development & hosting.
------------------------------
Date: Fri, 11 Apr 2003 22:31:48 +1000
From: D'oh <D'oh@a.deer>
Subject: Re: Weird behavior of PERL counter
Message-Id: <3E96B5B4.5740A6ED@a.deer>
Pablo Rodriguez wrote:
>
> Nothing happened, the problem is still there (BTW, those are my usual settings).
>
Well, I believe that it is an IE problem?? Maybe it's a feature?
I have been able to replicate you problem by using a combination
of both IE and Netscape Navigator.
What seems to be happening is that when you type in something into
the Address bar and press F5, IE refreshes the last "entered" URL
which in your case happens to be http://www.rodriguezgarcia.com/.
Don't use F5 until after you have loaded the page by typing the
URL in the Address bar and hitting the [Enter] key. Then you can
hit F5 to refresh that page as much as you like.
Try it and let us know what happens.
------------------------------
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 4831
***************************************