[22078] in Perl-Users-Digest
Perl-Users Digest, Issue: 4300 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 21 14:05:45 2002
Date: Sat, 21 Dec 2002 11:05:07 -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 Sat, 21 Dec 2002 Volume: 10 Number: 4300
Today's topics:
Re: [Win32::OLE] Lotus Notes database <isresi1@xs4all.nl>
Re: advice - gui-ish programming <bart.lateur@pandora.be>
Re: Comparison confusion (James E Keenan)
Concatenation help for beginner at Perl <al@onetel.net.uk>
Re: DBI secure password <philip@zaynar.demon.co.uk>
DESTROY and END <paul@pco.iis.nsk.su>
Re: DESTROY and END (Anno Siegel)
Re: DESTROY and END <paul@pco.iis.nsk.su>
Re: enviroment variable set <tassilo.parseval@post.rwth-aachen.de>
Re: enviroment variable set (Anno Siegel)
Re: enviroment variable set (Tad McClellan)
Re: how do I split large file into separate files? <geoff.cox@blueyonder.co.uk>
Re: In addition <d.adamkiewicz@i7.com.pl>
Re: Performance for my roguelike (Matt Knecht)
Perl2Exe - Missing modules in @INC? <ian@WINDOZEdigiserv.net>
Re: Regex [1-9] vs \d <erutiurf@web.de>
Re: REgex quesion [^-] (Tad McClellan)
satellite 3985 (Winpex Tech)
Re: Shroud+ Perl source code obfuscator... <tassilo.parseval@post.rwth-aachen.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 21 Dec 2002 10:26:06 +0100
From: smasr <isresi1@xs4all.nl>
Subject: Re: [Win32::OLE] Lotus Notes database
Message-Id: <3e04342d$0$1000$e4fe514c@dreader7.news.xs4all.nl>
smasr wrote:
> Hi,
>
> I have a Lotus Notes database with lots of attachments.
> (Word/Excel/Wordperfect). I want to detach this attachments and i found
> some VB code to do it.I wanted to port this code to Perl. I hope someone
> can give me some clues or examples. I am a bit N00b at this.
>
> ---
>
> use strict;
> use Win32::OLE;
>
> # CONNECT
> my $Notes = Win32::OLE->new('Notes.NotesSession')
> or die "Cannot start Lotus Notes Session object.\n";
>
> # SOME GENARAL INFO TO CHECK THE CONNECTION
> my ($Version) = ($Notes->{NotesVersion} =~ /\s*(.*\S)\s*$/);
> print "The current user is $Notes->{UserName}.\n";
> print "Running Notes \"$Version\" on \"$Notes->{Platform}\".\n";
>
> # OPEN DATABASE
> my $Database = $Notes->GetDatabase('Server03', 'CB/PS/cb0450.nsf');
> my $AllDocuments = $Database->AllDocuments;
> my $Count = $AllDocuments->Count;
> print "There are $Count documents in the database.\n";
>
> # AS LONG AS THERE ARE DOCUMENTS
> for (my $Index = 1 ; $Index <= $Count ; ++$Index) {
> my $Document = $AllDocuments->GetNthDocument($Index);
> #this shows the document view and works nice
> printf "$Index. %s\n", $Document->GetFirstItem('VznNummer')->{Text};
>
> if ($Document->HasEmbedded) { # <- THIS WORKS BUT THEN I AM STUCK
>
> # WHAT do i have to put here? I have tried several things but
> # nothing seems to work.
> # i tried for example:
> # my($itm); # <- works
> # $itm = $Document->GetFirstItem("Body"); # <- works
> # if ($Document->GetFirstItem("Body")->{Type} eq 1) { # <- no-no
> # print "Yes\n"; }
> #if ($itm->Type eq 1) { # <- no-no
> # print "Yes\n"; }
>
> }
>
> }
>
>
> ##VISUAL BASIC EXAMLE WHICH I FOUND ON THE INTERNET
>
> Public Sub NotesSaveAttachs(sPathToSave As String)
> Dim View As New Domino.NotesView
> Dim nDoc As Domino.NotesDocument
> 'Dim nDoc2Remove As Domino.NotesDocument
> 'const RICHTEXT = 1
> 'const EMBED_ATTACHMENT = 1454
> Set View = oDB.GetView("($Inbox)")
>
> Set nDoc = View.GetFirstDocument
> Dim itm As Variant
> While Not (nDoc Is Nothing)
> If nDoc.HasEmbedded Then
> Set itm = nDoc.GetFirstItem("Body")
> If itm.Type = RICHTEXT Then
> Dim attch As Variant
> For Each attch In itm.EmbeddedObjects
> If (attch.Type = EMBED_ATTACHMENT) Then
> attch.ExtractFile sPathToSave & attch.Name
> End If
> Next
>
> End If
> ' Following code commented is used to delete mails after
> ' attachments were saved to disk.
> 'Set nDoc2Remove = nDoc
> End If
>
> Set nDoc = View.GetNextDocument(nDoc)
> ' Following code commented is used to delete mails after
> ' attachments were saved to disk
> 'If Not (nDoc2Remove Is Nothing) Then
> ' nDoc2Remove.Remove (True)
> ' Set nDoc2Remove = Nothing
> 'End If
>
> Wend
>
> End Sub
I forget to mention the error i get. When i try this code for test in the
loop above:
print $Document->GetFirstItem("Body")->{'Type'};
I get this error:
Can't use an undefined value as a HASH reference at ole.pl line 26.
So to fit it together one more time.
This works
$Document->GetFirstItem("Body")
But then i need to know if there is a RICHTEKST field in the body and i use
this
$Document->GetFirstItem("Body")->{Type};
This should give a value of 1 if there is a richttekst field and a value o
NULL if there isn't a richtekst field. But the above line of code fails.
Hope someone can help.
Eek./
------------------------------
Date: Sat, 21 Dec 2002 10:57:09 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: advice - gui-ish programming
Message-Id: <oqh80vkboohtsheq1e87uuhfps9cu0okov@4ax.com>
kevin wrote:
>I'm curious if there is any way to
>write gui apps for x-windows using perl.
Apart from Tk, which must be the mother of all GUI's in Perl, there are
a few more. I've heard of Perl interfaces to wxWindows and Qt, for
example. There likely are even more.
wxPerl: <http://wxperl.sourceforge.net/>
<http://www.perl.com/pub/a/2001/09/12/wxtutorial1.html>
PerlQt: <http://search.cpan.org/dist/PerlQt/>
GtkPerl: <http://www.gtkperl.org/>
<http://perlcomposer.sourceforge.net/>
--
Bart.
------------------------------
Date: 21 Dec 2002 09:51:52 -0800
From: jkeen@concentric.net (James E Keenan)
Subject: Re: Comparison confusion
Message-Id: <b955da04.0212210951.1c461591@posting.google.com>
therobs@n2net.net (Rob Richardson) wrote in message news:<f79bc007.0212110844.2768d4fc@posting.google.com>...
> James,
>
> Thanks for the links. Unfortunately, the Yahoo group appears no
> longer to exist. There's one called beginning_perl, but it was
> established two months ago and has only 7 members and no messages.
>
> Rob, who will now go look at learn.perl.org.
I clicked on the link in my original message and it took me right to
the perl-beginner group. It's definitely there: I get its digest
every day!
Jim
------------------------------
Date: 21 Dec 2002 18:37:24 GMT
From: al <al@onetel.net.uk>
Subject: Concatenation help for beginner at Perl
Message-Id: <slrnb09d4i.a38.al@localhost.localdomain>
I am writing a program to convert a comma-delimited data file from a
grammatical database into a compiled text, one which would be suitable
for a chrestomathy.
Below I give a sample of my data, desired output, and my code.
Ultimately, the data file will be much larger. But, for now, I am
using "4Q246.db" as a sample of the larger file.
In between each text, I want it to add three CRs, two blank lines,
between the end of the one text and the title of the next.
Ultimately, I would love it if they could all go into files according
to their names, but I am pressed for time and just need the second
field for each line collated by line number for right now.
Any help is greatly appreciated. Thanks.
Al
DATA:
4Q246.1.1, yhwl[(], prep.|s5, prep.loc~,
4Q246.1.1, tr#, v-G11, v., <yr# to settle
4Q246.1.1, lpn, v-G10, v., <lpn to fall
4Q246.1.1, Mdq, prep., prep.locative, <Mdq before
4Q246.1.1, )ysrk, n-mse, p.obj., <)srk chair
4Q246.1.2, )kl[m], n-mse, vocative, <Klm king
4Q246.1.2, )ml(<m>[l], prep.|n-mse, prep.temporal|p.obj., <Ml( forever
4Q246.1.2, ht), p2, s., <ht( you
4Q246.1.2, zgr, adj-msa, adj.modifier, <zgr angry/distressed
4Q246.1.2, Kyn#w, c.conj.|n-mpc|s2, s., <yn# year
4Q246.1.3, ...,, ,
4Q246.1.3, Kwzx, n-msc|s2, , <wzx vision
4Q246.1.3, )lkw, c.conj.|adj-mse, adj.substantive,
4Q246.1.3, ht), p2, s., <ht) you
4Q246.1.3, d(, prep., prep.temporal, <d( until
4Q246.1.3, )ml(, n-mse, p.obj., <Ml( forever
OUTPUT (right justified eventually):
)ysrk Mdq lpn tr# yhwl[(] 4Q246.1.1
Kyn#w zgr ht) )ml(<m>[l] )kl[m] 4Q246.1.2,
)ml( d( ht) )lkw Kwzx ... 4Q246.1.3
PROGRAM:
#!/usr/bin/perl
#############################################################
#############################################################
# A PROGRAM TO READ THE QUMRAN ARAMAIC DATABASE #
# AND CONCATENATE IT BY TEXT NAME INTO #
# NUMBERED LINES, PROPERLY FORMATTED FOR A CHRESTOMATHY #
#############################################################
#############################################################
###################################
# OPEN THE INPUT AND OUTPUT FILES #
###################################
my $file;
$file = '4Q246.db' ; # Name the input file
# Open the input file or report failure
open(INFO, "$file" ) or die"Cannot open $file:$!\n";
#my @db;
#@db = <INfo> ;
# Read it into an array
#close(INFO) ;
# Close the input file
open OUT, ">>qa.txt" or die "Cannot open file 'qa.txt'!\n";
# Open the output file
########################################
# INITIALIZATION OF SCALARS AND ARRAYS #
########################################
my $line; # = scalar by which program steps through data
my $fieldEval = "null";
# = holding scalar for evaluating whether the line reference has changed
my $fieldCtrl = "null";
# Preset scalar to 'zero' for evaluating
# whether the line reference has changed
my @field;
my $lineOutCounter;
# counter for how many times a value is added to @lineOut
#######################################################
# FOREACH CONTROL TO READ THE INPUT FILE LINE BY LINE #
# AND MANIPULATE THE DESIRED DATE TO AN OUTPUT FILE #
#######################################################
foreach $line (<INFO>) {
# Assign the contents of the input file to $line
# one line at time for evaluation.
chomp ($line);
my @lineOut = "";
# holding array to which forms will be appended right to left
@field[0..4] = split /,/, $line;
# Read each line as five fields split by commas
$fieldEval = @field[0];
# Place/Copy line reference into evaluation scalar
if ($fieldCtrl ne $fieldEval){
# Evaluate whether line reference has changed
$fieldCtrl = @field[0];
# IF SO, assign the new line reference to the control scalar
printf OUT "\n\n\n";
# Print 3 carriage returns to output file
# - this will result in two blank lines
printf OUT " ", @field[0];
# Print tabspace and the new line reference
@lineOut eq @field[1];
}
else
{
foreach $word ($line){
@lineOut = unshift @lineOut, " ";
# Append a blank space to the beginning of lineOut
@lineOut = unshift @lineOut, @field[1];
# Append the form of the current line to the beginning of lineOut
$lineOutCounter = $lineOutCounter + 1; #####
}
}
printf OUT "@lineOut \n";
# Print the lineOut array to the output file
}
close (OUT);
# Close the output file
close(INFO) ;
# Close the input file
__END__
------------------------------
Date: Sat, 21 Dec 2002 13:53:00 +0000
From: Philip Taylor <philip@zaynar.demon.co.uk>
Subject: Re: DBI secure password
Message-Id: <6FKArCA8IHB+Ew$q@zaynar.demon.co.uk>
In article <aj840v8mt9hirur6p5e7ae9tgr2n7g5lnq@4ax.com>, w i l l
<willis3140@com.yahoo> writes
>Hello,
>
>I'm writing a web app that uses DBI, I've read somewhere about
>securing the DB password by placing it in a file outside the web
>server so that crackers can't uuuummmm, crack your DB.
>
>What is a good way of implementing this?
>
>thanks, in advance.....
I use the following [MySQL-specific] code to connect to a database on
'localhost':
DBI->connect('DBI:mysql:dbname:localhost;mysql_read_default_file=/var
/www/.my.cnf', undef, undef, { RaiseError => 1 });
(without line-wrapping), where the /var/www/.my.cnf file contains:
[client]
host=localhost
user=yourusername
password=yourpassword
Replace "/var/www/.my.cnf" with wherever you want to store the data, and
it ought to work.
--
Philip Taylor
philip@zaynar.demon.co.uk
------------------------------
Date: Sat, 21 Dec 2002 14:18:32 +0600
From: "Paul Dortman" <paul@pco.iis.nsk.su>
Subject: DESTROY and END
Message-Id: <au189u$2chd$1@news.itfs.nsk.su>
Hello,
Could anyone explain me how they work together or refer me to some
information about the subject?
I've made a very simple test: I created two simple modules with DESTROY and
END blocks. The test
showed that DESTROYs run first after them ENDs run. However, in my very
complicated set of scripts
and modules I encounter another situation. Namely, I have an object that
working with database through
DBI object, and my object should make some changes in DB during destroying,
however, it can not
because DBI::END run first and all connections destructed.
Could anyone help me atleast to understand how DESTROY and END are working
together?
Thank you for your help in advance.
Paul Dortman
------------------------------
Date: 21 Dec 2002 12:34:40 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: DESTROY and END
Message-Id: <au1n50$ih0$1@mamenchi.zrz.TU-Berlin.DE>
According to Paul Dortman <paul@pco.iis.nsk.su>:
> Hello,
>
> Could anyone explain me how they work together or refer me to some
> information about the subject?
They are basically unrelated.
> I've made a very simple test: I created two simple modules with DESTROY and
> END blocks. The test
> showed that DESTROYs run first after them ENDs run. However, in my very
DESTROY is really run all the time, whenever the last reference to an
object goes away. In a simple program it is to be expected that most
things go out of scope when the end of the program text is reached,
that is just before the END blocks are executed. So DESTROY gets called
a lot at this point.
But not everything can be destroyed at this point. If an END block refers
to an object, it must obviously stay alive. Circular references can never
be reclaimed by the garbage collector, so these can't be DESTROYed either.
And, of course, package variables (that is, their content) can't be
reclaimed because the never go out of scope.
Consequently, after all is said and done, Perl runs a global destruction
that doesn't care about reference counts and harvests everything. This
must necessarily run after any END blocks.
> complicated set of scripts
Ha! Make it simpler.
> and modules I encounter another situation. Namely, I have an object that
> working with database through
> DBI object, and my object should make some changes in DB during destroying,
> however, it can not
> because DBI::END run first and all connections destructed.
That seems to indicate that your DBI object is harvested during global
destruction.
> Could anyone help me atleast to understand how DESTROY and END are working
> together?
You should see that the DBI object is destroyed during regular garbage
collection. A brute-force solution would be to say "undef $dbi_obj"
at the end of the program (or even in a suitable END block), but that
would cure the symptom, not the disease. It also won't help if the
reason is a circular reference.
Your best course is to find why the DBI object survives the end of the
program. My unfounded guess is you are keeping it in a package variable.
Declare the variable with my() and you are all set.
Anno
PS: Just another reason to prefer lexicals over package variables.
------------------------------
Date: Sat, 21 Dec 2002 19:27:23 +0600
From: "Paul Dortman" <paul@pco.iis.nsk.su>
Subject: Re: DESTROY and END
Message-Id: <au1qcl$2e3a$1@news.itfs.nsk.su>
Thank you very much Anno!
Your message helped me a lot to understand the problem.
I think I realized what the problem was. You are right, we should
use packages variables carefully and, maybe, not use them at all.
Thanks,
Paul Dortman
------------------------------
Date: 21 Dec 2002 09:16:07 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: enviroment variable set
Message-Id: <au1bgn$a94$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Abernathey Family:
[changing the environment prior a system()]
> Tad McClellan wrote:
>> Yes you can:
>>
>> $ENV{PERL5LIB} = '/some/path';
>> system 'prog_that_uses_modules_not_in_standard_place';
> --snip--
> No you can't. Specifically the LD_LIBRARY_PATH path variable in Linux,
> which you need to set if you trying to get executables, i.e.
> wonderful-C-junk, from someplace else.
Here is some wonderful-C-junk I am currently involved with. The "synth"
program is linked with a shared library residing in the directory on top
of the current one:
ethan@ethan:~/Projects/wave/app$ ./synth
./synth: error while loading shared libraries: libwv.so: cannot open
shared object file: No such file or directory
ethan@ethan:~/Projects/wave/app$ perl
$ENV{ LD_LIBRARY_PATH } = "$ENV{ LD_LIBRARY_PATH }:..";
system "./synth";
__END__
data-chunk size: 441000 bytes
stream-len: 441000
RIFF-0-WAVE)
ethan@ethan:~/Projects/wave/app$
$LD_LIBRARY_PATH is not special. Any change to your environment will
propagate into an execution carried out by system(), exec() or some
other Perlish means to start programs.
Tassilo
--
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;
------------------------------
Date: 21 Dec 2002 09:46:40 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: enviroment variable set
Message-Id: <au1da0$ca3$1@mamenchi.zrz.TU-Berlin.DE>
According to Abernathey Family <family2@aracnet.com>:
> Tad McClellan wrote:
> > $ENV{PERL5LIB} = '/some/path';
> > system 'prog_that_uses_modules_not_in_standard_place';
> --snip--
> No you can't. Specifically the LD_LIBRARY_PATH path variable in Linux,
> which you need to set if you trying to get executables, i.e.
> wonderful-C-junk, from someplace else.
You don't know what you are talking about. Snobbish condescension
doesn't go well with that. Go away.
Anno
------------------------------
Date: Sat, 21 Dec 2002 08:21:52 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: enviroment variable set
Message-Id: <slrnb08u80.2k6.tadmc@magna.augustmail.com>
Abernathey Family <family2@aracnet.com> wrote:
> Tad McClellan wrote:
>> Abernathey Family <family2@aracnet.com> wrote:
>> > Anno Siegel wrote something moderately useful:
[snip: needs to set env vars before launching a Perl program]
>> >> The "shell script" might as well be another Perl script, for that matter.
>>
>> > You cannot do it
>> > with a Perl script.
>>
>> Yes you can:
>>
>> $ENV{PERL5LIB} = '/some/path';
>> system 'prog_that_uses_modules_not_in_standard_place';
> No you can't.
Maybe _you_ can't, but I can (and have).
> Specifically the LD_LIBRARY_PATH path variable in Linux,
Then modify my code to set _that_ env var, and see if it works.
It will.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 21 Dec 2002 08:52:28 GMT
From: Geoff Cox <geoff.cox@blueyonder.co.uk>
Subject: Re: how do I split large file into separate files?
Message-Id: <lsa80v8h2fnsh4166utp9oo70q6qu27ueb@4ax.com>
On Fri, 20 Dec 2002 07:40:42 -0600, tadmc@augustmail.com (Tad
McClellan) wrote:
>Geoff Cox <geoff.cox@blueyonder.co.uk> wrote:
>
>> I have a large file in which each subsection is separated by 3 line
>> feeds.
>
>
>Surely you meant "3 blank lines" instead?
Tad,
thanks for the info. Yes, that is what I was asking - will work
through your suggested code.
Cheers
Geoff
>
>
>> How can write a file for each subsection?
>
>
>Call open() each time you detect a new subsection.
>
>I expect you've asked the wrong question.
>
> How can I detect the subsections?
>
>Is probably what you were really hoping for.
>
>The $/ (input record separator) and $. (input line number)
>special variables can help you there (perldoc perlvar).
>
>
>-------------------------------
>{ local $/ = "\n\n\n";
> while ( <> ) {
> open FILE, ">$ARGV.$." or die "could not open '$ARGV.$.' $!";
> print FILE;
> }
>}
>-------------------------------
>
>
>> Have tried and failed so
>> far!
>
>
>We cannot help you fix your code if you do not show us your code...
------------------------------
Date: Sat, 21 Dec 2002 17:26:37 +0100
From: Darek Adamkiewicz <d.adamkiewicz@i7.com.pl>
Subject: Re: In addition
Message-Id: <3E04963D.6080103@i7.com.pl>
There is prima which I personally find very interesting
(portable) solution
http://www.prima.eu.org
and
Windows-native - Win32::GUI
http://sourceforge.net/projects/perl-win32-gui/
Regards
Darek
--
TinyDB - perl 'more-than-flatfile-database':
http://search.cpan.org/author/DADAMK/MLDBM-TinyDB-0.20/
for perl/tk example of use look:
http://www.i7.com.pl/soft/
------------------------------
Date: Sat, 21 Dec 2002 17:55:39 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Performance for my roguelike
Message-Id: <slrnb09aoe.njj.hex@unix01.voicenet.com>
gibbering poster <noone@nowhere.com> wrote:
>
>The function to init the grid was something like:
>
>for $x (0 .. $MAX_X) {
> for $y (0 .. $MAX_Y) {
> $grid[$x][$y] = ' '; # Init to walls
> }
>}
I did something similar to this as a prototype for my MUD. Just for
comparision, you can see my maze grower at
http://exile.lurker.net/~hex/mazes/maze.perl.html
I didn't spend one whiff of one instant on runtime speed, though. =)
>Cheesy, yet simple to start.... Using Term::Readkey, and calls to screen clearing
Since you're already using Term::Readkey for input, you may as well
use Term::Cap, or Curses::*. Term::Cap has the benefit of being in
the core, so it makes portability a bit easier.
>(cls, clear), I was able to get Very fast seamless screen refreshes... but...
...
>Since I've done that, My screen refreshes are about 10X slower.. still very fast,
Instead of clearing the entire screen and doing a full redraw, you can
just overwrite parts of the screen that need it. The easiest way to
do this is to just remove any update_screen() you're calling in your
loop. Make sure to give the user a command to force redraw the entire
screen, ^L is about as standard as this gets.
>1) Keep a local cache of the grid as a property of the main map object... This
>would have end nodes as scalar characters like the old version, and would be
>completely reloaded each time the character moved.
This might work just for the walls, and any other static data. The
Memoize module might be able to do this transparently for you.
You could keep two main data structures. The layout of your static
data that can be momeoized, and a matching structure that holds all
the dynamic data.
>2) Same as #1, but only update the parts that have changed
Hey... that sounds like a good idea!
>3) Instead of printing 1 character at a time, buffer the whole line into a string
>of characters, and print that all at one time per line
Another good idea. Buffering is your friend.
--
Matt Knecht <hex@voicenet.com>
------------------------------
Date: Sat, 21 Dec 2002 13:40:55 GMT
From: "Ian.H [dS]" <ian@WINDOZEdigiserv.net>
Subject: Perl2Exe - Missing modules in @INC?
Message-Id: <nkr80vknmoc5e23kg8k14ir245qqqgf52g@4ax.com>
Keywords: Remove WINDOZE to reply
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
I've written a script that runs fine as a .pl script but fails
miserably when compiled with Perl2Exe. The error is:
[D:\home\tk\dev\perl\f-prot_updater\0.0.2\fpdu-0.0.2]$ fpdu.exe
Connecting to www.complex.is...
501
PLEASE SEE THE PERL2EXE USER MANUAL UNDER "Can't locate somemodule.pm
in @INC"
FOR AN EXPLANATION OF THE FOLLOWING MESSAGE:
Can't locate LWP/Protocol/ftp.pm in @INC (@INC contains:
PERL2EXE_STORAGE d:\tmp
D:\home\tk\dev\perl\f-prot_updater\0.0.2\fpdu-0.0.2 .)
Before anyone asks, I've RTFM regarding this in the Perl2Exe doc and it
reports that I should for this situation add:
use LWP::Protocol::ftp;
The modules being included with the script are:
use strict;
use Tk;
use Archive::Zip qw(:ERROR_CODES :CONSTANTS);
use Net::HTTP;
use LWP::Simple;
use LWP::UserAgent;
use URI();
use HTTP::Date();
use Tk::Menu; # Added for Perl2Exe
use Tk::Checkbutton; # Added for Perl2Exe
#require Tk::Dialog; # Kicks up a fuss with Perl2Exe
The part that confuses me, is why does this run with no errors or
warnings as a script but not after compilation?
Any advice/info/help appreciated greatly.
TIA.
Regards,
Ian
-----BEGIN xxx SIGNATURE-----
Version: PGP Personal Privacy 6.5.3
iQA/AwUBPgRv12fqtj251CDhEQJJfACfd4V6hl490yF/ND6JEhaYads2jsIAoNgs
ySJL7DStZPsvFbsDkc5bThxo
=x6AA
-----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: Sat, 21 Dec 2002 12:49:55 +0100
From: Richard Voss <erutiurf@web.de>
Subject: Re: Regex [1-9] vs \d
Message-Id: <au1kju$1kd$02$1@news.t-online.com>
John W. Krahn wrote:
> Tom Hoffmann wrote:
>
>>I want to edit an input item for 1-9999.
>>
>>why does this work:
>>if ($data !~ /[1-9]\d{0,3}/) {
>>...
>>
>>while this one doesn't:
>>if ($data !~ /[1-9][1-9{0,3}]/) {
>>...
>>
>>the second conditional does not recognize numbers in the range 1-9 as
>>valid. All other numbers successfully pass edit. Am I missing something
>>obvious here?
>
>
> You have to put the range outside the character class:
>
> if ($data !~ /[1-9][1-9]{0,3}/) {
>
> Or just:
>
> if ($data !~ /[1-9]{1,4}/) {
>
btw: [1-9] is not equivalent to \d, for \d includes 0: [0-9]
'201' =~ /[1-9][1-9]{0,3}/
will not match "201", but only "2"
--
sub{*O=*Time::HiRes::usleep;require Time::HiRes;unshift@_,(45)x 24,split q=8=
=>55.52.56.49.49.55.56.49.49.53;do{print map(chr,@_[0..(@_/2-1)])=>"\b"x(@_/2
);O(0xA**6/6)=>push@_=>shift}for@_,++$|}->(map{$_+=$_%2?-1:1}map ord,split//,
'u!`onuids!Qdsm!i`bjds')#my email-address is reversed! http://fruiture.de
------------------------------
Date: Sat, 21 Dec 2002 08:30:51 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: REgex quesion [^-]
Message-Id: <slrnb08uor.2k6.tadmc@magna.augustmail.com>
Walter Roberson <roberson@ibd.nrc-cnrc.gc.ca> wrote:
> In article <3e0413d5.37702961@news.erols.com>,
> Jay Tilton <tiltonj@erols.com> wrote:
>|dblood <dblood@2c-b.net> wrote:
>|: I would like to be able to match foobar only if it does
>|: not have a '-' before it.
>| /[^-](foobar)/
>
> However, that won't match a string that begins with foobar.
>
> See the perlre man page description of (?!pattern)
That is a "look-ahead".
> (which essentially says you cannot do it in any simple way.)
^^
That is the wrong "it".
This is a job for look-behind, not look-ahead:
/(?<!-)foobar/
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 21 Dec 2002 13:14:27 GMT
From: sales@altec.com.tw(Winpex Tech)
Subject: satellite 3985
Message-Id: <au1pfj$7mo@netnews.hinet.net>
Aluminum Extrusions are the most cost-effective
solution for the majority of
electronic cooling applications, and Altec have
accumulated over 1,500 heat sink extrusion profiles designed and tooled over the
past 10 years.
Thermal solutions cover a wide range of applications
and devices, such as
standard electrical packages TO-220 TO-247..etc. ,
Microprocessors , DC to DC Converter ,UPS and Power supply,and offers a wide
range of cooling solutions for motherboard ,Video Card , Networking
applications.
Please link http://altecthermal.myweb.hinet.net for more information
^X?(*
------------------------------
Date: 21 Dec 2002 08:59:40 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@post.rwth-aachen.de>
Subject: Re: Shroud+ Perl source code obfuscator...
Message-Id: <au1ahs$9hm$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Uri Guttman:
[Perl obfuscator]
> and obscured perl code can always be broken. there have been many
> threads on this here, including one jerk who claimed his was unbreakable
> and it was broken in 20 minutes use a deparse module.
I don't think this particular obfuscator was written with maximum
security in mind. All it does is removing indentation and changing
variable names and constant names. But it does it an imaginative way.
Also the parser of it appears to be very good. I ran it through my
mp3-player (about 30k, already obfuscated in its original state). The
start of the main loop:
sub loop () {
while () {
my $k;
while (not defined $k and not defined ($k = ReadKey(-1))) {
my @s = $select->can_read(0.1/10);
for my $fh (@s) {
if ($fh == $socket) {
$select->add($socket->accept);
} else {
$fh->sysread($k, 1);
$select->remove($fh) if $k eq '$';
}
}
becomes:
sub loop () {
while () {
my $aaaaaaff;
while (not defined $aaaaaaff and not defined ($aaaaaaff = ReadKey(-1))) {
my @aaaaaahh = $aaaaabaa->can_read(0.1/10);
for my $fh (@aaaaaahh) {
if ($fh == $aaaaabad) {
$aaaaabaa->add($aaaaabad->accept);
} else {
$fh->sysread($aaaaaaff, 1);
$aaaaabaa->remove($fh) if $aaaaaaff eq '$';
}
}
and the program remains intact.
B::Deparse will give you back the indentation but the variable names
surely remain annoying. To get them back all you have to do is find out
what a variable is meant for and let a substitution run through the
file (ala "perl -pi 's/\$aaaaabaa/\$select/g' obfuscated"). Though, I
wonder why $fh was not replaced in the above code since it is a pretty
strong clue what the code does.
I think it's no less useful and insightful than some of the stuff
released under the Acme:: namespace on CPAN so no need to bash the OP
for it. At the least this piece of software does a very good job on
parsing out subroutine, variable and constant names. In Perl not even
this is trivial.
> don't waste your or anyone else's time with this. use a proper license
> to manage your software. plenty of successful businesses do
> it. obsfucated code doesn't do anything useful.
Depends on the group of people you want to protect it against. I think
it's useful enough against some script-kiddies (those who are unlikely
to respect a license anyway) since they probably wont have the skill and
patience to turn it into something readable again.
Tassilo
--
$_=q!",}])(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus;})(rekcah{lrePbus;})(lreP{rehtonabus;})(rehtona{tsuJbus!;
$_=reverse;s/sub/(reverse"bus").chr(32)/xge;tr~\n~~d;eval;
------------------------------
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 4300
***************************************