[19665] in Perl-Users-Digest
Perl-Users Digest, Issue: 1860 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 3 06:05:31 2001
Date: Wed, 3 Oct 2001 03:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1002103507-v10-i1860@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 3 Oct 2001 Volume: 10 Number: 1860
Today's topics:
Accessing Files on Client PC <Niall.e@no.usa.spam.net>
Re: Accessing Files on Client PC <Niall.e@no.usa.spam.net>
Re: Accessing Files on Client PC <tintin@snowy.calculus>
Re: Accessing Files on Client PC <eramaqu@set132.gsm.ericsson.se>
Re: Conditional regex substitution nobull@mail.com
Re: Efficient code? (Logan Shaw)
Re: Efficient code? <pne-news-20011003@newton.digitalspace.net>
Finding installed modules ie MD5.pm <john@trumpetweb.co.uk>
Re: Finding installed modules ie MD5.pm <info@fruiture.de>
Re: GIF encoding <pne-news-20011003@newton.digitalspace.net>
How can you manipulate images in Perl? (for SMS logos e <c.manley@REMOVE-THISchello.nl>
passing parameters between perl cgi scripts <hugo@fractalgraphics.com.au>
Re: passing parameters between perl cgi scripts <info@fruiture.de>
Perl 5.6.0 bug: best workaround? <newspost@coppit.org>
Perl Regex (Keven Denen)
Re: Perl Regex (Chas Friedman)
Re: Perl Regex <mbudash@sonic.net>
Re: Perl Regex <goldbb2@earthlink.net>
Re: Perl Regex (Chas Friedman)
Re: Pixel Color at particular coordinate <pne-news-20011003@newton.digitalspace.net>
re : GetSharedResources problem <gael.cadic@webelites.com>
Re: Regexp question (Ian Boreham)
Re: search and replacement <krahnj@acm.org>
strict and undisciplined me <justin.devanandan.allegakoen@intel.com>
Re: strict and undisciplined me <justin.devanandan.allegakoen@intel.com>
Re: Urgently need help with Net::SSH::Perl / Math::Pari (BUCK NAKED1)
Re: Urgently need help with Net::SSH::Perl / Math::Pari (BUCK NAKED1)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 29 Sep 2001 15:16:39 +1000
From: "Niall" <Niall.e@no.usa.spam.net>
Subject: Accessing Files on Client PC
Message-Id: <g7xu7.525$Wz5.1671@nsw.nnrp.telstra.net>
Hi,
Is it possible to use perl to check for a file on the client machine.
We want a client to visit a website. This website has to be check that a
file exists, and then launch that file.
Thanks
Niall
------------------------------
Date: Tue, 2 Oct 2001 15:34:49 +1000
From: "Niall" <Niall.e@no.usa.spam.net>
Subject: Re: Accessing Files on Client PC
Message-Id: <joxu7.528$Wz5.1511@nsw.nnrp.telstra.net>
I should have said "Check that a file exists on the client PC"
"Niall" <Niall.e@no.usa.spam.net> wrote in message
news:g7xu7.525$Wz5.1671@nsw.nnrp.telstra.net...
> Hi,
>
> Is it possible to use perl to check for a file on the client machine.
>
> We want a client to visit a website. This website has to be check that a
> file exists, and then launch that file.
>
> Thanks
> Niall
>
>
>
------------------------------
Date: Wed, 3 Oct 2001 19:35:38 +1000
From: "Tintin" <tintin@snowy.calculus>
Subject: Re: Accessing Files on Client PC
Message-Id: <P_Au7.13$Ih3.679019@news.interact.net.au>
"Niall" <Niall.e@no.usa.spam.net> wrote in message
news:g7xu7.525$Wz5.1671@nsw.nnrp.telstra.net...
> Hi,
>
> Is it possible to use perl to check for a file on the client machine.
>
> We want a client to visit a website. This website has to be check that a
> file exists, and then launch that file.
Sure. It all depends on what protocol you are using to communicate with the
client.
------------------------------
Date: Wed, 03 Oct 2001 11:46:41 +0200
From: Martin Quensel <eramaqu@set132.gsm.ericsson.se>
Subject: Re: Accessing Files on Client PC
Message-Id: <3BBADE81.62EA92F6@set132.gsm.ericsson.se>
Do you intend to write the client as well as the server, or do you mean
if it is possible to write a script on the webserver, that checks files
on the computer.
If you write your own client and server, this is possible.
If you want people to surf to your site using netscape (or something
else) and your site be able to read files from the client, well then the
answer is that it is not possible, unless you find bugs in some
webbrowser that makes this possible.
This has nothing to do with perl however.
If you want to be able to scan for files on machines, install FTP on
them is usually a good method.
Best Regards
Martin Q
Niall wrote:
>
> Hi,
>
> Is it possible to use perl to check for a file on the client machine.
>
> We want a client to visit a website. This website has to be check that a
> file exists, and then launch that file.
>
> Thanks
> Niall
------------------------------
Date: 03 Oct 2001 08:40:58 +0100
From: nobull@mail.com
Subject: Re: Conditional regex substitution
Message-Id: <u9itdxxi15.fsf@wcl-l.bham.ac.uk>
yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) writes:
> Marc Beyer (marc.beyer@berlin.de) wrote:
> : Hi,
>
> : I'm trying to remove some specific characters from a string like
>
> : s/=>|,|=|;| |"|'//g
>
> : but to exempt any characters enclosed by quotation marks. So that (for
> : example):
>
> Some techniques have been shown by others,
Including me.
> Another technique is to split the string around (possibly unescaped)
> quotation marks, and then run s/// on every _other_ substring.
That was my first idea but I rejected it because it couldn't easily be
adapted to cope with two different types of quote allowing " inside ''
quoted strings and vice versa.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: 2 Oct 2001 23:38:02 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Efficient code?
Message-Id: <9pe4na$b27$1@charity.cs.utexas.edu>
In article <Xns912EA25175D93darkononenet@207.126.101.97>,
David Wall <darkon@one.net> wrote:
>"S Warhurst" <s.warhurst@rl.ac.uk> wrote on 02 Oct 2001:
>
>> 1) If one wants to go through each line of a 100,000 line text file,
>> looking for one of 50 different strings, is the quickest way to do it
>I'd put the strings in a list and then loop over the list.
>
># initialize @list, with all the strings you're checking for
>my @list = ('string1', 'string2', '"[^"]+"', '(this|that) stuff');
>while (<DATA>) {
> foreach my $str (@list) {
> print "'$str' found at $.\n" if /$str/;
> }
>}
Another way you can do this is to quote the regular expressions using
"qr". I think this will be faster since they won't have to keep
getting rebuilt into finite state machines[1]. Doing that instead
would result in code like this:
my @list = ( qr/string1/, qr/string2/, qr/"[^"]+"/, qr/(this|that) stuff/ );
my $line;
while ($line = <DATA>)
{
foreach my $regex (@list)
{
print "$regex matched at $.\n" if $line =~ $regex;
}
}
I just ran this code on 78,000 line file, and it took about 1.75s, so
with 50 regexps and 100,000 lines, it should still be well under a
minute.
- Logan
[1] Not that Perl's regular expressions are really as limited
as finite-state machines, but you get the idea.
--
"In order to be prepared to hope in what does not deceive,
we must first lose hope in everything that deceives."
Georges Bernanos
------------------------------
Date: Wed, 03 Oct 2001 11:00:49 +0200
From: Philip Newton <pne-news-20011003@newton.digitalspace.net>
Subject: Re: Efficient code?
Message-Id: <atjlrtcipjp64q59f4phaq3ommt52iehq4@4ax.com>
On 02 Oct 2001 16:52:35 -0400, Joe Schaefer <joe+usenet@sunstarsys.com>
wrote:
> "S Warhurst" <s.warhurst@rl.ac.uk> writes:
>
> > 1) If one wants to go through each line of a 100,000 line text file,
> > looking for one of 50 different strings, is the quickest way to do it
> > (in terms of processor time) to use 50 IF... ELSIF... commands? (some
> > of these do require regexp matching.. eg: "I like cornflakes for
> > breakfast" where cornflakes could be any breakfast cereal).
>
> If you have enough RAM (which you probably do), you might try slurping
> the whole file in and study()ing the scalar before doing any pattern
> matches:
study may be able to help even without slurping -- if you are really
running many, many regexes on each line of the file, then you could
consider studying each line after you read it, before trying the
regexes.
Your best bet may be to benchmark your code with and without study, to
see whether the (more or less) fixed overhead of study is less than the
speed gain.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Wed, 03 Oct 2001 08:42:10 GMT
From: "John P" <john@trumpetweb.co.uk>
Subject: Finding installed modules ie MD5.pm
Message-Id: <CbAu7.43832$iG3.2848803@news1.cableinet.net>
Hi there all,
I have MD5.pm installed on my server, I have the correct SHEBANG line but
I'm still getting
Can't locate Digest/MD5.pm message when I run the script. Does anyone have
any ideas please.
Thanks in advance
------------------------------
Date: Wed, 3 Oct 2001 11:54:37 +0200
From: "fruiture" <info@fruiture.de>
Subject: Re: Finding installed modules ie MD5.pm
Message-Id: <9pendo$l08$01$1@news.t-online.com>
"John P" <john@trumpetweb.co.uk> schrieb:
> Hi there all,
>
> I have MD5.pm installed on my server, I have the correct SHEBANG line
but
> I'm still getting
> Can't locate Digest/MD5.pm message when I run the script. Does anyone
have
> any ideas please.
if the module is _correctly_ installed, its in one of the
@INC-directories. If it's somewhere else, you have to add the directory to
@INC by
use lib '/path/to/strangely/placed/modules';
use Digest::MD5;
HTH
--
require Time::HiRes;my @m=split(/8/,55.52.56.49.49.55.56.49.49.53);push
@m,map{($_%2)?$_-1:$_+1} map ord($_),split//,'u!`onuids!Qdsm!i`bjds';
unshift @m,43 for(0..@m);for(0..@m){print map chr($_),@m[0..(@m/2-1)];
push @m,shift @m;print "\b"x(@m/2);Time::HiRes::usleep(0246*0xA**3);}
------------------------------
Date: Wed, 03 Oct 2001 09:21:24 +0200
From: Philip Newton <pne-news-20011003@newton.digitalspace.net>
Subject: Re: GIF encoding
Message-Id: <apclrtge38t7k6n99ck9ukf63k0ck1id7k@4ax.com>
On Wed, 3 Oct 2001 01:32:11 +1000, "Gregory Toomey" <nobody@nowhere.com>
wrote:
[producing GIFs with GD]
> You need to use an older version of GD (which will be a problem if your
> default GD is after 1.19)
This also needs an older version of libgd. Or does GD.pm come with a
suitable version of libgd? I thought it expected you to install it
yourself and then just linked to it. And I don't think Thomas Boutell
has the older, GIF-producing version of libgd available for download any
more.
So unless GD.pm came with its own libgd, it wouldn't help you to use an
old one.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Wed, 3 Oct 2001 12:07:28 +0200
From: "Craig Manley" <c.manley@REMOVE-THISchello.nl>
Subject: How can you manipulate images in Perl? (for SMS logos etc)
Message-Id: <9penj9$p84$1@news1.xs4all.nl>
Hi all,
For an SMS logo cgi script I need to convert common image formats into 2
color image formats for sending to a mobile phone. Scaling the image to the
correct dimensions is also important. Has anybody got experience and tips on
that? My development OS is Win32, but eventually it'll all run on Linux.
I'm using GD and Image::Magick on Win32 ActiveState Perl (installed with
"ppm install....."), but they are not the most recent versions. I can't
compile the source code for the more recent versions. In any case it seems
that of the 2 packages only Image::Magick can manipulate images (or at least
so the docs say) but I can't get it to work - scaling works but color
reduction doesn't. Below is a sample of my code trying to scale an image to
SMS logo format and reduce the colors to 2:
my $p = new Image::Magick;
my $e = $p->Read($filename);
warn "$e" if $e;
$e = $p->Quantize(colors=>2,colorspace=>'RGB',treedepth=>2,dither=>'True');
warn "$e" if $e;
#$e = $p->Set(type=>'Bilevel');
#warn "$e" if $e;
$e = $p->Set(monochrome=>'True');
warn "$e" if $e;
$e = $p->Set(filename =>'test.png');
warn "$e" if $e;
$e = $p->Scale(width => 72, height => 14);
warn "$e" if $e;
# Output data
binmode STDOUT;
my(@blob) = $p->ImageToBlob();
print $blob[0];
------------------------------
Date: Wed, 03 Oct 2001 17:49:56 +0800
From: hugo <hugo@fractalgraphics.com.au>
Subject: passing parameters between perl cgi scripts
Message-Id: <3BBADF44.71F2808B@fractalgraphics.com.au>
Hi
I have encountered something I perhaps should know but don't.
I have a perl CGI script where I have a text field where the user can
type in his/her name. I can easily get the content of the text field of
course - if the name of the textield is "login" I can get it by:
use CGI;
$query = new CGI;
then:
$user = query->param('login');
However, later on the first perl script calls a second one. How do I
pass the value of $user to the second cgi-script?
I thought something like this. If there is a link to the second script
in the first one:
<a
href=\"http://www.myserver.com.au/cgi-bin/second_script.pl?$user\">second
page</a>
But the addition ?$user to the end of the URL does not work.
How do I do this?
Or is there a way to make $user global so it can be accessed by all perl
CGI script? If so, how do certain CGI scripts "know" they can access
$user whereas unrelated scripts don't?
Stupid questions perhaps, yet I would be helped very much if someone can
tell me how to do this.
Thanks
Hugo
-
Dr Hugo Bouckaert
R&D Support Engineer, Fractal Graphics
57 Havelock Street, West Perth 6005
Western Australia 6009
Tel: +618 9211 6000
Email:hugo@fractalgraphics.com.au
Web: http://www.fractalgraphics.com.au
------------------------------
Date: Wed, 3 Oct 2001 11:52:16 +0200
From: "fruiture" <info@fruiture.de>
Subject: Re: passing parameters between perl cgi scripts
Message-Id: <9pen9b$dub$07$1@news.t-online.com>
"hugo" <hugo@fractalgraphics.com.au> schrieb:
> Hi
>
> I have encountered something I perhaps should know but don't.
>
> I have a perl CGI script where I have a text field where the user can
> type in his/her name. I can easily get the content of the text field of
> course - if the name of the textield is "login" I can get it by:
>
> use CGI;
> $query = new CGI;
>
> then:
>
> $user = query->param('login');
>
> However, later on the first perl script calls a second one. How do I
> pass the value of $user to the second cgi-script?
>
> I thought something like this. If there is a link to the second script
> in the first one:
>
> <a
>
href=\"http://www.myserver.com.au/cgi-bin/second_script.pl?$user\">second
> page</a>
>
> But the addition ?$user to the end of the URL does not work.
>
> How do I do this?
>
> Or is there a way to make $user global so it can be accessed by all perl
> CGI script? If so, how do certain CGI scripts "know" they can access
> $user whereas unrelated scripts don't?
>
hmm, you don't really know CGI...
for passing long values from client to server rather use POST
<form action="script.pl" method="POST">
<input type="hidden" value="fuckin' long text ............" />
<input type="submit" name="submit_me" value="Pass Long Value by POST" />
</form>
please read http://w3.org/CGI , it should help
--
require Time::HiRes;my @m=split(/8/,55.52.56.49.49.55.56.49.49.53);push
@m,map{($_%2)?$_-1:$_+1} map ord($_),split//,'u!`onuids!Qdsm!i`bjds';
unshift @m,43 for(0..@m);for(0..@m){print map chr($_),@m[0..(@m/2-1)];
push @m,shift @m;print "\b"x(@m/2);Time::HiRes::usleep(0246*0xA**3);}
------------------------------
Date: Wed, 03 Oct 2001 00:14:21 -0400
From: David Coppit <newspost@coppit.org>
Subject: Perl 5.6.0 bug: best workaround?
Message-Id: <3BBA909D.2020706@coppit.org>
Consider the following program:
----------- %< ------------
sub foo(\@@) { die }
sub bar { foo(@_) }
eval { bar() };
eval { bar() };
----------- %< ------------
which results in:
----------- %< ------------
# perl -v
This is perl, v5.6.0 built for i386-linux
# PERL_DL_NONLAZY=1 /usr/bin/perl crash.pl
Attempt to free unreferenced scalar at crash.pl line 6.
Segmentation fault (core dumped)
----------- %< ------------
The problem seems to be the prototype. I can remove it and perl doesn't
core dump. Is there a better workaround? For example, is there a
solution that's easier than:
if ($] == 5.006) {
&foo(@_)
} else {
foo(@_)
}
BTW, this bug was fixed in version 5.6.1. However, there are lots of
people running RedHat 7.1 which shipped with 5.6.0. I'd like to avoid
alienating all of them.
David
------------------------------
Date: 2 Oct 2001 21:49:51 -0700
From: kevend@nhrockford.com (Keven Denen)
Subject: Perl Regex
Message-Id: <b92b484e.0110022049.118428b1@posting.google.com>
This may seem like a very newbie type question, but I can't figure
something out. Flame me if necessary, but at least let me know what I
am doing wrong. Here's what I am trying to do:
I'm trying to get Perl to take input from the user and make sure it
matches the right format for a social security number xxx-xx-xxxx. So
my regex is
/[\d]{3}-[\d]{2}-[\d]{4}/
Seems like it should be easy right??? That's what I thought. It is
almost right but it will take more than 3, 2, and 4 digits after each
dash. Doesn't the {x} limit the number of characters?? Am I missing
something? Any help would be appreciated.
Email me if you can tell what I am doing wrong. I'm using Perl5 in
RedHat.
Keven Denen
kevend@nhrockford.com
------------------------------
Date: Wed, 03 Oct 2001 05:38:48 GMT
From: friedman@math.utexas.edu (Chas Friedman)
Subject: Re: Perl Regex
Message-Id: <3bbaa355.173100239@news.itouch.net>
On 2 Oct 2001 21:49:51 -0700, kevend@nhrockford.com (Keven Denen)
wrote:
>This may seem like a very newbie type question, but I can't figure
>something out. Flame me if necessary, but at least let me know what I
>am doing wrong. Here's what I am trying to do:
>
>I'm trying to get Perl to take input from the user and make sure it
>matches the right format for a social security number xxx-xx-xxxx. So
>my regex is
>
>/[\d]{3}-[\d]{2}-[\d]{4}/
>
>Seems like it should be easy right??? That's what I thought. It is
>almost right but it will take more than 3, 2, and 4 digits after each
>dash. Doesn't the {x} limit the number of characters?? Am I missing
>something? Any help would be appreciated.
>
>Email me if you can tell what I am doing wrong. I'm using Perl5 in
>RedHat.
>
>Keven Denen
>
>kevend@nhrockford.com
You don't need the [ ]. But aside from that, the problem is that
in something like 1234-56-7891, there does occur a pattern
234-56-789 which matches. You probably need something like
/^\d{3}-\d{2}-\d{4}$/.
chas
------------------------------
Date: Wed, 03 Oct 2001 05:46:35 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Perl Regex
Message-Id: <mbudash-D86453.22463802102001@news.sonic.net>
In article <b92b484e.0110022049.118428b1@posting.google.com>,
kevend@nhrockford.com (Keven Denen) wrote:
> This may seem like a very newbie type question, but I can't figure
> something out. Flame me if necessary, but at least let me know what I
> am doing wrong. Here's what I am trying to do:
>
> I'm trying to get Perl to take input from the user and make sure it
> matches the right format for a social security number xxx-xx-xxxx. So
> my regex is
>
> /[\d]{3}-[\d]{2}-[\d]{4}/
>
> Seems like it should be easy right??? That's what I thought. It is
> almost right but it will take more than 3, 2, and 4 digits after each
> dash. Doesn't the {x} limit the number of characters?? Am I missing
> something? Any help would be appreciated.
first off, [\d] defines a character class containing one item, \d, which
is itself a class. IOW, you're being redundant - drop the brackets.
now... you are mistaken about that expression 'take'-ing more than 2
digits in the middle, but you are correct about it 'take'-ing more than
3 at the beginning or more than 4 at the end. it makes sense if you
think about it:
1234-12-12345 *does* contain 3 digits followed by a dash followed by 2
digits followed by a dash followed by 4 digits, it just contains *more*
than that... what you need to understand is the concept of anchors:
/^\d{3}-\d{2}-\d{4}$/ will do what you want, because in this context '^'
means 'start of string', and '$' means 'end of string', so 1234-12-12345
will *not* match.
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: Wed, 03 Oct 2001 01:55:52 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Perl Regex
Message-Id: <3BBAA868.8F4F26AE@earthlink.net>
Keven Denen wrote:
>
> This may seem like a very newbie type question, but I can't figure
> something out. Flame me if necessary, but at least let me know what I
> am doing wrong. Here's what I am trying to do:
>
> I'm trying to get Perl to take input from the user and make sure it
> matches the right format for a social security number xxx-xx-xxxx. So
> my regex is
>
> /[\d]{3}-[\d]{2}-[\d]{4}/
>
> Seems like it should be easy right??? That's what I thought. It is
> almost right but it will take more than 3, 2, and 4 digits after each
> dash. Doesn't the {x} limit the number of characters?? Am I missing
> something? Any help would be appreciated.
It does, but regexes can match substrings of the string you're testing
against... eg, if the string is "00000111-22-33334444", the match will
succeed, and the matched part will be "111-222-3333".
You need to anchor your regular expression to the beginning and end of
the string.
/^\d{3}-\d{2}-\d{4}$/
Should do what you want.
> Email me if you can tell what I am doing wrong. I'm using Perl5 in
> RedHat.
Sorry. You ask here, you get your answers here.
--
"I think not," said Descartes, and promptly disappeared.
------------------------------
Date: Wed, 03 Oct 2001 05:52:00 GMT
From: friedman@math.utexas.edu (Chas Friedman)
Subject: Re: Perl Regex
Message-Id: <3bbaa75d.174132260@news.itouch.net>
On 2 Oct 2001 21:49:51 -0700, kevend@nhrockford.com (Keven Denen)
wrote:
>This may seem like a very newbie type question, but I can't figure
>something out. Flame me if necessary, but at least let me know what I
>am doing wrong. Here's what I am trying to do:
>
>I'm trying to get Perl to take input from the user and make sure it
>matches the right format for a social security number xxx-xx-xxxx. So
>my regex is
>
>/[\d]{3}-[\d]{2}-[\d]{4}/
>
>Seems like it should be easy right??? That's what I thought. It is
>almost right but it will take more than 3, 2, and 4 digits after each
>dash. Doesn't the {x} limit the number of characters?? Am I missing
>something? Any help would be appreciated.
>
>Email me if you can tell what I am doing wrong. I'm using Perl5 in
>RedHat.
>
>Keven Denen
>
>kevend@nhrockford.com
You don't need the [ ]. But aside from that, the problem is that
in something like 1234-56-78912, there does occur a pattern
234-56-7891 which matches. You probably need something like
/^\d{3}-\d{2}-\d{4}$/.
chas
------------------------------
Date: Wed, 03 Oct 2001 11:00:55 +0200
From: Philip Newton <pne-news-20011003@newton.digitalspace.net>
Subject: Re: Pixel Color at particular coordinate
Message-Id: <g0klrt0vbq47bmgi7g9s57m0n6eqo7hc03@4ax.com>
On Tue, 02 Oct 2001 21:49:13 GMT, Bart Lateur <bart.lateur@skynet.be>
wrote:
> For such a small image, why do you even need GIF? 28 pixels, h*ll, even
> BMP will do.
Or PPM, which is more easily tractable with code due to the simplified
header and file format (and existing sample code). IMO, of course.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Wed, 3 Oct 2001 09:26:37 +0200
From: "Gael Cadic" <gael.cadic@webelites.com>
Subject: re : GetSharedResources problem
Message-Id: <9pegc4$b7j$1@reader1.fr.uu.net>
i am looking for printing all shared resources
my $resources = [];
GetSharedResources($resources, RESOURCETYPE_ANY) || print $^E;
foreach my $href (@$resources){
print fic "-----<br>";
$i++;
print fic "$href<br>";
foreach( keys %$href){
print fic "$_: $href->{$_}<br>";
}
}
print fic "i= ".$i." unités";
the printing end like this
-----
HASH(0x8bb3864)
LocalName:
Comment: Samba Server
Usage: 2
DisplayType: 2
Provider: Réseau Microsoft Windows
RemoteName: \\192.168.0.102
Scope: 2
Type: 0
i= 134 unités
this is not the last server in the LAN
is it a GetSharedResources bug ?
gael
------------------------------
Date: 2 Oct 2001 21:45:52 -0700
From: ianb@ot.com.au (Ian Boreham)
Subject: Re: Regexp question
Message-Id: <f02c4576.0110022045.26d9186f@posting.google.com>
slidge@slidge.com wrote in message news:<E0qu7.19429$ck.127345@sjc-read.news.verio.net>...
I haven't checked this thoroughly to see what other problems you might
have, but here's a start:
> The snippet I have is:
>
> $line = $line.".".$origin
> if (( $line =~ /^.*[^\.]$/
> && $line =~ /[^\d+\.\d+\.\d+\.\d+]$/ )
You are trying to use a character class to prevent matching a
multi-char string. Read the docs on character classes (e.g. man
perlre). You probably want to replace this with:
!~ /\d+\.\d+\.\d+\.\d+$/
(untested)
You could combine the regexes to say "if it does not match (ending
with dot or ending with IP address)":
!~ /(?:\d+\.\d+\.\d+\.\d+|\.)$/
(untested)
Depending on your knowledge of the data, you might be able to reduce
it to something like "does not match dot followed by optional digits
followed by end of line":
!~ /\.\d*$/
(untested)
If you need to be stricter, the archives of this list abound with
discussions regarding the matching of IP addresses.
> && ( $type ne "HINFO"
> && $type ne "TXT"
> && $type ne "UNKNOWN"));
Sorry I couldn't spend any more time on it, but I have to go.
Regards,
Ian
------------------------------
Date: Wed, 03 Oct 2001 07:39:07 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: search and replacement
Message-Id: <3BBAC11F.35283B8B@acm.org>
Tim wrote:
>
> hi,
> Could someone please help me on this ?
>
> Here is an example of input file:
>
> sp_X abc xxx same red123 132xe2
> sp_S 001 LLL same orange 123dxe
> sp_J 011 001 same 123456 ddd1ee
> sp_S xyx HHH same xxxxxx abcdef
>
> Here is what I would like to have on the output:
>
> Just replace LLL with xxx in column 3
> Just replace HHH with xxx in column 3
>
> sp_X abc xxx same red123 132xe2
> sp_S 001 xxx same orange 123dxe
> sp_F 011 001 same 123456 ddd1ee
> sp_W xyx xxx same xxxxxx abcdef
>
> My perl script does not do the trick !!
>
> $input_file = "test.file";
> $output_file = "TEMP_OUTPUT";
>
> $edge_set = "sp_X|sp_F|sp_W|sp_S";
>
> open (OUTFILE,">$output_file") || die "ERROR: cannot open output file
> for writing\n";
>
>
>
> open (LVM,$input_file) || die "ERROR: cannot open input file for
> reading\n";
>
> while (<LVM>){
>
> chomp $_;
> print "$_\n";
>
> if (/$edge_set/){
> substr($_,10,3)='xxx';
> }
>
> print OUTFILE "$_\n";
>
>
> }
Here is one way to do it:
#!/usr/bin/perl -w
use strict;
my ( $input_file, $output_file ) = qw(test.file TEMP_OUTPUT);
open LVM, $input_file or die "ERROR: cannot open $input_file: $!";
open OUTFILE, "> $output_file" or die "ERROR: cannot open $output_file:
$!";
while ( <LVM> ) {
s/(\S+\s+\S+\s+)(\S+)(\s)/$1 . (($2 eq 'LLL' or $2 eq 'HHH') ? 'xxx'
: $2) . $3/e;
print OUTFILE;
}
__END__
John
--
use Perl;
program
fulfillment
------------------------------
Date: Wed, 3 Oct 2001 12:22:58 +0800
From: "Just in" <justin.devanandan.allegakoen@intel.com>
Subject: strict and undisciplined me
Message-Id: <9pe3ra$47i@news.or.intel.com>
Okay, so I've read that utilisation of the -w option,
and including use strict is good programming practise,
and I understand that my is faster than local.
Now, finally I am starting to use these pearls of wisdom in
my programs - yup for the last year I havent bothered!
However I fail to understand why I get
Use of uninitialized value in join at C:\Perl\programs\program.pl line 55.'
when all I have done is this :-
#!/usr/bin/perl5 -w
------------------------------
Date: Wed, 3 Oct 2001 12:33:54 +0800
From: "Just in" <justin.devanandan.allegakoen@intel.com>
Subject: Re: strict and undisciplined me
Message-Id: <9pe4fm$4m8@news.or.intel.com>
So sorry my system hung, so I didn't finish:-
The error is this:- 'Use of uninitialized value in join at
C:\Perl\programs\Insert.pl line 56.'
And the code is this:- (yuck! I know . . .)
#!/usr/bin/perl5 -w
use strict;
use Win32::ODBC;
# Globals
my $DB;
my $SQL;
my @Insert;
# Subs
sub OpenDSN
{
print "Error connecting to $DB\n";
print "Error: " . Win32::ODBC::Error() . "\n";
exit;
}
# Get date a month ago without using Date::Calc
my @Date = localtime(time() - (31 * 24 * 60 * 60));
$Date[5] += 1900;
$Date[4]++;
# Connection to server
unless($DB=new Win32::ODBC("dsn=server; UID=me; PWD=you"))
{&OpenDSN;}
$SQL = "SELECT * FROM Table WHERE InsertTime > '$Date[4]\/$Date[3]\/$Date[5]
$Date[2]:$Date[1]:$Date[0]'";
if ($DB->Sql($SQL))
{
print "Error, SQL failed: " . $DB->Error() . "\n\n $SQL\n";
$DB->Close();
exit;
}
else
{
while($DB->FetchRow())
{
undef my %Data;
undef @Insert;
%Data = $DB->DataHash();
while((my $Key, my $Val) = each(%Data))
{
push @Insert, $Val, "\t";
}
print "@Insert\n";
}
}
# Close connection
$DB->Close();
Printing @Insert returns data in the midst of the uninitialised errors that
print to screen.
Please feel free to highlight my inadequacies as a proficient Perl
programmer,
and explain to me why I get the uninitialised error.
Thanks
------------------------------
Date: Wed, 3 Oct 2001 00:39:09 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Urgently need help with Net::SSH::Perl / Math::Pari / @INC and ...
Message-Id: <3823-3BBAA47D-328@storefull-247.iap.bryant.webtv.net>
I hope "Ben" doesn't mind, but maybe part of a past email from him about
this module will help you.
If you wish to use SSH-2, then read on...
Crypt::DSA (0.03 or greater) ** FAILED ** Crypt::DH (0.01 or greater)
**FAILED **
Both of these failed for the same reason--because Math::Pari failed to
install:
Math::Pari (2.001804 or greater) ** FAILED **
Math::Pari is kind of tricky to install at times, unfortunately. But I'm
sure it should install on Debian. What version of Perl are you using?
The latest version of Math::Pari is not on CPAN (again, unfortunately).
You might have better luck trying the latest version in Ilya's FTP
directory:
=A0=A0=A0=A0=A0=A0=A0=A0ftp://ftp.math.ohio-state.edu/pub/users/ilya/perl/=
modules/
Looks like the latest is Math-Pari-2.010100.tar.gz, so I would suggest
trying that.
A couple of other failing modules:
Crypt::IDEA ..................** FAILED **
When you run Makefile.PL, try running it with POLLUTE=3D1:
=A0=A0=A0=A0=A0=A0=A0=A0% perl Makefile.PL POLLUTE=3D1
In perl > 5.6 you will get errors about sv_undef unless you use
POLLUTE=3D1.
Crypt::Random ** FAILED **
This also failed because Math::Pari was not installed.
I hope this helps. If not, or if you have more questions, let me know.
bye,
Ben
You may want to contact the module author, if the above doesn't answer
your question.
Regards,
--Dennis
------------------------------
Date: Wed, 3 Oct 2001 00:48:59 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Urgently need help with Net::SSH::Perl / Math::Pari / @INC and ...
Message-Id: <3823-3BBAA6CB-329@storefull-247.iap.bryant.webtv.net>
I'm curious. If Math::Pari is so flaky, hard-to-install, and comes with
outdated docs, why are module authors depending on it?
Regards,
--Dennis
------------------------------
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 1860
***************************************