[26231] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 8416 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 14 06:05:33 2005

Date: Wed, 14 Sep 2005 03:05:06 -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           Wed, 14 Sep 2005     Volume: 10 Number: 8416

Today's topics:
    Re: [OT] connecting to MS SQL on a different computer ( <ThomasKratz@REMOVEwebCAPS.de>
        Beginner asks How to install cpan module to Perl instal <martina@martina.yu>
    Re: Beginner asks How to install cpan module to Perl in <vma_nntp@vmacs.us>
    Re: Beginner asks How to install cpan module to Perl in <nojunkmail@pacificwireless.com.au>
        File Modification Date <vma_nntp@vmacs.us>
    Re: File Modification Date <josef.moellers@fujitsu-siemens.com>
    Re: Need a regex <tompotter@hotmail.com>
        Perl DBI / SQL Question <vma_nntp@vmacs.us>
    Re: Perl DBI / SQL Question <no@email.com>
    Re: Perldoc security issues (Anno Siegel)
    Re: Simple question for you's...... <josef.moellers@fujitsu-siemens.com>
    Re: Simple question for you's...... <unmailable@duetospam.com>
    Re: Simple question for you's...... <flavell@ph.gla.ac.uk>
    Re: Simple question for you's...... (Anno Siegel)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 14 Sep 2005 11:33:13 +0200
From: Thomas Kratz <ThomasKratz@REMOVEwebCAPS.de>
Subject: Re: [OT] connecting to MS SQL on a different computer (DBD::ODBC)
Message-Id: <4327ee59$0$11219$bb690d87@news.main-rheiner.de>

John Bokma wrote:
> Can anyone give pointer(s) on how to connect to a server which runs MS SQL 
> using DBD::ODBC? I thought it would be as simple as specifying a host and 
> port, but I can't seem to get it working, and been googling for quite some 
> time and not found any solution yet and I am a bit lost in UNC, DNC and 
> more 3 letter abbreviations :-(
> 

Sorry if I state the obvious, but you seem to be new to this.
You will have to have the SQL-Server ODBC driver installed on the machine 
running your script. It is included in the client tools for SQL-Server.

Thomas

-- 
$/=$,,$_=<DATA>,s,(.*),$1,see;__END__
s,^(.*\043),,mg,@_=map{[split'']}split;{#>J~.>_an~>>e~......>r~
$_=$_[$%][$"];y,<~>^,-++-,?{$/=--$|?'"':#..u.t.^.o.P.r.>ha~.e..
'%',s,(.),\$$/$1=1,,$;=$_}:/\w/?{y,_, ,,#..>s^~ht<._..._..c....
print}:y,.,,||last,,,,,,$_=$;;eval,redo}#.....>.e.r^.>l^..>k^.-


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

Date: Wed, 14 Sep 2005 08:26:44 +0200
From: "Martina" <martina@martina.yu>
Subject: Beginner asks How to install cpan module to Perl installed on WinXP?
Message-Id: <dg8fr1$c00$1@ss405.t-com.hr>

How to install cpan module http://search.cpan.org/dist/Template-Toolkit/ to
Perl installed on WinXP?
Try to read 50 page on www.google.com, but I don't found anything useful.

Thanks in advance.

Martina




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

Date: Wed, 14 Sep 2005 00:38:20 -0600
From: "Vance M. Allen" <vma_nntp@vmacs.us>
Subject: Re: Beginner asks How to install cpan module to Perl installed on WinXP?
Message-Id: <PzPVe.53$YM2.6849@news.uswest.net>

On the linked page you provided, there was a file entitled "INSTALL".  After 
reading a portion of the file, it states:
======================
If you're running ActivePerl on a Win32 platform then you can use the
Perl Package Manager (PPM) to install the Template Toolkit.  Chris
Winters maintains a repository of pre-compiled PPM packages which contains
the Template Toolkit, AppConfig and others.  For further information, see:

    http://openinteract.sourceforge.net/
======================

HTH..

"Martina" <martina@martina.yu> wrote in message 
news:dg8fr1$c00$1@ss405.t-com.hr...
> How to install cpan module http://search.cpan.org/dist/Template-Toolkit/ 
> to
> Perl installed on WinXP?
> Try to read 50 page on www.google.com, but I don't found anything useful.
>
> Thanks in advance.
>
> Martina
>
> 




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

Date: Wed, 14 Sep 2005 16:41:00 +1000
From: "Leigh Sharpe" <nojunkmail@pacificwireless.com.au>
Subject: Re: Beginner asks How to install cpan module to Perl installed on WinXP?
Message-Id: <1126679978.473131@ns1.pacificwireless.com.au>

Use ppm3.
It's in the Activestate repository.
It's also in the Uwinnipeg repository.




"Martina" <martina@martina.yu> wrote in message
news:dg8fr1$c00$1@ss405.t-com.hr...
> How to install cpan module http://search.cpan.org/dist/Template-Toolkit/
to
> Perl installed on WinXP?
> Try to read 50 page on www.google.com, but I don't found anything useful.
>
> Thanks in advance.
>
> Martina
>
>





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

Date: Wed, 14 Sep 2005 00:01:52 -0600
From: "Vance M. Allen" <vma_nntp@vmacs.us>
Subject: File Modification Date
Message-Id: <A1PVe.51$YM2.6865@news.uswest.net>

I'm trying to find out how to determine the date and/or time that a file was 
created in a simple procedure.  I have heard about a few different libraries 
but the examples I have found haven't been very useful.

The basic purpose I want to do is a simple footer provided by a package 
module through CGI to inform users of the latest update to the code based on 
the URL.  Something simple saying "Version x.xx, Last Modified MM/DD/YYYY." 
which would automatically get the file modified timestamp.

I'd prefer to have, if possible, a simple scalar variable to store the 
date...for example:

$modtime = filemoddate_func(filename.cgi);

If anyone can help me with the libraries I need to use for this (if any 
special), and a code snippet if possible, I'd really appreciate it.

Thanks!

Vance 




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

Date: Wed, 14 Sep 2005 08:47:22 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: File Modification Date
Message-Id: <dg8gt7$192$2@nntp.fujitsu-siemens.com>

Vance M. Allen wrote:
> I'm trying to find out how to determine the date and/or time that a fil=
e was=20
> created in a simple procedure.  I have heard about a few different libr=
aries=20
> but the examples I have found haven't been very useful.
>=20
> The basic purpose I want to do is a simple footer provided by a package=
=20
> module through CGI to inform users of the latest update to the code bas=
ed on=20
> the URL.  Something simple saying "Version x.xx, Last Modified MM/DD/YY=
YY."=20
> which would automatically get the file modified timestamp.
>=20
> I'd prefer to have, if possible, a simple scalar variable to store the =

> date...for example:
>=20
> $modtime =3D filemoddate_func(filename.cgi);
>=20
> If anyone can help me with the libraries I need to use for this (if any=
=20
> special), and a code snippet if possible, I'd really appreciate it.

perldoc perlfunc
then search for -M

--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett



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

Date: Wed, 14 Sep 2005 09:18:53 GMT
From: Tom Potter <tompotter@hotmail.com>
Subject: Re: Need a regex
Message-Id: <Xns96D17C9077AB7tompotterhotmailcom@131.228.6.99>

"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in 
news:Xns96D0B43E61878asu1cornelledu@127.0.0.1:

> Shane <shane@weasel.is-a-geek.net> wrote in
> news:pan.2005.09.13.21.28.25.356154@weasel.is-a-geek.net: 
> 
>> On Tue, 13 Sep 2005 21:20:38 +0000, Randy Harris wrote:
>> 
>>> I would appreciate help creating a regex.  I have a file that
>>> contains lines that begin with several groups of numbers separated by
>>> a dash followed by a dash and then non digit data. For example:
>>> 
>>> 123-12-23-Bottom Bracket
>>> 561-318-001-Cowling Spacer 2
>>> 453-2193-Fitting Hose
>>> 
>>> I need to capture the numeric portion, up to but not including the
>>> last dash. From the above samples I would want:
>>> 
>>> 123-12-23
>>> 561-318-001
>>> 453-2193
>>> 
>>> Thank you for any help.
> 
> To the OP: This is not a "write my code for me" service. If you do not 
> put any effort into helping others help you, you cannot expect others to 
> put much effort into helping you.
> 
> Or, you get:
> 
> use strict;
> use warnings;
> 
> missing.
> 
>> my @list = <Filehandle>
>> $list[$linenumber] =~ /([\d-]+)/
>> print $1
> 
> Now, Shane,
> 
> 1. Why are you slurping the whole file only to process it line by line?
> 2. What is $linenumber?
> 3. Since you are not actually looping through all the elements of @list, 
> do you really expect this to do what the OP asked for?
> 4. You are using $1 without checking if the regex actually matched.
> 5. Since you did not anchor the regex, it will also match lines such as
> 
> Hello -555- World!
> 
> This is clearly against the specs.
> 
> 6. The regex you specified will also match the trailing dash. Again, the 
> OP was asking the exact opposite.
> 
> Here is something that will actually work:
> 
> #!/usr/bin/perl
> 
> use strict;
> use warnings;
> 
> while(<DATA>) {
>    if( /^([\d-]+\d+)-/ ) {
>       print "$1\n";
>    }
> }
> 
> __DATA__
> 123-12-23-Bottom Bracket
> 561-318-001-Cowling Spacer 2
> 453-2193-Fitting Hose
> 
> D:\Home\asu1\UseNet\clpmisc> www
> 123-12-23
> 561-318-001
> 453-2193
> 
> Please read the posting guidelines for this group.
> 
> Sinan

Please don't take it otherwise,
I would never understand why pepople act so pricy in answering queries for 
a freeware like perl, look at Tad's answer, short and simple, few maybe 
more people don't do serious programing in perl ,they do it cause they 
think  its better,efficient and easy then writing a batch file, why do such 
persons get a arrogant answer or anybody,


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

Date: Wed, 14 Sep 2005 00:06:32 -0600
From: "Vance M. Allen" <vma_nntp@vmacs.us>
Subject: Perl DBI / SQL Question
Message-Id: <Y5PVe.52$YM2.6926@news.uswest.net>

Sorry if the cross-posting wasn't appropriate, but I need help with this and 
am not sure if it's more appropriate to post under MySQL or Perl...I want to 
be sure that I can get help from the best source.

My question is probably a simple answer, but I am not sure what I have to do 
and the books I have here are either not answering the question, or I'm not 
finding the answer.

I need to know how to retrieve through Perl DBI a listing of possible ENUM 
elements from a field for processing under a CGI script.  If all I need for 
this is some form of SELECT statement, please provide a code snippet of this 
so I can do it.

I want to make my code so I'm not having to edit hard-coded Perl CGI scripts 
if/when I add new elements to the ENUM field.  Any help you can provide 
would be greatly appreciated.

Thanks!

Vance 




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

Date: Wed, 14 Sep 2005 10:34:46 +0100
From: Brian Wakem <no@email.com>
Subject: Re: Perl DBI / SQL Question
Message-Id: <3oq95mF78tevU1@individual.net>

Vance M. Allen wrote:

> Sorry if the cross-posting wasn't appropriate, but I need help with this
> and am not sure if it's more appropriate to post under MySQL or Perl...I
> want to be sure that I can get help from the best source.
> 
> My question is probably a simple answer, but I am not sure what I have to
> do and the books I have here are either not answering the question, or I'm
> not finding the answer.
> 
> I need to know how to retrieve through Perl DBI a listing of possible ENUM
> elements from a field for processing under a CGI script.  If all I need
> for this is some form of SELECT statement, please provide a code snippet
> of this so I can do it.
> 
> I want to make my code so I'm not having to edit hard-coded Perl CGI
> scripts
> if/when I add new elements to the ENUM field.  Any help you can provide
> would be greatly appreciated.
> 
> Thanks!
> 
> Vance


I don't know if there's a built-in may of doing this, but it got me
thinking.  Here's a dirty was of doing it.

my $sth = $dbh->prepare("DESCRIBE tablename fieldname");
$sth->execute();
my @row = $sth->fetchrow_array();
my $enum = $row[1];
$enum =~ s!^enum\(!!;
$enum =~ s!\)$!!;
my @enum = split/,/,$enum;
foreach(@enum) {
        s!^'!!;
        s!'$!!;
}

print "$_\n" foreach @enum;


-- 
Brian Wakem
Email: http://homepage.ntlworld.com/b.wakem/myemail.png


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

Date: 14 Sep 2005 09:49:59 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perldoc security issues
Message-Id: <dg8ro7$bb3$1@mamenchi.zrz.TU-Berlin.DE>

James Taylor  <spam-block-@-SEE-MY-SIG.com> wrote in comp.lang.perl.misc:
> In article <dg67er$mda$1@mamenchi.zrz.TU-Berlin.DE>,
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> > 
> > James Taylor wrote:
> > > 
> > > Why use a sledgehammer when a nutcracker will do?
> > 
> > In view of this attitude one has to wonder why you asked about
> > security in the first place. You are obviously determined not
> > to invest any more effort than you already have.
> 
> I think you misunderstand. I just wanted the size of the solution
> to be in the same ball park as the size of the problem; something
> doable in the kind of time the task deserves.

Then you don't want a secure solution, you want something in between.
That's your call and only yours.  We don't know the size of the problem
and how much time the task deserves.  Nor do we know what is at stake
in case of a security breach.  We don't even know what system you're
using and what shell, if any, will interpret commands.  Security
with system() is mostly shell-dependent.

> Anyway, I refute your
> apparent belief that a secure script requires a large or complex
> solution.

I have uttered no such belief.  You have rejected concrete proposals
as too complex.

> Merely disallowing any options would suffice (although
> in this particular case it would be too Draconian for my purposes).

If you say so...  No way for us to know.

[...]

> It amuses me how often small questions in this group are answered
> with disproportionately large and idealistic solutions. This
> invariably results in the questioner squirming for a way to get
> a more pragmatic answer without seeming ungrateful.

Your question was:

> Can anyone offer me general guidance?

What did you expect, in a security context?

Anno
-- 
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on 
"show options" at the top of the article, then click on the 
"Reply" at the bottom of the article headers.


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

Date: Wed, 14 Sep 2005 08:43:47 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: Simple question for you's......
Message-Id: <dg8gmi$192$1@nntp.fujitsu-siemens.com>

Slow Learner wrote:
>  As I'm not from a Perl background, I would probably try something like=
:
>=20
> if ( length ( $display_url ) > 70 ) {
>        $display_name =3D '.../'.substr ($display_url, length (=20
> $display_url ) - 70, 70 );
>    }
>    else
>    {
>        $display_name =3D $display_url;
>    }
>=20
>=20
> This is my naive version - sorry I don't know Perl syntax all that well=
=2E=20
> I'm currently modifying someone elses script to make this small change =
:/.=20
> Anyway, the above kindof works (okay, given 70 chars instead of 50), bu=
t=20
> with urls that happen to straddle the http:// on 70 characters, it look=
s=20
> rather ugly, ie:
>=20
> .../://www.mysite.com/bla/bla/bla
>=20
>=20
>=20
>=20
>=20
> "Josef Moellers" <josef.moellers@fujitsu-siemens.com> wrote in message =

> news:dg6ogp$h41$1@nntp.fujitsu-siemens.com...
> Slow Learner wrote:
>=20
>>Hey gurus,
>>
>>
>>If, say, I have a URL (or any "path" type string come to think of it), =
how=20
>>can I truncate it if it's greater than a certain length?  Note: I don't=
=20
>>want to use it as a path, I just want to truncate it from display=20
>>purposes.  For example:
>>
>>
>>http://www.mysite.com/beta/content/english/misc/publications/papers/ind=
ex.html
>>
>>
>>.... and I want to restrict it to no more than 50 characters, but I wan=
t=20
>>the result to look something like this:
>>
>>
>>.../english/misc/publications/papers/index.html
>>
>>
>>In other words, I want the left-most part of a path string replaced wit=
h=20
>>".../" for those bits of the path that make it go over 50 characters.
>>
>>
>>
>>How can I do this in Perl?
>=20
>=20
> The usual answer: What have you tried so far and where have you failed?=

>=20
> I'd try split and length, but then TMTOWTDI,

See Anno's post. I'd have done something similar, although not as=20
elegant B-{).

Josef
--=20
Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize
						-- T.  Pratchett



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

Date: Wed, 14 Sep 2005 09:26:27 +0100
From: "Slow Learner" <unmailable@duetospam.com>
Subject: Re: Simple question for you's......
Message-Id: <dg8msd$j0e$1$8302bc10@news.demon.co.uk>



Hmmmmm interesting.  Gibberish but interesting....... :)





"Brian McCauley" <nobull@mail.com> wrote in message 
news:dg6vhs$ng$1@redhat2.bham.ac.uk...
>
>
> Slow Learner wrote:
>
> > Subject: Simple question for you's......
>
> Please put the subject of your post in the Subject of your post.
>
>> http://www.mysite.com/beta/content/english/misc/publications/papers/index.html
>>
>> .... and I want to restrict it to no more than 50 characters, but I want 
>> the result to look something like this:
>>
>> .../english/misc/publications/papers/index.html
>
>> In other words, I want the left-most part of a path string replaced with 
>> ".../" for those bits of the path that make it go over 50 characters.
>
>  s/.+?(?=\/.{0,46}$)/.../ if length > 50;
>
> Note: This will leave the string unchaged if there is no '/' in the last 
> 47 characters of the string.
> 




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

Date: Wed, 14 Sep 2005 09:42:11 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Simple question for you's......
Message-Id: <Pine.LNX.4.62.0509140941061.26350@ppepc56.ph.gla.ac.uk>

On Wed, 14 Sep 2005, Slow Learner top-posted:

> 
> 
> Hmmmmm interesting.  Gibberish but interesting....... :)
> 
> 

Good news: your application for fast-track entry to the killfile was 
overwhelmingly approved.

SCNR.


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

Date: 14 Sep 2005 10:03:00 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Simple question for you's......
Message-Id: <dg8sgk$bb3$2@mamenchi.zrz.TU-Berlin.DE>

Slow Learner <unmailable@duetospam.com> wrote in comp.lang.perl.misc:
> 
> 
> Hmmmmm interesting.  Gibberish but interesting....... :)
> 
> 
> 
> 
> 
> "Brian McCauley" <nobull@mail.com> wrote in message 
> news:dg6vhs$ng$1@redhat2.bham.ac.uk...
> >
> >
> > Slow Learner wrote:
> >
> > > Subject: Simple question for you's......
> >
> > Please put the subject of your post in the Subject of your post.
> >
> >>
> http://www.mysite.com/beta/content/english/misc/publications/papers/index.html
> >>
> >> .... and I want to restrict it to no more than 50 characters, but I want 
> >> the result to look something like this:
> >>
> >> .../english/misc/publications/papers/index.html
> >
> >> In other words, I want the left-most part of a path string replaced with 
> >> ".../" for those bits of the path that make it go over 50 characters.
> >
> >  s/.+?(?=\/.{0,46}$)/.../ if length > 50;

Very nice.  I believe the final "$" can go, the last part is greedy
anyhow.

Anno
-- 
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article.  Click on 
"show options" at the top of the article, then click on the 
"Reply" at the bottom of the article headers.


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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


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