[28986] in Perl-Users-Digest
Perl-Users Digest, Issue: 230 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 16 11:10:05 2007
Date: Fri, 16 Mar 2007 08:09:10 -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, 16 Mar 2007 Volume: 11 Number: 230
Today's topics:
Alice's Restaurant (was Re: What is abriviationfor CHR( <tadmc@augustmail.com>
Re: auto documentor perl (Jamie)
Re: auto documentor perl <bik.mido@tiscalinet.it>
Re: Comparing filenames in different directories <wahab-mail@gmx.de>
Re: Comparing filenames in different directories <tadmc@augustmail.com>
Re: Comparing filenames in different directories <pradeep.bg@gmail.com>
Re: Comparing filenames in different directories <kalyan.manchikanti@gmail.com>
Re: Comparing filenames in different directories <pradeep.bg@gmail.com>
Re: Importing an hash in a lexical scope <paduille.4060.mumia.w+nospam@earthlink.net>
ldap problem <elmargrote@arcor.de>
Re: ldap problem anno4000@radom.zrz.tu-berlin.de
Re: ldap problem <elmargrote@arcor.de>
Re: ldap problem anno4000@radom.zrz.tu-berlin.de
Re: LWP credentials help <Peter@PSDT.com>
Re: Mastering Perl <wahab-mail@gmx.de>
No -e allowed in setuid scripts? <stembe@gmail.com>
output confusion <"v.niekerk at hccnet.nl">
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 16 Mar 2007 06:33:29 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Alice's Restaurant (was Re: What is abriviationfor CHR(4))
Message-Id: <slrnevl049.afo.tadmc@tadmc30.august.net>
Uri Guttman <uri@stemsystems.com> wrote:
>>>>>> "j" == jmiles100225 <jmiles100225@yahoo.com> writes:
> j> 1 - Creation of online charts and graphs controlled by user input
>
> with circles and arrows on the back of each one explaining them
You can get anything you want, at Miles' Development
Shop (excepting Miles).
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 16 Mar 2007 10:49:42 GMT
From: nospam@geniegate.com (Jamie)
Subject: Re: auto documentor perl
Message-Id: <Lc117402177655490x8cc8ea8@pong.podro.com>
In <1174036734.949495.293550@y66g2000hsf.googlegroups.com>,
"ton de w" <ton_de_winter@yahoo.co.uk> mentions:
>Hello,
>
>I was wondering if there a tool that could examine a 50 page CGI
>program(that creates html and mysql queries) that I have been given
>and create a flow chart or similar from the code?
>There are very few comments so just extracting the comments wont help.
Not exactly what you want, but, there is B::Xref (at least on newer
versions of perl) It's not really a program flow so much as a dump
of the symbol table.
Also, Devel::DProf (again, won't give you program flow but it will tell
you how the program is spending it's time)
So far, the best tool I've found for this is ... 'grep' and 'print'.
<rant>
I do wish perl and doxygen would get together some how though, so you
could use one tool for multiple languages. Seems like most projects
consist of a wide range of languages and it'd be nice to have a single
tool for all of them.
</rant>
Course, having ranted that.. I can't see how the two could meet.
Jamie
--
http://www.geniegate.com Custom web programming
Perl * Java * UNIX User Management Solutions
------------------------------
Date: Fri, 16 Mar 2007 15:06:31 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: auto documentor perl
Message-Id: <u29lv2ld60nrvri65t72apmlvb34n5elt5@4ax.com>
On Fri, 16 Mar 2007 10:49:42 GMT, nospam@geniegate.com (Jamie) wrote:
>I do wish perl and doxygen would get together some how though, so you
>could use one tool for multiple languages. Seems like most projects
>consist of a wide range of languages and it'd be nice to have a single
>tool for all of them.
http://perlmonks.org/?node_id=604671
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: Fri, 16 Mar 2007 11:47:54 +0100
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: Comparing filenames in different directories
Message-Id: <etdsv4$rrl$1@mlucom4.urz.uni-halle.de>
cmic wrote:
> If you are working under Unix (lInux or whatever), you can use the
> diff command on diretories. The -r option of diff can even works
> recursively.
> But on windows ....
wahab@WINBOX ~
$ set | grep WINDIR & diff -v
WINDIR='C:\WINDOWS'
diff (GNU diffutils) 2.8.7
Written by Paul Eggert, Mike Haertel, David Hayes,
Richard Stallman, and Len Tower.
...
(this comes from a Cygwin environment)
Regards
Mirco
------------------------------
Date: Fri, 16 Mar 2007 06:24:01 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Comparing filenames in different directories
Message-Id: <slrnevkvih.afo.tadmc@tadmc30.august.net>
Deepu <pradeep.bg@gmail.com> wrote:
> I am trying to compare file names in 2 different directories.
>
> DIR1:
>
> FILENAME_1.a
> FILENAME_2.a
> FILENAME_3.a
> FILENAME_4.a
>
> DIR2:
>
> FILENAME_1.x
> FILENAME_2.x
> FILENAME_3.x
> FILENAME_5.x
>
>
> I need to 'diff' files with same name
None of those file have the same name...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 16 Mar 2007 07:13:06 -0700
From: "Deepu" <pradeep.bg@gmail.com>
Subject: Re: Comparing filenames in different directories
Message-Id: <1174054385.956752.319630@o5g2000hsb.googlegroups.com>
> > FILENAME_2.a
> > FILENAME_3.a
> > FILENAME_4.a
>
> > DIR2:
>
> > FILENAME_1.x
> > FILENAME_2.x
> > FILENAME_3.x
> > FILENAME_5.x
>
> > I need to 'diff' files with same name
>
> None of those file have the same name...
I am trying to compare file with name "FILENAME_1" in DIR1 and
"FILENAME_1" in DIR2 after ignoring .a & .x and then continue the same
for other files.
------------------------------
Date: 16 Mar 2007 07:27:08 -0700
From: "Kalyan Manchikanti" <kalyan.manchikanti@gmail.com>
Subject: Re: Comparing filenames in different directories
Message-Id: <1174055228.035367.216960@n59g2000hsh.googlegroups.com>
On Mar 16, 9:13 am, "Deepu" <pradeep...@gmail.com> wrote:
> > > FILENAME_2.a
> > > FILENAME_3.a
> > > FILENAME_4.a
>
> > > DIR2:
>
> > > FILENAME_1.x
> > > FILENAME_2.x
> > > FILENAME_3.x
> > > FILENAME_5.x
>
> > > I need to 'diff' files with same name
>
> > None of those file have the same name...
>
> I am trying to compare file with name "FILENAME_1" in DIR1 and
> "FILENAME_1" in DIR2 after ignoring .a & .x and then continue the same
> for other files.
There is a unix utility called "dircmp" which does basic directory
comparision , but assuming you are looking for just file comparision
within different directories, have you tried using diff or sdiff
( sdiff is much more readable as it shows side by side comparision).A
simple for loop ( in shell or foreach in perl) . You can obviusly
pretty it up by cleaning up the syntax and including more error
checking..
in shell,
for i in 1..10
do
echo "##Comparing FILENAME_$i in DIR1 and DIR2##"
sdiff /DIR1/FILENAME_$i.a /DIR2/FILENAME_$i.x
done | tee <output>
in perl,
foreach (1..10) {
print "##comparing FILENAME_$i in DIR1 and DIR2##";
`sdiff /DIR1/FILENAME_$i.a /DIR2/FILENAME_$i.x >> /tmp/somefile`;
}
------------------------------
Date: 16 Mar 2007 07:32:22 -0700
From: "Deepu" <pradeep.bg@gmail.com>
Subject: Re: Comparing filenames in different directories
Message-Id: <1174055542.516503.47050@o5g2000hsb.googlegroups.com>
> There is a unix utility called "dircmp" which does basic directory
> comparision , but assuming you are looking for just file comparision
> within different directories, have you tried using diff or sdiff
> ( sdiff is much more readable as it shows side by side comparision).A
> simple for loop ( in shell or foreach in perl) . You can obviusly
> pretty it up by cleaning up the syntax and including more error
> checking..
>
> in shell,
> for i in 1..10
> do
> echo "##Comparing FILENAME_$i in DIR1 and DIR2##"
> sdiff /DIR1/FILENAME_$i.a /DIR2/FILENAME_$i.x
> done | tee <output>
>
> in perl,
> foreach (1..10) {
> print "##comparing FILENAME_$i in DIR1 and DIR2##";
> `sdiff /DIR1/FILENAME_$i.a /DIR2/FILENAME_$i.x >> /tmp/somefile`;
> }
How to do this ONLY after checking files with same name exists in both
directories else display FILENAME doesnot exist in DIR1/2
------------------------------
Date: Fri, 16 Mar 2007 14:17:21 GMT
From: "Mumia W." <paduille.4060.mumia.w+nospam@earthlink.net>
Subject: Re: Importing an hash in a lexical scope
Message-Id: <RFxKh.13346$Jl.10538@newsread3.news.pas.earthlink.net>
On 03/15/2007 09:49 AM, Stefano Sabatini wrote:
> On 2007-03-14, Uri Guttman <uri@stemsystems.com> wrote:
>>
>> you haven't explained your bigger picture. why do you need to import the
>> hash? [...]
>
> There is no particular reason for wondering about to import an hash. I
> only stepped on the problem, I considerd the basic hash access method
> and I wondered if it was possible to use that other method, that
> seemed to slightly simplify the user code. Maybe I should have asked
> myself if that was a good thing to do, and as you say maybe it's not
> (for the same reasons you explained).
>
> But I thought that was an interesting problem, I meant good to stretch
> my own knowledge and awareness of the language.
> [...]
I probably have no business posting this since the thread is basically
over, but I just got so curious that I had to see if it was possible,
and it is:
#!/usr/bin/perl
use strict;
use warnings;
use English qw(-no_match_vars);
my %h = (USER => 'han',
EMAIL => 'han76@example.com',
PASSWORD => 'passWord');
$RS='';
while (my $custcode = <DATA>) {
my $code = join "",
map "my \$$_ = q{$h{$_}};\n", keys %h;
$code .= "\n$custcode\n";
# print $code;
eval $code;
if ($@) { die $@; }
}
__DATA__
local ($, , $\ ) = (' , ', "\n");
print "User Info:", $USER, $EMAIL, $PASSWORD;
print "My customer's email address is $EMAIL.\n";
use Digest::MD5 qw(md5_hex);
local $\ = "\n";
print "User ${USER}'s md5 password = ", md5_hex($PASSWORD);
__END__
In this program, each segment of customer code is separated by a blank
line, and there are three segments, so the while loop executes three
times. If you don't have Digest::MD5 installed, you get to see what
happens when "customer code" fails :-)
However, as Uri said, using a hash is best. The difference between
${USER} and $h{USER} is nominal.
------------------------------
Date: Fri, 16 Mar 2007 14:11:59 +0100
From: Elmar <elmargrote@arcor.de>
Subject: ldap problem
Message-Id: <45fa97a4$0$20298$9b4e6d93@newsspool3.arcor-online.net>
Hi i wrote a script for our exim mailserver which ask a MS AD Server
if he has an account with that mailaddress. It work good but sometimes
i see some errors in the eximlog like:
"Can't continue after import errors
at /usr/lib/perl5/vendor_perl/5.8.5/Net/LDAP/Bind.pm line 8"
Is ther somthin wrong with my code?
Here is the sample where the error happens.
All variables where set.
##############
unless ( $ldapBind = Net::LDAP->new( $ldapserver1, timeout => 3 ) ) {
unless ( $ldapBind = Net::LDAP->new( $ldapserver2, timeout => 3 ) ) {
unless ( $ldapBind = Net::LDAP->new( $ldapserver3, timeout => 3 ) ) {
# if no LDAP Server is reachable return true and exit
Exim::log_write("#ERROR!! No LDAP server available");
return "true";
}
}
}
$ldapBind->bind( dn => $LDAP_MTA_DN, password => $LDAP_MTA_PASS );
######### Step 1 #########
$RCPT = "$RCPT_Local" . "\@" . "$RCPT_Domain";
$searchPattern = "proxyAddresses=smtp:" . "$RCPT";
@args = (
base => $searchDN,
filter => "(&(objectclass=user)($searchPattern))",
control => [$page],
);
while (1) {
$ldapRCPT = $ldapBind->search(@args);
$ldapRCPT->code and last;
my ($resp) = $ldapRCPT->control(LDAP_CONTROL_PAGED) or last;
$cookie = $resp->cookie or last;
$page->cookie($cookie);
}
if ($cookie) {
$page->cookie($cookie);
$page->size(0);
$ldapBind->search(@args);
}
# close connection
$ldapBind->unbind();
if ( $ldapRCPT->code ) {
Exim::log_write("!! ERROR!! Promblem with LDAP search");
return "true";
}
if ( $ldapRCPT->count > " 0 " ) {
return = "true";
}
else {
return = "false";
}
Thanks Elmar
------------------------------
Date: 16 Mar 2007 13:32:14 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: ldap problem
Message-Id: <55vkiuF2658fqU1@mid.dfncis.de>
Elmar <elmargrote@arcor.de> wrote in comp.lang.perl.misc:
> Hi i wrote a script for our exim mailserver which ask a MS AD Server
> if he has an account with that mailaddress. It work good but sometimes
> i see some errors in the eximlog like:
>
> "Can't continue after import errors
> at /usr/lib/perl5/vendor_perl/5.8.5/Net/LDAP/Bind.pm line 8"
Is that all it says? That message usually follows another one
that specifies the "import error".
Line 8 of .../Net/LDAP/Bind.pm is in my version (line broken):
use Net::LDAP qw(LDAP_SASL_BIND_IN_PROGRESS
LDAP_DECODING_ERROR LDAP_SUCCESS);
So you'd would have to find out what goes wrong in these particular
calls. Normally one would expect this statement either to work
or not. Occasional failure is strange, but who knows how exim
calls your Perl.
> Is ther somthin wrong with my code?
[snip]
That's too much code to check manually.
Anno
------------------------------
Date: Fri, 16 Mar 2007 15:02:14 +0100
From: Elmar <elmargrote@arcor.de>
Subject: Re: ldap problem
Message-Id: <45faa36b$0$20287$9b4e6d93@newsspool3.arcor-online.net>
anno4000@radom.zrz.tu-berlin.de wrote:
> use Net::LDAP qw(LDAP_SASL_BIND_IN_PROGRESS
> LDAP_DECODING_ERROR LDAP_SUCCESS);
What does this mean? Will it give me a more detailed error message?
Should i replace my "use Net::LDAP" with that?
Elmar
------------------------------
Date: 16 Mar 2007 14:10:54 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: ldap problem
Message-Id: <55vmreF26bbmfU2@mid.dfncis.de>
Elmar <elmargrote@arcor.de> wrote in comp.lang.perl.misc:
> anno4000@radom.zrz.tu-berlin.de wrote:
>
> > use Net::LDAP qw(LDAP_SASL_BIND_IN_PROGRESS
> > LDAP_DECODING_ERROR LDAP_SUCCESS);
>
> What does this mean? Will it give me a more detailed error message?
> Should i replace my "use Net::LDAP" with that?
It is (probably) the line that caused the error. It belongs to the
source code of Net::LDAP and I only quoted it to show what's happening
when the error occurs. It is *not* meant to be used by you in your
code.
To be sure, you'd have to look up the source line (8, IIRC) in
.../Net/LDAP/Bind.pm on the machine where this is happening.
Anno
------------------------------
Date: Fri, 16 Mar 2007 14:11:15 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: LWP credentials help
Message-Id: <pan.2007.03.16.14.11.14.563242@PSDT.com>
On Thu, 15 Mar 2007 19:27:36 +0000, Jamie wrote:
> In <1173984768.503775.59350@n76g2000hsh.googlegroups.com>,
> "Nalli" <nalli718@gmail.com> mentions:
[...]
>> $ua->agent("Mozilla/5.01 (Windows; U; NT4.0; en-us) Gecko/
>>25250101");
>> $ua->credentials( $url, $url, "username", "password" );
[...]
>>In order to access $url a username and password are required. The
>>problem is that I dont know hwo to pass the credentials in order to
>>successfully access the page. Can someone please tell me how to pass my
>>login information?
>
> The way I've done this in the past was to override LWP::UserAgent and
> supply my own get_basic_credentials method. Then, from there you can
> either just return them, prompt the user for them, look them up in a
> database, etc.. Seems a little involved at first, but it's not that bad.
And it's precisely because it's involved that I supplied a patch that was
incorporated into the latest WWW::Mechanize to simplify it. Use that
module instead and all you need to do is:
$mech->credentials( $username, $password );
It should be as easy for the programmer as it is for the browser user,
otherwise you're doing work that the computer could do for you.
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
------------------------------
Date: Fri, 16 Mar 2007 11:39:12 +0100
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: Mastering Perl
Message-Id: <etdseq$rnf$1@mlucom4.urz.uni-halle.de>
The Count wrote:
> Im a BSc4 Maths/Computer Science student and would like to find out
> the best way to learn programming in perl.Perl is not offered in my
> course but I find that it is a very popular language.I can program in
> Pascal,Delphi and C++. How long could it take me to master perl to a
> level where I can make web applications?
*Web Applications*?
You have to learn a huge hunk of skills for that,
and of these: Perl will be a tool among others.
The selection of "Perl" implies then possibly the
following languages/concepts to learn:
- SQL and some interface to Perl => Perl::DBI
- Apache (or any httpd) with configuration language => mod_perl
- HTML & CSS generators or simple Templating systems (=> CGI, => CGI::Simple)
- HTML and a HTML Templating System (=> Mason, =>Template Toolkit ...)
Each of these topics is covered by a bunch of books,
more books exist on how to "put all these things together".
And this is for "simple web applications" ;-)
> Can you recommend websites where I can find good
> introductory tutorials?What do you suggest would
> be the best way to learn Perl?
Each of the "Names" behind the '=>' from above
will lead you to a book (some are downloadable
and free) via google.
Regards
Mirco
------------------------------
Date: 16 Mar 2007 07:03:31 -0700
From: "maxshop" <stembe@gmail.com>
Subject: No -e allowed in setuid scripts?
Message-Id: <1174053811.271319.296640@l75g2000hse.googlegroups.com>
Hello Group,
I have a shell script (on AIX 5.2) that looks something like this:
/* ---- pg_format.sh Begin ---- */
#!/usr/bin/ksh
PAGE1FORM=$1
PAGE2FORM=$2
/usr/bin/perl -014pe's|^|(/Page:\s
+1\s/?"'$PAGE1FORM'\n":"'$PAGE2FORM'\n")|e'
/* ---- pg_format.sh End ---- */
There is another script called: main.sh, which is being invoked from
our ERP & the report data is being passed to it, which is captured in
the $INFILE (as "cat > $INFILE"). The pg_format.sh script is then
called from main.sh, as:
pg_format.sh $form1 $form2 < $INFILE > $OUTFILE
The function of the pg_format.sh script is to insert the value of
$form1 on the first line of page 1, and the value of $form2 on the
first line of page 2 and onwards.
Now, whenever I run a report in our ERP system & invoke main.sh, which
in turn invokes pg_format.sh, I get an error: "No -e allowed in setuid
scripts". However, when I run main.sh from the command line & pass the
report data stream to it, the pg_format.sh works just fine without any
errors. This is what I find confusing.
Secondly, this is only happening on our TEST AIX machine. On
Production, it works just fine when invoked thru our ERP. The AIX
version is the same, the ERP version, setup, etc. is the same, the
file/directory locations, owners, permissions, etc. are exactly the
same. The version of perl (v5.8.0) is the same on both.
Not sure why am I getting this error. I also tried the -U option
("allow unsafe operations"), but that didn't help.
Any suggestions?
Thanks for any help.
S
------------------------------
Date: Fri, 16 Mar 2007 15:46:31 +0100
From: Huub <"v.niekerk at hccnet.nl">
Subject: output confusion
Message-Id: <45faadc9$0$3375$e4fe514c@dreader29.news.xs4all.nl>
Hi,
I wrote a script that reads from a database and should print to labels
on a printer. It did work, but the text is out of proportion. I first
got advise to use PCL, but I didn't get that working. Next advise was to
use PostScript::Simple. I think I have that working, although loading
the generated .ps file couldn't be loaded by Evince that kept showing
"loading".
Now I have a question: when I write to file, I do this:
open(out,">$FILE");
print out "some text\n";
print out "some text2\n";
close(out);
Now, with PS, I have to use e.g.
my $ps = new PostScript::Simple(....);
$ps->text(10,10,"some text");
$ps->text(10,11,"some text2"); (?)
$ps->output("file.ps");
I suppose I just should replace all lines
print out "some text";
by
$ps->text(<x>,<y>,"some text");
Is this correct?
Thanks for helping.
Huub
------------------------------
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 V11 Issue 230
**************************************