[30320] in Perl-Users-Digest
Perl-Users Digest, Issue: 1563 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 21 14:09:44 2008
Date: Wed, 21 May 2008 11:09:07 -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, 21 May 2008 Volume: 11 Number: 1563
Today's topics:
Do I want modules? If not, what? <justin.0805@purestblue.com>
Re: Do I want modules? If not, what? <bill@ts1000.us>
Re: Do I want modules? If not, what? <justin.0805@purestblue.com>
Re: Example for open3 on windows? <zentara@highstream.net>
finding & saving accented (unicode) chars with perl 5.6 <jcmmat@gmail.com>
Re: How to determine if a word has an extended characte <JustMe@somewhere.de>
Re: import CSV files to Excel <benkasminbullock@gmail.com>
Out of memory! Yet ... <alexxx.magni@gmail.com>
Re: Out of memory! Yet ... <1usa@llenroc.ude.invalid>
Re: Out of memory! Yet ... <slick.users@gmail.com>
Re: PerlNET 7.2.0 build 284799 compile error <arlie.c@gmail.com>
Re: PerlNET 7.2.0 build 284799 compile error <arlie.c@gmail.com>
Re: Regexp: non greedy? <oli.meister@gmail.com>
Re: script to find the files with very long names <nospam-abuse@ilyaz.org>
Re: script to find the files with very long names <jurgenex@hotmail.com>
Re: select ethernet card for socket? <swest@gmx.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 21 May 2008 09:54:41 -0000
From: Justin C <justin.0805@purestblue.com>
Subject: Do I want modules? If not, what?
Message-Id: <43e4.4833f161.8576@zem>
I'm trying to modularise out web-site, it's mostly CGI (perl) apart from
two or three static HTML pages. What I want is a perl script which calls
a header, top-bar navigation, left panel, page body, right panel. And
each of those sections to be separate perl programs which can be edited
independantly of the main 'index.cgi'. It is a requirement that I can
pass some info (variables, arrays, hashes) between the main and each of
the 'modules'.
I'm not entirely certain that modules are what I want. I've looked at
'require', and this works well for static html using here-doc, but I
need to run perl to act upon certain variables from the main program.
Reading perldoc perlmod doesn't help much, it talks mostly about
scoping. If modules are where I should be going, I need some info on how
to write my own.
I've got to where I am from starting to use WordPress, and building my
own theme, the main part of the code works as above, very simple 'main',
calling the relevant parts which stand alone, and it works very
well, and is very simple to maintain. The only problem is it's PHP, and
I'm far from profficient (not that I'm any good with perl, I'm just much
further along the perl road).
Thank you for any suggestions or pointers you can give with regard to
the above.
Justin.
--
Justin C, by the sea.
------------------------------
Date: Wed, 21 May 2008 04:02:46 -0700 (PDT)
From: Bill H <bill@ts1000.us>
Subject: Re: Do I want modules? If not, what?
Message-Id: <ddf7ff66-3244-4b0e-a992-113244881742@j22g2000hsf.googlegroups.com>
On May 21, 5:54=A0am, Justin C <justin.0...@purestblue.com> wrote:
> I'm trying to modularise out web-site, it's mostly CGI (perl) apart from
> two or three static HTML pages. What I want is a perl script which calls
> a header, top-bar navigation, left panel, page body, right panel. And
> each of those sections to be separate perl programs which can be edited
> independantly of the main 'index.cgi'. =A0It is a requirement that I can
> pass some info (variables, arrays, hashes) between the main and each of
> the 'modules'.
>
> I'm not entirely certain that modules are what I want. I've looked at
> 'require', and this works well for static html using here-doc, but I
> need to run perl to act upon certain variables from the main program.
>
> Reading perldoc perlmod doesn't help much, it talks mostly about
> scoping. If modules are where I should be going, I need some info on how
> to write my own.
>
> I've got to where I am from starting to use WordPress, and building my
> own theme, the main part of the code works as above, very simple 'main',
> calling the relevant parts which stand alone, and it works very
> well, and is very simple to maintain. The only problem is it's PHP, and
> I'm far from profficient (not that I'm any good with perl, I'm just much
> further along the perl road).
>
> Thank you for any suggestions or pointers you can give with regard to
> the above.
>
> =A0 =A0 =A0 =A0 Justin.
>
> --
> Justin C, by the sea.
Though you description is a little vague, I believe what you mean by
modules is, should all the code that handles left panel be in one
module, page body in another etc and then have a main program that
"requires" the modules based on what is needed. If this is what you
mean, I have used this method many times since there was a lot of code
that they all had in common in the main program. On the other hand, if
there is not a lot of code they have in common and they all make use
of various "subs" you can go the other way and put all your common
code in a "required" module and then have different program for each
part of the page, I have done this too.
My experience has been using the latter with different programs and a
common module (or modules) is easier to work with and expand on (ie
add something to the web site, create a new program for it using the
common stuff and custom code). Also you do not have to worry if your
new stuff effects the old stuff as you would in the former method of a
single program and mutliple modules.
Bill H
------------------------------
Date: Wed, 21 May 2008 11:37:42 -0000
From: Justin C <justin.0805@purestblue.com>
Subject: Re: Do I want modules? If not, what?
Message-Id: <4f4b.48340986.31366@zem>
On 2008-05-21, Bill H <bill@ts1000.us> wrote:
>
[snip]
> Though you description is a little vague, I believe what you mean by
> modules is, should all the code that handles left panel be in one
> module, page body in another etc and then have a main program that
> "requires" the modules based on what is needed. If this is what you
> mean, I have used this method many times since there was a lot of code
> that they all had in common in the main program. On the other hand, if
> there is not a lot of code they have in common and they all make use
> of various "subs" you can go the other way and put all your common
> code in a "required" module and then have different program for each
> part of the page, I have done this too.
>
> My experience has been using the latter with different programs and a
> common module (or modules) is easier to work with and expand on (ie
> add something to the web site, create a new program for it using the
> common stuff and custom code). Also you do not have to worry if your
> new stuff effects the old stuff as you would in the former method of a
> single program and mutliple modules.
That sounds quite interesting. And, I think it's more like WordPress
does it, IIRC (not that I want to necessarily mimic their method). I'll
have a play around, thanks for the suggestion.
I do need to get my head around writing my own modules at some point
though!
Justin.
--
Justin C, by the sea.
------------------------------
Date: Wed, 21 May 2008 07:58:15 -0400
From: zentara <zentara@highstream.net>
Subject: Re: Example for open3 on windows?
Message-Id: <h03834t6ntie8qefpu2hm1prb7qkrnbken@4ax.com>
On Tue, 20 May 2008 10:10:04 -0700, "szr" <szrRE@szromanMO.comVE> wrote:
>zentara wrote:
>>>
>>> Does open3 work on windows? If yes: How can I use it to forward all
>>> input/output channels to files?
>>>
>>> Thanks in advance
>>
>> open3 uses pipes to open the filehandles, but Win32 dosn't
>> handle pipes well,
>
>Could you please elaborate on what you mean by, "doesn't[sic] handle
>pipes well" ?
In win32, select won't work reliably on pipes, and you need select's
can_read method to know when there is output available in the pipe.
>
>I find under 2000 and XP I can use pipes just as I can in a Linux/UNIX
>environment.
>
>E.G. :
>
> ls -l | egrep "^d" | sort
> some_program_with_lots_of_output | more
> grep "1.2.3.4" access_log | tail -n 25
> ls -l long_dir | less
>
>(Note that some of these examples use Win32 ports of Linux uilities like
>grep, sort, ls, tail, less... etc, which I use on all my Windows systems
>so I can things in a similar manner on either win or nix :-) )
Those are pipes used in a different context, since the commands close,
and thus flush the pipe.
You can use pipes, but IPC::Open3 needs select to know when the
pipes have readable data.
If you watch carefully, you may see IPC::Open3's output when you close
the program or filehandle, which will cause it to flush.
See
http://perlmonks.org?node_id=621058
for an explanation.
The is the Win32::Pipe and Win32::IPC modules which help.
zentara
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
------------------------------
Date: Wed, 21 May 2008 04:57:15 -0700 (PDT)
From: "jcmmat@gmail.com" <jcmmat@gmail.com>
Subject: finding & saving accented (unicode) chars with perl 5.6.1
Message-Id: <e94b4949-5249-4bfe-842f-e426d7f24790@z72g2000hsb.googlegroups.com>
Hello fellow perl addicts,
I have following issue :
I want to find words containing accented chars,
based on a simple regex having a placeholder for the accented chars
I read everywhere that perl internally is fully unicode, so this
should be no problem
however my query doesn't work
setup :
given a list of words with '?' symbols (the chars to look for in a ref
list) "@AllQstLines" &
a reference list of correct accented words "@AllRefLines"
#### Begin code
foreach $wrd (@AllQstLines)
{
# Bir?ebbuga <----- example of a $qst
next if ($wrd !~ /\?/); # skip if no unknow/illegal chars
next if ($WrdSeen{$wrd});# skip if allready in replace list
$WrdSeen{$wrd}=3D1;
$wrd =3D~ s/\?/\./g; chomp($wrd);
$found=3D0;
@Matches=3Dgrep /$wrd/, @AllRefLines;
foreach $match (@Matches)
{
$match =3D~ /$wrd/; $correct=3D $&;
print "DBG: $wrd, $correct\n";
$Correction{$wrd}=3D$correct;
$found=3D1;
last if ($found); ## only consider first match
}
if (!$found) {print "DBG: $wrd, NOTHING FOUND\n";}
}
#### End code
The problem : in this way the ?ejtun never matches the reference
"=C5=BBejtun"
neither does Lu?ija seem to match "Lu=C4=8Bija"
what am I doing wrong ?
thx in advance
kind regards
jc
------------------------------
Date: Wed, 21 May 2008 12:51:31 +0200
From: Hartmut Camphausen <JustMe@somewhere.de>
Subject: Re: How to determine if a word has an extended character?
Message-Id: <MPG.229e12765ae471df989685@news.t-online.de>
In <<89JYj.3989$KB3.3516@edtnps91>> schrieb John W. Krahn...
> > $string =3D~ m/[^\w]/ ? print "\nhas extended." : print "\nOK.";
>=20
> [^\w] is usually written as \W.
You are right. But I chose this notation to make it easy to expand the=20
list of characters not to match on (Ben B., your crystal ball worked=20
well :-)
> From perlre.pod:
>=20
> <QUOTE>
> If "use locale" is in effect, the list of alphabetic characters=20
> generated by "\w" is taken from the current locale. See perllocale.
> </QUOTE>
>=20
> In other words, if your locale supports it then '=E9' will be included in=
\w.
Arrgh. Right again. Well, I never 'use locale'... and so didn't even=20
think of it.
I'll consider this in my future posts (hopefully).
> > If you want to exclude the '_' (contained in \w), use [^a-zA-Z0-9]
>=20
> [^a-zA-Z0-9] means any character that is *not* alphanumeric. You=20
> probably meant [a-zA-Z0-9].
Not quite.=20
Maybe the term 'exclude' is a bit misleading; I wanted to say 'exlude=20
from list of characters NOT to match on'. That is, [^\w] won't match on=20
'_', while [^a-zA-Z0-9] will, making '_' an 'extended' charakter.
Thanks for your hints anyway.
mfg, Hartmut
--=20
------------------------------------------------
Hartmut Camphausen h.camp[bei]textix[punkt]de
------------------------------
Date: Wed, 21 May 2008 07:16:55 +0000 (UTC)
From: Ben Bullock <benkasminbullock@gmail.com>
Subject: Re: import CSV files to Excel
Message-Id: <g10i96$ncq$1@ml.accsnet.ne.jp>
On Tue, 20 May 2008 22:28:45 -0700, Slickuser wrote:
> $Excel = Win32::OLE->new('Excel.Application', 'Quit') || die "Can't
> create Excel object \n";
> $Excel->{'Visible'} = 0; #0 is hidden, 1 is visible
> $Excel->{DisplayAlerts}= 0; #0 is hide alerts
It's probably better not to do this until the program is debugged. If you
start the Excel process as invisible, then if something goes wrong you are
left with lots of Excel processes running in the background.
> $Excel->{SheetsInNewWorkbook} = 0;
>
> $CSV = Win32::OLE->new('Excel.Application', 'Quit') || die "Can't
> create Excel object \n";
Why do you need to start two Excel processes? This seems crazy to me. You
should use the same Excel process. Also you should usually check if Excel
is already running and attach to the running process via
Win32::OLE->GetActiveObject.
> $CSV->{'Visible'} = 0; #0 is hidden, 1 is visible
> $CSV->{DisplayAlerts}= 0; #0 is hide alerts
>
> $Workbook = $Excel->Workbooks->Add();
> $Workbook->SaveAs($fileOutput) or die $!;
This $! is a mistake. If SaveAs fails, the error message won't be in $!,
which probably contains a blank string. Instead it will available
via Win32::OLE->LastError(). So you should say
die Win32::OLE->LastError();
> foreach my $filename (sort(@csvFile))
> {
> $filename =~ s/\\/\//g;
> my @tempFile = split(/\//,$filename);
> my @sheetName = split(/\./,$tempFile[scalar(@tempFile)-1]);
It's a bit of a mess.
> $CSV_WB = $CSV->Workbooks->Open($filename);
> $CSV_WB->ActiveSheet->Range("A1:Z$MAX_ROW")->Select;
> $CSV_WB->Copy;
> $Workbook->Worksheets->Add( {after => $Workbook
> ->Worksheets($Workbook->Worksheets->{count})} );
> $CurrentSheet = $Workbook->ActiveSheet;
> $CurrentSheet->{Name} = $sheetName[0];
You can get the same result with
if ($filename =~ /\\([^\\]*)\..*?$/) {
$CurrentSheet->{Name} = $1;
} else {
print "Bad file name $filename.\n";
# skip this name.
}
or you can use a CPAN module such as File::BaseName.
> $Workbook->ActiveSheet->Paste();
Assuming this works (I haven't tested it), what you're doing is taking
data from one Excel process and putting it into another Excel process via
a Perl process, which probably explains why it's slow. Win32::OLE basically
is slow, and so it's better to not do things like this. You should start
just one Excel process and automate the transfer of data between different
workbooks using Perl.
------------------------------
Date: Wed, 21 May 2008 08:08:52 -0700 (PDT)
From: "alexxx.magni@gmail.com" <alexxx.magni@gmail.com>
Subject: Out of memory! Yet ...
Message-Id: <e84cae72-e396-40a6-beec-4bad5aa3d615@d77g2000hsb.googlegroups.com>
I am having trouble running my script, which stops with an "Out of
memory!" error.
But what I find unusual is that it stops as soon as the "Free" memory
reported by the <free> utility goes to zero - without even starting to
touch the free swap memory (and I have 2GB swap).
I hope to receive some help...
ulimit -a reports this:
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 65536
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 65536
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
... so it doesnt seem a ulimit problem, right?
The memory-eating line is this:
for $i(1..$n)
{
for $y(1..$ny)
{ for $x(1..$nx) { $AAA[$i][$x][$y]=$a[3+$nx*($y-1)+$x] } }
print("\n$i>\ttotal size: ",total_size($AAA));
}
where for $n times I read a grayscale image in @a, then assign its
value to $AAA[][][].
BTW, as you can see I try to use Devel::Size to check how big becomes
$AAA, but it always answers "12". WTF? I could accept it if it was
"42", but "12", come on...
thanks for any info....
Alessandro Magni
------------------------------
Date: Wed, 21 May 2008 16:11:17 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Out of memory! Yet ...
Message-Id: <Xns9AA57BFA2CC9Easu1cornelledu@127.0.0.1>
"alexxx.magni@gmail.com" <alexxx.magni@gmail.com> wrote in
news:e84cae72-e396-40a6-beec-4bad5aa3d615@d77g2000hsb.googlegroups.com:
> I am having trouble running my script, which stops with an "Out of
> memory!" error.
> But what I find unusual is that it stops as soon as the "Free" memory
> reported by the <free> utility goes to zero - without even starting to
> touch the free swap memory (and I have 2GB swap).
How much physical memory do you have and what OS are you on? Does it
actually support more than 2GB addressable memory space?
> The memory-eating line is this:
> for $i(1..$n)
> {
> for $y(1..$ny)
> { for $x(1..$nx) { $AAA[$i][$x][$y]=$a[3+$nx*($y-1)+$x] } }
> print("\n$i>\ttotal size: ",total_size($AAA));
> }
The only information this snippet conveys is that you write code that is
hard to read. Crucial information such as the values of $n and $nx is
missing.
> where for $n times I read a grayscale image in @a, then assign its
> value to $AAA[][][].
How large is the image? You are basically holding two copies of the
image in memory. Plus, you have the overhead of a multilevel data
structure.
Even if you did not run out of memory, this smells. Without knowing any
details, it is hard to say definitely that what you are doing is wrong,
but I would have constructed the AoAoA in $AAA step by step while
reading the data.
> BTW, as you can see I try to use Devel::Size to check how big becomes
How can we see that? Because you have total_size? Without the use
statement being shown total_size could be any function.
> $AAA, but it always answers "12". WTF? I could accept it if it was
> "42", but "12", come on...
Who knows what is going on. Please read the posting guidelines and try
to reduce the problem to the smallest script possible.
As for overhead, note the following:
E:\Home> cat t.pl
#!/usr/bin/perl
use strict;
use warnings;
use Devel::Size qw( total_size );
my @AAA = ( 1 .. 6 );
my $AAA = [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 5, 6 ] ] ];
print join( "\n", total_size(\@AAA), total_size($AAA) ), "\n";
__END__
E:\Home> t
224
684
The multilevel data structure takes up 200% more space than the simple
array.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)
comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
------------------------------
Date: Wed, 21 May 2008 09:13:25 -0700 (PDT)
From: Slickuser <slick.users@gmail.com>
Subject: Re: Out of memory! Yet ...
Message-Id: <8fb9097b-da4b-4068-85b3-3ba72b221e92@c65g2000hsa.googlegroups.com>
What's the size for $i,$x,$y?
On May 21, 8:08 am, "alexxx.ma...@gmail.com" <alexxx.ma...@gmail.com>
wrote:
> I am having trouble running my script, which stops with an "Out of
> memory!" error.
> But what I find unusual is that it stops as soon as the "Free" memory
> reported by the <free> utility goes to zero - without even starting to
> touch the free swap memory (and I have 2GB swap).
>
> I hope to receive some help...
>
> ulimit -a reports this:
> core file size (blocks, -c) 0
> data seg size (kbytes, -d) unlimited
> scheduling priority (-e) 0
> file size (blocks, -f) unlimited
> pending signals (-i) 65536
> max locked memory (kbytes, -l) 32
> max memory size (kbytes, -m) unlimited
> open files (-n) 1024
> pipe size (512 bytes, -p) 8
> POSIX message queues (bytes, -q) 819200
> real-time priority (-r) 0
> stack size (kbytes, -s) 10240
> cpu time (seconds, -t) unlimited
> max user processes (-u) 65536
> virtual memory (kbytes, -v) unlimited
> file locks (-x) unlimited
>
> ... so it doesnt seem a ulimit problem, right?
>
> The memory-eating line is this:
> for $i(1..$n)
> {
> for $y(1..$ny)
> { for $x(1..$nx) { $AAA[$i][$x][$y]=$a[3+$nx*($y-1)+$x] } }
> print("\n$i>\ttotal size: ",total_size($AAA));
>
> }
>
> where for $n times I read a grayscale image in @a, then assign its
> value to $AAA[][][].
>
> BTW, as you can see I try to use Devel::Size to check how big becomes
> $AAA, but it always answers "12". WTF? I could accept it if it was
> "42", but "12", come on...
>
> thanks for any info....
>
> Alessandro Magni
------------------------------
Date: Wed, 21 May 2008 00:12:37 -0700 (PDT)
From: Arlie <arlie.c@gmail.com>
Subject: Re: PerlNET 7.2.0 build 284799 compile error
Message-Id: <a73723db-319b-4907-bee2-9d7cc27348b6@k10g2000prm.googlegroups.com>
Here's a shorter example:
#
# Hello.pl
#
use namespace "System";
#use namespace "System.Windows.Forms";
use PerlNET qw(AUTOCALL);
Console->WriteLine("Hello from Perl!");
"System.Console"->WriteLine("Hello");
System::Console->WriteLine("Hello");
System::Windows::Forms::MessageBox->Show("Hello World!\n(Part II)");
Compiled OK but got this at run-time:
Hello from Perl!
Hello
Hello
System.ApplicationException: Can't locate type
System.Windows.Forms.MessageBox
at PerlRuntime.Interpreter.GetType(Int32 x, String klass)
at PerlRuntime.Interpreter.call_static(Int32 x, Int32 klass_, Int32
method_, Int32 args_, Int32& e, Int32& rt)
Please help!
------------------------------
Date: Wed, 21 May 2008 00:36:22 -0700 (PDT)
From: Arlie <arlie.c@gmail.com>
Subject: Re: PerlNET 7.2.0 build 284799 compile error
Message-Id: <a2d17818-6b87-48d4-a546-6d28ada50ae1@q24g2000prf.googlegroups.com>
Found the solution here:
http://aspn.activestate.com/ASPN/Mail/Message/perl.net/766228
------------------------------
Date: Wed, 21 May 2008 10:11:51 -0700 (PDT)
From: Oliver <oli.meister@gmail.com>
Subject: Re: Regexp: non greedy?
Message-Id: <31dbc1ed-5012-4ba2-81a8-ddd88dbbcbae@m73g2000hsh.googlegroups.com>
=2E..
>
> The ? above is the "1 or 0 quantifier", not the greedy modifier, as it doe=
s
> not immediately follow another quantifier. =A0It is quantifying the entire=
> (.+) expression. =A0To get what you want, you need to move ? inside the
> parenthesis.
>
> (.+?)
>
> Xho
>
=2E..
Thank you all for your kind replys.
The problem was indeed my wrong intepretation of the question mark.
Although, the main issue was my understanding of the text file:
against my assumption - and against the specs (of so called MT101
format) - , :70: (and following) appears more than once in the text
file .. in fact, the messages where concatinated by transaction. ..
this just by the way.
Thanks to RedGrittyBrick: You've made my code smother ( to put it
directly into the "if"-loop). :-)
Regards,
Oliver
------------------------------
Date: Wed, 21 May 2008 08:12:46 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: script to find the files with very long names
Message-Id: <g10lhu$1881$1@agate.berkeley.edu>
[A complimentary Cc of this posting was NOT [per weedlist] sent to
Jürgen Exner
<jurgenex@hotmail.com>], who wrote in article <i8k634p52p650e4n1su69pdknbmbl6ime4@4ax.com>:
> Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> >[A complimentary Cc of this posting was NOT [per weedlist] sent to
> >Jürgen Exner
> ><jurgenex@hotmail.com>], who wrote in article <d94434hooi2jh36ger39usqo47ro1vhtfo@4ax.com>:
> >> use strict; use warnings;
> >> use File::Find;
> >> sub wanted{print "$_\n" if length>26;}
> >> find(\&wanted, '.');
> >
> >Wrong. You do not want to use $_ there (or use 'nochdir').
>
> Why? The docs say
> "$_" [contains] the current filename
> As far as I can tell that's exactly what the OP asked for: filenames
> longer than 26 characters.
Try it. It is not good to give to print() - it will be no longer
"current enough", since current directory is "wrong".
> >Better, use
> > pfind . "length > 26"
>
> C:\tmp>perldoc -f pfind
> No documentation for perl function `pfind' found
use it anyway. ;-)
Hope this helps,
Ilya
------------------------------
Date: Wed, 21 May 2008 12:27:54 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: script to find the files with very long names
Message-Id: <r15834p088r6jcc95ka1qugc01rj6vpbmh@4ax.com>
Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
>[A complimentary Cc of this posting was NOT [per weedlist] sent to
>Jürgen Exner
><jurgenex@hotmail.com>], who wrote in article <i8k634p52p650e4n1su69pdknbmbl6ime4@4ax.com>:
>> Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
>> >[A complimentary Cc of this posting was NOT [per weedlist] sent to
>> >Jürgen Exner
>> ><jurgenex@hotmail.com>], who wrote in article <d94434hooi2jh36ger39usqo47ro1vhtfo@4ax.com>:
>> >> use strict; use warnings;
>> >> use File::Find;
>> >> sub wanted{print "$_\n" if length>26;}
>> >> find(\&wanted, '.');
>> >
>> >Wrong. You do not want to use $_ there (or use 'nochdir').
>>
>> Why? The docs say
>> "$_" [contains] the current filename
>> As far as I can tell that's exactly what the OP asked for: filenames
>> longer than 26 characters.
>
>Try it.
I did.
>It is not good to give to print() -
print() has no problems with that value. It prints the filename just
fine.
> it will be no longer
>"current enough", since current directory is "wrong".
I have no idea what you are trying to say.
>> >Better, use
>> > pfind . "length > 26"
>>
>> C:\tmp>perldoc -f pfind
>> No documentation for perl function `pfind' found
>
>use it anyway. ;-)
Bareword "pfind" not allowed while "strict subs" in use at c:\tmp\t.pl
line 3.
Execution of c:\tmp\t.pl aborted due to compilation errors.
>Hope this helps,
Sorry, it didn't.
jue
------------------------------
Date: Wed, 21 May 2008 19:54:19 +0200
From: Susanne West <swest@gmx.de>
Subject: Re: select ethernet card for socket?
Message-Id: <483461CB.3090609@gmx.de>
smallpond wrote:
> Susanne West wrote:
>
>>
>>
>> how can i select an specific ethernet card for a
>> socket, when i have multiple ethernet-cards (lan,
>> wireless) installed?
>>
>> i have two cards, configured for two different subnets:
>> wireless: 192.168.50.x
>> lan: 2.1.1.x
>> and want to open a socket and broadcast to 2.1.1.x but
>> without touching the wireless-settings. currently, i
>> do:
>>
>> ----------------------------------------------
>> my $sendsocket = new IO::Socket::INET(
>> LocalHost => '2.1.1.1',
>> LocalPort => '6454',
>> PeerAddr => '2.255.255.255',
>> PeerPort => '6454',
>> Proto => 'udp',
>> Broadcast => 1
>> ) || die "[ERROR CREATING SOCKET] $!\n";
>> $sendsocket->sockopt(SO_BROADCAST, 1);
>> ----------------------------------------------
>>
>> which causes the wireless-connection to collapse...
>> i guess i can do something with 'bind' but can't
>> figure out how to identify the correct card...
>>
>>
>> thanks a ton!
>>
>>
>
> Is your LAN really class A or should your broadcast address be 2.1.1.255?
>
> Try first to create a socket without the broadcast to see if that is
> somehow causing havoc.
>
> -S
> ** Posted from http://www.teranews.com **
for those reading along: i solved the problem which was falsly
identified on the perl level. instead there was another script
that added a gateway to the lan card in question. as soon as that
gateway was added, the binding sequence of the cards kicked in,
routing everything through that (wrong) first gateway into 2.1.1.x
in this case, setting up the cards with
- ip
- subnet
and a gateway for the wireless adapter was enough...
thanks anyhow smallpond.
------------------------------
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 1563
***************************************