Re: HTTP Filtering and Threads...

2007-09-15 Thread Mumia W.
I keep getting copies of the message below. I've gotten perhaps 10 
copies of it over the last 24 hours.


It continues even though I unsubscribed.


Return-Path: [EMAIL PROTECTED]
Received: from noehlo.host ([127.0.0.1])
by mx-various.atl.sa.earthlink.net (EarthLink SMTP Server) with SMTP id 
1iwu3yn83Nl36J2; Sat, 15 Sep 2007 05:35:16 -0400 (EDT)
Received: from lists.develooper.com ([63.251.223.186])
by mx-various.atl.sa.earthlink.net (EarthLink SMTP Server) with SMTP id 
1iwu3y2vH3Nl36J0
for [EMAIL PROTECTED]; Sat, 15 Sep 2007 05:35:16 -0400 (EDT)
Received: (qmail 11633 invoked by uid 514); 15 Sep 2007 09:35:14 -
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
List-Post: mailto:beginners@perl.org
List-Help: mailto:[EMAIL PROTECTED]
List-Unsubscribe: mailto:[EMAIL PROTECTED]
List-Subscribe: mailto:[EMAIL PROTECTED]
List-Id: beginners.perl.org
Delivered-To: mailing list beginners@perl.org
Received: (qmail 11617 invoked from network); 15 Sep 2007 09:35:13 -
Received: from x1a.develooper.com (HELO x1.develooper.com) (216.52.237.111)
  by lists.develooper.com with SMTP; 15 Sep 2007 09:35:13 -
Received: (qmail 26300 invoked by uid 225); 15 Sep 2007 09:35:13 -
Delivered-To: beginners@perl.org
Received: (qmail 26293 invoked by alias); 15 Sep 2007 09:35:12 -
X-Spam-Status: No, hits=-2.6 required=8.0
tests=BAYES_00,SPF_PASS
X-Spam-Check-By: la.mx.develooper.com
Received: from wx-out-0506.google.com (HELO wx-out-0506.google.com) 
(66.249.82.239)
by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Sat, 15 Sep 2007 
02:30:49 -0700
Received: by wx-out-0506.google.com with SMTP id t11so1077113wxc
for beginners@perl.org; Sat, 15 Sep 2007 02:30:08 -0700 (PDT)
Received: by 10.90.29.18 with SMTP id c18mr489842agc.1189806328174;
Fri, 14 Sep 2007 14:45:28 -0700 (PDT)
Received: by 10.90.119.11 with HTTP; Fri, 14 Sep 2007 14:45:28 -0700 (PDT)
Message-ID: [EMAIL PROTECTED]
Date: Sat, 15 Sep 2007 03:15:28 +0530
From: Somu [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: Dan [EMAIL PROTECTED], beginners@perl.org
Subject: Re: HTTP Filtering and Threads...
In-Reply-To: [EMAIL PROTECTED]
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
References: [EMAIL PROTECTED]
X-ELNK-Received-Info: spv=0;
X-ELNK-AV: 0
X-ELNK-Info: sbv=0; sbrc=.0; sbf=00; sbw=000;

you can store all the data in an array first and then apply regex on
all lines, if the response come in lines. Else, get all the data in a
scalar and apply the regex. I think this may get you the silva

my ($name,$type,$mname) =~ /name=(.*) type=(.*) value=(.*)/i;

i'm not sure though how we may capture all the occurences.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: unable to use perl script with post on university wireless network

2007-09-15 Thread Mumia W.

On 09/15/2007 01:17 PM, perllearner wrote:

I am a little stumped as to what is happening, just a few hours ago, I
was able to use the same script at home, however on a university
wireless, the script just stalls, and even perl package manager gives
a error 500.  I am a little confused on where to go from here, or how
to circumvent this, I am using winxp professional with service pack
2.  Does anyone know how I may be able to use a perl script with such
a restriction?




Is Perl installed on the university wireless?

If so, what Perl?

In what context is the script executing? Standalone, CGI, 
IIS/PerlScript, Apache/Mod_perl?


What is the script in question?



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: [perl #45449] Can not end subscription to beginners at perl.org

2007-09-15 Thread Mumia W.

On 09/15/2007 02:00 AM, David Landgren via RT wrote:


I have unsubscribed you from [EMAIL PROTECTED] Note that you are still
subscribed to beginners-cgi@



Thank you, but I'm still getting list messages. This is the last one I 
received:



Return-Path: [EMAIL PROTECTED]
Received: from noehlo.host ([127.0.0.1])
by mx-various.atl.sa.earthlink.net (EarthLink SMTP Server) with SMTP id 
1iwIEW5Oj3Nl36J0; Sat, 15 Sep 2007 21:10:50 -0400 (EDT)
Received: from lists.develooper.com ([63.251.223.186])
by mx-various.atl.sa.earthlink.net (EarthLink SMTP Server) with SMTP id 
1iwIEW2Ym3Nl36J0
for [EMAIL PROTECTED]; Sat, 15 Sep 2007 21:10:50 -0400 (EDT)
Received: (qmail 12639 invoked by uid 514); 16 Sep 2007 01:10:48 -
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
List-Post: mailto:beginners@perl.org
List-Help: mailto:[EMAIL PROTECTED]
List-Unsubscribe: mailto:[EMAIL PROTECTED]
List-Subscribe: mailto:[EMAIL PROTECTED]
List-Id: beginners.perl.org
Delivered-To: mailing list beginners@perl.org
Received: (qmail 12620 invoked from network); 16 Sep 2007 01:10:47 -
Received: from x1a.develooper.com (HELO x1.develooper.com) (216.52.237.111)
  by lists.develooper.com with SMTP; 16 Sep 2007 01:10:47 -
Received: (qmail 17308 invoked by uid 225); 16 Sep 2007 01:10:46 -
Delivered-To: Beginners@perl.org
Received: (qmail 17262 invoked by alias); 16 Sep 2007 01:10:44 -
X-Spam-Status: No, hits=0.0 required=8.0
tests=DKIM_SIGNED,DKIM_VERIFIED,DK_SIGNED,SPF_PASS
X-Spam-Check-By: la.mx.develooper.com
Received: from wx-out-0506.google.com (HELO wx-out-0506.google.com) 
(66.249.82.229)
by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Sat, 15 Sep 2007 
18:10:36 -0700
Received: by wx-out-0506.google.com with SMTP id t11so1173341wxc
for Beginners@perl.org; Sat, 15 Sep 2007 18:10:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=beta;

h=domainkey-signature:received:received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;
bh=spDpHw5rhAqB5Td/5Mi2zgoqtGdAOijOIn0/lrU306M=;

b=cJSWSh4mXDJMsZCtrVIO2W5SOfsSjjCqksaeDw8ckjfIx4GQohDChDgB/aet4PTg2ELZISJHQgfzz4vkueVlPGtR3WM3YwQuUAwrVP4PN0DEQ7RhHPmL2ufNhRzksFOeEwGExyfmtUrOsgb1As//S3HXyAomCfq53Rto3ZKbbnA=
DomainKey-Signature: a=rsa-sha1; c=nofws;
d=gmail.com; s=beta;

h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references;

b=djCIdTvWrO0vFlD9QHwZ2Btq6B4lP+dXZM5KlfeHZYN8+tngACb0CF11Cbt5ww1QC7zhymXea6PIRbwiTFMYgoqOhtZx5KoPhU8I7nR/BaotOG4/9mzVSiwHhljbv3meVljo7IUHdvx92tBOVLF/VJSpS3Rs6POF4yo2Y+Hj0vs=
Received: by 10.90.83.14 with SMTP id g14mr1530589agb.1189905032638;
Sat, 15 Sep 2007 18:10:32 -0700 (PDT)
Received: by 10.90.119.11 with HTTP; Sat, 15 Sep 2007 18:10:32 -0700 (PDT)
Message-ID: [EMAIL PROTECTED]
Date: Sun, 16 Sep 2007 06:40:32 +0530
From: Somu [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: Beginners@perl.org
Subject: Re: Linked lists
In-Reply-To: [EMAIL PROTECTED]
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
References: [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
X-ELNK-Received-Info: spv=0;
X-ELNK-AV: 0
X-ELNK-Info: sbv=0; sbrc=.0; sbf=00; sbw=000;

Oh..thanks everyone. Now i understand the difference between
references and pointers. Then, i got to know something of C link list
from a perl list.. Hahaha.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Can not end subscription to beginners at perl.org

2007-09-14 Thread Mumia W.
[EMAIL PROTECTED] sends me an confirmation request, but 
when I send the message back, I don't get a confirmation, and I keep 
getting list messages.


When I send to [EMAIL PROTECTED], I get a help message back, but 
it says that the message I sent wasn't sent to any of ezmlm's command 
addresses.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Random Image and Cache problem

2007-09-03 Thread Mumia W.

On 09/03/2007 10:06 AM, Carl Miller wrote:

Thanks Gunnar and Mumia.

I figured out that the problem is unique to Internet Explorer. The three 
other browsers I tried don't have this problem. But I can't get IE to not 
cache. I've tried these:


print Cache-Control: no-cache\n;
print Pragma: no-cache\n;  # for HTTP/1.0
print Expires: Fri, 26 Mar 2004 01:40:42 GMT\n;
print Cache-Control: must-revalidate, max-age=1\n;

IE still caches. 


Can anyone give some insight into where the problem might be?

Thanks.



I wish I could help you. I once had a problem with IE caching too much 
data, and that problem caused me to look bad on my job. I didn't 
appreciate it very much.


We have to live in an IE environment whether we like it or not. I hope 
you figure out how to get IE behaving properly; I never really did. By 
the time I figured out that something was really wrong with my pages, 
and it related to how IE was caching them on my boss' computer, the 
damage to my image had been done.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Random Image and Cache problem

2007-09-02 Thread Mumia W.

On 09/02/2007 01:16 PM, Carl Miller wrote:
I'm trying to setup a simple random image script to allow other websites to 
display random banner ads located on my server.


The other website would call the perl script in an img tag, like so:

img src=http://www.my_site.com/cgi-bin/random_banner.cgi; width=468 
height=60


I've tried several perl scripts that basically work, but the problem is 
always the same with all of them: the browser always caches 
'random_banner.cgi' causing the same banner to be displayed on every 
subsequent page. The only way to see a different banner is to hit 
Reload/Refresh.


Is there a script out there that avoids the cache problem in displaying 
random banners via an img tag?


Thanks!





Use a Cache-control header that specifies no-cache and use an 
Expires header that uses a date in the past.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Unable to locate make

2007-08-30 Thread Mumia W.

On 08/30/2007 01:14 AM, kilaru rajeev wrote:

Hi All,


Hello.



[...] Is there any 
way to promt the shell to ask for the settings again or is there any file 
which will contain all the details. Please help me.




If you want to be able to reconfigure all of the CPAN variables, inside 
the CPAN shell, do this:


o conf init

If you just want to edit one value, open $HOME/.cpan/CPAN/MyConfig.pm in 
a text editor.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Logging STDERR and other output

2007-08-30 Thread Mumia W.

On 08/30/2007 04:32 AM, Beginner wrote:

Hi,

I want all the output plus any error messages to got to a log file. I 
used the BEGIN block to direct STDERR into the file:


BEGIN { 
  open(STDERR, /usr/local/myreports/report.log) || die Can't 
write to file: $!\n;

}

use strict; 
use warnings;

...
### Start some logging ###
my $log;
my $logfile = $dist_dir/report.log;
open($log,$logfile) || die Can't write to $logfile: $!\n;
print $log $0 called at , tm, with pid $$\n;


I am not massively happy with this method. I can't seem to use a 
scalar that I can share with the rest of the script for the log file 
and if I do a perl -c myscript.pl, all the messages go to the log 
file.


Q1) Can I use a scalar instead of having to give the full file path 
in the BEGIN block? 


Yes,

our $logfile;
INIT {
$logfile = '/usr/local/myreports/report.log';
open (STDERR, '', $logfile) || die Can't write to file: $!\n;
}

I think that code should also allow perl -c myscript.pl to send output 
to the console.


I haven't tried it but I suspect is would be fall 
within the scope of the BEGIN block and as far as I know, you cannot 
declare anything before a BEGIN block. Failing that, can anyone 
suggest a different way of doing this.


Q2) You sometimes see scripts accept the verbose/debug command line 
argument. How can you implement a system so that you can ask for more 
messages? Once you've set $debug = 1; do you have to pepper your 
script with 


print $log some message\n if $debug == 1;

TIA,
Dp.



I've seen it done that way before.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Logging STDERR and other output

2007-08-30 Thread Mumia W.

On 08/30/2007 09:37 AM, Beginner wrote:

[...]

I tried the INIT option and that worked also and I liked the fact 
that my `perl -c myscript.pl` sent it's output to screen and not my 
log file and I can use a scalar for logfile. 

q1) Does this still give me the effect of getting any errors from the 
other modules directed to our $logfile?




Probably not. There's no better way than to try it and see if it works. 
Read perldoc perlmod too.



q2) Will our $logfile now be a shared variable across all my modules?



Try it and see.

q3) The $debug/verbose question: Will I have to pass subroutines in 
other modules the $debug value if I am going to ask for more output, 
or if I do the same to $debug as I did with $logfile, use our instead 
of my. Will that allow those subroutines to check if debug is 
enabled?


Sorry seem to have added more questions somehow?
Dp.




Most people create a logging module if they want total control over 
logging. That module might have a packag $debug_level variable that 
determines how much information is logged.


However, the Perl error and warning messages don't fit your logging 
model, so you'll probably have to write something yourself or find it on 
CPAN.





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Problem in opening the file using Tail Module

2007-08-29 Thread Mumia W.

On 08/29/2007 04:41 AM, sivasakthi wrote:

Hi Guys,

I have used the  following code to print the log files. but nothing is
printed  even it doesn't show the warning message,  no prompt is
returned.
what is the mistake in code , could u help me to find the pbm???

#!/usr/bin/perl
use strict;
use warnings;

use File::Tail;
my $file=File::Tail-new(/some/log/file/path); 
while (defined(my $line=$file-read))

{
print $line;
}


Thanks,
Siva




It works for me.

Maybe you want to change one of the intervals or timeouts for 
File::Tail. It could be that your log file is updated infrequently.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Redirecting to another url with parameters using post method

2007-08-27 Thread Mumia W.

On 08/26/2007 07:47 PM, Gunnar Hjalmarsson wrote:

[...]
Btw, is this technique properly documented anywhere, or would it be a 
suitable addition to perlfaq9?




It's not asked that frequently.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Redirecting to another url with parameters using post method

2007-08-27 Thread Mumia W.

On 08/27/2007 03:50 AM, Praveena Vittal wrote:

hi All,

Thanks for all your replies...

Actually i tried the small program like below:

#!/usr/bin/perl
use CGI;
my $query =new CGI;

some other stuffs will be here--


What other stuffs? If those other stuffs output body text, it'll be too 
late to send HTTP headers, and the redirection is done from within the 
HTTP headers.



print $query-redirect('http://google.com');



This does not do a POST redirection.



When i run this code i am getting a blank page with the following 
printed in the screen...


Status: 302 Moved Location: http://google.com



That suggests that you output something that prevented your status and 
location statements from making it into the headers.



and not redirecting to the url given...

Can you please tell me the reason for the same?

I need to send the parameters via POST method without any confirmation 
from the users...


Thanks  Regards,
Praveena



Nope, user confirmation is required if the browser is honoring the 
redirection.


Read RFC 2616 (HTTP):
http://www.w3.org/Protocols/rfc2616/rfc2616.html



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: substitution key-value

2007-08-27 Thread Mumia W.

On 08/27/2007 03:59 AM, Petra Vide Ogrin wrote:

Hi all,

I have a hash and some prose text and want my perl to identify the keys of
the hash in this text and replace them with the corresponding values of
the keys.

I tried the following

foreach (keys %expan) {
  if ($sbl =~ m/$_/g) {
$sbl =~ s/$_/$expan{$_}/g;
  }
}

but it doesn't seem to work properly. What am I doing wrong?

Thanks for the help,
best,
Petra



Try this (untested):

my $keys = join('|',keys %expan);
$sbl =~ s/($keys)/$expan{$1}/g;

Read this: http://perldoc.perl.org/perlre.html


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Redirecting to another url with parameters using post method

2007-08-26 Thread Mumia W.

On 08/25/2007 07:39 PM, Gunnar Hjalmarsson wrote:

Mumia W. wrote:

On 08/25/2007 04:32 PM, Gunnar Hjalmarsson wrote:

Jeff Pang wrote:

2007/8/25, Praveena Vittal [EMAIL PROTECTED]:

 I want to redirect to a different url with the parameters in the post
method.


Well,see 'perldoc CGI' and specially check for,
param,
redirect.


How do you combine a POST request and a 'Location:' header (which is 
what CGI::redirect prints AFAIK)?


I think this is called a Status 307 Temporary Redirect. See RFC 2616 § 
10.3.8.


This is the last para of that section:
If the 307 status code is received in response to a request other than 
GET or HEAD, the user agent MUST NOT automatically redirect the request 
unless it can be confirmed by the user, since this might change the 
conditions under which the request was issued.


So I don't think that 307 is the proper status code for a redirect via a 
POST request. In any case it doesn't answer the question how you do it, 
does it?




I do wish the Praveena had been more specific about what he or she is 
trying to do, but, if status 307 is appropriate, this is how it can be 
done with CGI.pm:


use strict;
use warnings;
use CGI;

# You set the $location.

print CGI::header(
-status = '307 Temporary Redirect',
-location = $location,
);


__END__

An HTTP body should also be provided with a link to the new resource, 
but it is not required.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Redirecting to another url with parameters using post method

2007-08-25 Thread Mumia W.

On 08/25/2007 04:32 PM, Gunnar Hjalmarsson wrote:

Jeff Pang wrote:

2007/8/25, Praveena Vittal [EMAIL PROTECTED]:

 I want to redirect to a different url with the parameters in the post
method.


Well,see 'perldoc CGI' and specially check for,
param,
redirect.


How do you combine a POST request and a 'Location:' header (which is 
what CGI::redirect prints AFAIK)?




I think this is called a Status 307 Temporary Redirect. See RFC 2616 § 
10.3.8.





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: regex help

2007-08-22 Thread Mumia W..

On 08/21/2007 07:41 AM, Tony Heal wrote:

the list is a list of files by version. I need to keep the last 5 versions.

Jeff's code works fine except I am getting some empty strings at the beginning 
that I have not figured out.

Here is what I have so far. Lines 34 and 39 are provide a print out for 
troubleshooting. Once I get this fixed all I
need to do is shift the top five from the list and unlink the rest.

#!/usr/bin/perl

use warnings;
use strict;

opendir (REPOSITORY, '/usr/local/repository/dists/');
my @repositories = readdir (REPOSITORY);
closedir (REPOSITORY);

my $packageRepo;
my @values;
my @newValues;
foreach (@repositories)
{
$packageRepo = $_;
chomp ($packageRepo);
opendir (packageREPO, 
/usr/local/repository/dists/$packageRepo/non-free/binary-i386);
my @repoFiles = readdir (packageREPO);
close (packageREPO);
foreach (@repoFiles)
{
my $fileName = $_;
chomp ($fileName);
if ( /(.*)(([0-9][0-9])(-special)?\.([0-9])(-)([0-9]*))(.*)/)
{
push (@values, $2);
}
}
my %h;
	foreach (@values) 
	{

push (@newValues, $_) unless $h{$_}++
}
foreach (@newValues){print $_\n;}
	my @new = map { $_-[0] } 
	sort { $b-[1] = $a-[1] } 
	map { [$_,(split/-/)[-1]] } 
	@newValues;

print @new[0..4]\n;
}


Or for a line numbered version
http://rafb.net/p/asqgJo27.html

Tony Heal





[oops, sent to the wrong list before]

Sort::Maker should make short work for this task ;-)

All you have to do is to make a regex to pull out the version numbers.
After that, you're practically done:

use strict;
use warnings;
require Sort::Maker;

open (pkgREPO, '', 'data/versions-list.txt')
or die no versions list: $!;

my @versions;

while (my $line = pkgREPO) {
chomp $line;
push @versions, [ $line, $line =~ /^(\d+)(?:-[a-z]+)?\.(\d+)-(\d+)/ ];
}

close pkgREPO;

my $sorter = Sort::Maker::make_sorter(
'ST',
number = '$_-[1]',
number = '$_-[2]',
number = '$_-[3]',
);
die $@ unless $sorter;

my @sorted = $sorter-(@versions);
print keep: $_-[0]\n for @sorted[$#sorted-4 .. $#sorted];
print delete: $_-[0]\n for @sorted[0 .. $#sorted-5];

__END__

This is the output:

keep: 16.5-2
keep: 16-special.5-2
keep: 16.5-10
keep: 16.5-13
keep: 16-special.6-6
delete: 14-special.1-2
delete: 14-special.1-8
delete: 14-special.1-15
delete: 14-special.2-40
delete: 14-special.2-41
delete: 14-special.3-4
delete: 14-special.3-7
delete: 14-special.3-12
delete: 15-special.1-52
delete: 15-special.1-53
delete: 15-special.1-54
delete: 15.2-108
delete: 15.2-110
delete: 15.2-111
delete: 15.3-12
delete: 16.1-17
delete: 16.1-22
delete: 16.1-23
delete: 16.1-39
delete: 16.3-1
delete: 16.3-6
delete: 16.3-7
delete: 16.3-8
delete: 16.3-15
delete: 16-special.4-9
delete: 16-special.4-10
delete: 16.5-1
delete: 16-special.5-1






--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Perl LWP post to a web form

2007-08-10 Thread Mumia W.

On 08/10/2007 03:00 PM, Typos wrote:

I'm trying to post to a web form and get the results back,
I've tried but it seems that I am not posting anything to the page.
What am i doing wring ?
[...]

my $response = $browser-post( $URL,
[ 'searchtype' = '3';
]
);

print $response-decoded_content;




You have a semicolon after '3'. I'm sure you wanted to put a comma there.

What did you server logs say? Surely an error messsage appeared in your 
server logs.





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Conditional module loading

2007-08-07 Thread Mumia W.

On 08/07/2007 10:18 AM, Fermín Galán Márquez wrote:

Hi!

I'm trying to introduce conditional module loading in a Perl program, 
but I'm experiencing problems. For example:

[...]


Use is done at compile-time, so both modules will have been loaded 
before the if statement is executed. When you wish to load modules at 
run-time, use require, e.g.:


if ($some_condition) {
   require ModuleA;
   ModuleA-import;
   (doing something using ModuleA)
}
else {
   require ModuleB;
   ModuleB-import;
   (doing something using ModuleB)
}



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: problem with Sterling pound sign

2007-08-06 Thread Mumia W.

On 08/06/2007 05:52 AM, Dermot Paikkos wrote:

Hi All,

CGI;
Mime::Lite;

I am trying to take the input from a text field from a html page and 
send it as an email. The text contains a UK sterling £ sign. It looks 
fine on in the html page but when I send the mail or output the text 
to STDERR, it gets transformed into this: £

[...]


Evidently you forgot to set the correct charset in your HTTP headers. 
You're outputting UTF8 data, so you want to put that in the headers.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: customizing eof chatacter

2007-08-05 Thread Mumia W.

On 08/05/2007 07:21 AM, Jorge Almeida wrote:

Is there some variable that will do for a file what $/ does for a
record?
What I mean is that in
$s=STDIN
the value of $s depends on the value of $/, but in
@arr=STDIN
I couldn't find a way to force the reading to stop when some character
is found.
Note that reading STDIN line by line and checking for a character won't
do the job, because somewhere in the program I need something like
open(F,do-something|);
while(F){...}
and later
open(G,do-something-else|)
while(G){...}
So, assuming that the program's standard input is redirected from some
file, I would need a way to divide the file into chunks, so that each
chunk would be treated as the whole STDIN each time @arr=STDIN or
open(F,do-something|) appears in the program.
Any suggestion?


What do F and G have to do with STDIN?

The code while(F){...} does not read from STDIN but from F.

There is no EOF character under Linux. Are you working under Windows?



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Problem with my code

2007-08-05 Thread Mumia W.

On 08/06/2007 12:32 AM, Jeff Pang wrote:

[...]
while(my $obj = readdir DIR) {
next if $obj =~ /^\.+$/; #or [...]


More, precisely, you might use this:

next if $obj =~ /\A\.\.?\z/;




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Howto strip html from a $calar with HTML::Parser

2007-08-03 Thread Mumia W.

On 08/03/2007 03:30 AM, Alan C wrote:

[...]
I do not need to print to STDOUT

Is the print @ line in the sub doing this?
[...]


Yes.

Why not append the text to $string instead of printing the text?



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: parsing a log file by date

2007-08-02 Thread Mumia W.

On 08/01/2007 10:24 PM, Jeff Pang wrote:

[...]
$ perl -e 'print true if 1=1'
Can't modify constant item in scalar assignment at -e line 1, at EOF
Execution of -e aborted due to compilation errors.
[...]


perl -le 'print true if 1==1'

perldoc perlop




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: FILEHANDLE problem

2007-08-01 Thread Mumia W.

On 08/01/2007 02:51 PM, Johnson, Reginald (GTI) wrote:

I don't see what I am doing wrong here. I am trying to print to the
filehandle LINOUT but nothing is being printed to the file.
Ultimately I want to monitor the input file and when it is written to I
want to take the update and put into another file for processing.
[ program snipped ]


I hope you're familiar with the perldoc utility:

perldoc -q tail


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Q: cannot use 'use base' without quote ?

2007-07-18 Thread Mumia W.

On 07/18/2007 12:13 AM, Jack Minoshima wrote:

[...]
Please tell my why I need quote after use base while using strict subs.
Thank you very much in advance !
-- jackm



The first explanation is that the module's documentation suggests that 
the quotes are required.


The second quick explanation is that Perl automatically quotes barewords 
for you unless you use strict 'subs'



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: formatting a string

2007-07-04 Thread Mumia W.

On 07/03/2007 08:32 PM, Joseph L. Casale wrote:

I have an array with the following data in it:

/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/AN-DC 
(Win2003 Ent x64).vmx
/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/Disc 
1.vmdk
/vmfs/volumes/467f06a5-7d59c067-35cb-0007e9153886/AN-DC (Win2003 Ent x64)/Disc 
2.vmdk

I always deal with indices' 1 through to the end in the function in question, so it's easy to get 
the second indices (First disc) and so on. I need to manipulate the path though now, I am wanting 
to search for *all* the text following the third / and before the fourth / 
and replace it with a string variable. So far, this is seeming to be way over my current capacity :)

Can anyone point me to the topic/method I should use so I may read up on build 
this myself?

Thanks!
jlc





File::Spec-splitdir will let you split the string into directories 
which you can manipulate individually.


Or you can just use the split function to split on /.

Good luck.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: TWO loops and ONE if statement

2007-07-03 Thread Mumia W.

On 07/03/2007 02:53 AM, Amichai Teumim wrote:

Hi guys



Hello Amichai.


[...]
I need to sort the @array from lowest to highest using TWO loops and
ONE if statement. That's why it's so confusing.
I could use a one liner to do all this. I need to do it however as
above mentioned.

How can I do this?

Thanks for all your help

Amihai



Your teacher wants you to figure out how to do a bubblesort.
(That's a hint.)


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: using a homemade perl module

2007-06-29 Thread Mumia W.

On 06/28/2007 10:22 PM, Mathew Snyder wrote:


I'm getting a strange bit of behaviour.  I have everything set up right and my 
dates are getting made up properly however, one sub which creates the searchDate 
array isn't being called.  I have to enter the full module path 
(Reports::Dates::searchDate) for it to work while all of the other dates are 
called without problem using just the sub name.  Any thoughts on why this might be?




It works for me. People can only guess at the problem you're having 
because you didn't show the program that is failing.


Also, the functions in Reports/Dates.pm are undocumented.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: using a homemade perl module

2007-06-28 Thread Mumia W.

On 06/28/2007 03:00 AM, Mathew Snyder wrote:


our @ISA = qw(Exporter);
our @EXPORT  = qw(startDate endDate searchStart searchEnd);
our $VERSION = '1';



Those lines need to be within a BEGIN block. See perlmod:

http://perldoc.perl.org/perlmod.html




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: using a homemade perl module

2007-06-28 Thread Mumia W.

On 06/28/2007 07:46 AM, Paul Johnson wrote:

On Thu, Jun 28, 2007 at 06:58:36AM -0500, Mumia W. wrote:


On 06/28/2007 03:00 AM, Mathew Snyder wrote:

our @ISA = qw(Exporter);
our @EXPORT  = qw(startDate endDate searchStart searchEnd);
our $VERSION = '1';

Those lines need to be within a BEGIN block. See perlmod:


Are you sure?

The package name should be Reports::Dates, not just Dates.



Ah, yes you're right.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: CPAN shell (LWP, Net::FTP) won't authenticate properly

2007-06-25 Thread Mumia W.

On 06/25/2007 12:40 PM, RICHARD FERNANDEZ wrote:

[...]
I'm not sure where else to go with this. It looks like I can eventually
get what I need installed, but not without a long bumpy ride first.
[...]


A nice feature for someone to add to CPAN.pm would be the option to set 
the preferred ftp option.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: nevermind

2007-06-23 Thread Mumia W.

On 06/23/2007 04:30 AM, Mumia W. wrote:

[...]
You also could have written it this way:

open AUTHFILE, /home/customercare/authorized_users.txt
  or die Can't open file: $!;
@email_list = grep !/^#/, AUTHFILE;


chomp @email_list;


close AUTHFILE;



:-)



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: nevermind

2007-06-23 Thread Mumia W.

On 06/23/2007 03:18 AM, Mathew Snyder wrote:
You'll notice in the section that creates the filehandle I have a statement that 
says next if $address =~ m/^#/gmx;.  I had to escape the #.  Can anyone tell 
me why that is?  It isn't a special character for regexes that I've ever seen used.


Thanks,
Mathew


Why did you change the subject to nevermind? The subject didn't change.

You used the /x modifier which allows for comments within regular 
expressions. Remove /x, and the old regex will work as expected.


Read perldoc perlre too.

You also could have written it this way:

open AUTHFILE, /home/customercare/authorized_users.txt
  or die Can't open file: $!;
@email_list = grep !/^#/, AUTHFILE;
close AUTHFILE;




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Uninstalling a PERL module

2007-06-22 Thread Mumia W.

On 06/22/2007 03:46 PM, a_arya2000 wrote:

Hello, does anyone know what is the most effective way
of uninstalling perl module? Thank you.



As you know, going into the build directory for a module and executing 
make uninstall doesn't yet work for CPAN-installed modules :-)


For most modules, there is a .packlist file that lists all of the files 
that were installed by that module. Delete every file listed in the 
.packlist, then delete the .packlist file itself, and you've uninstalled 
the module.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: still working with utf8

2007-06-21 Thread Mumia W.

On 06/21/2007 09:42 PM, Tom Allison wrote:
OK, I sorted out what the deal is with charsets, Encode, utf8 and other 
goodies.


Now I have something I'm just not sure exactly how it is supposet to 
operate.


I have a string:
=?iso-2022-jp?B?Rlc6IBskQjxkJDckNSRHJE8kSiQvJEYzWiQ3JF8kPyQkGyhC?=
That is a MIME::Base64 encoded string of iso-2022-jp characters.

After I decode_base64 them and decode($text,'iso-2022-jp',utf8') them I 
can print out something that looks exactly like japanese characters.


But you can't match /(\w+) on them.  It's apparently one word without 
spaces in it.
Um... I don't know Japanese.  But I guess this string of spaghetti (to 
me) is actually a language where one character as represented in a 
unicode terminal is actually one 'word' according to the perl definition 
of a word...


In english, this would pick apart words in a sense that is simple for me 
and many on this list to understand.


I guess my question is, for CJK languages, should I expect the notion of 
using a regex like \w+ to pick up entire strings of text instead of 
discrete words like latin based languages?




Sadly, I must admit that I'm operating way outside of my knowledge 
domain on this one, but I'll try to give an answer.


Yes, be prepared for the fact that not all foreign languages will 
support the concept of spaces between words. I don't know anything about 
Japanese, but I do vaguely remember from high school that, for Chinese 
texts, there are often no spaces between words and the reader's 
knowledge of the language allows him or her to infer the word separations.


However, even without knowing Japanese, we might be able to help you 
find acceptable solutions. What is your program supposed to do?



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Set time period for a statement to execute

2007-06-20 Thread Mumia W.

On 06/20/2007 02:07 AM, anand kumar wrote:

Please guide me with some code or documentation for the following problem :-
   
  I need to set some specific time for a command to execute. [...]
   


The alarm function might help you:

At a command prompt, type perldoc -f alarm



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Alternatives to highly nested hashes

2007-06-20 Thread Mumia W.

On 06/20/2007 05:40 AM, Mathew Snyder wrote:
It looks like an object is what I want.  Am I correct?  


As always, it depends.


Suppose I need to work
with a bit of data that actually has 11 attributes.  This would be an object of
another type.  However, I need to manipulate pieces of it differently.  So I'm
guessing I would create an object thusly:

sub objectname {
my %hashOfAttribs {
attrib1 = undef,
attrib2 = undef,
attrib3 = undef
}
}



No.


I would then create an instance of that object

my $instance = new objectname();

I'm not certain though, how to populate the elements.  would it actually be
my $instance = new objectname(attrib1 = value, attrib2 = value, attrib3 =
value)?  Or would I create the instance as above and then populate it by some
other means?  For instance
$instance-hashOfAttribs {
attrib1 = value,
attrib2 = value,
attrib3 = value
};

Am I at least on the right track?



Not really. First, it hasn't been conclusively established that you need 
objects. You haven't described the data and what you want to do with it.


Second, objects are created using the methods described in perldoc 
perlboot, perldoc perltoot and perldoc perltooc.


However, you can simplify things considerably by using Class::Struct, e.g.:

use Class::Struct ObjectName = [
attrib1 = '$',
attrib2 = '$',
attrib3 = '$',
children = '$',
];

 ...

my $instance = ObjectName-new(
attrib1 = '10',
attrib2 = [1, 20, 1943],
attrib3 = 'Hello',
children = []);




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Reading a particular line from a file

2007-06-20 Thread Mumia W.

On 06/20/2007 06:42 AM, Nath, Alok (STSD) wrote:

Hi,
Is it possible to read a particular line by line number ?

For e.g reading line 3 from a file.

I don't want to read each line and count.

Thanks
Alok



The module Tie::File makes this easy. However, you should probably read 
this anyway:


http://faq.perl.org/perlfaq5.html#How_do_I_change_dele




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Trouble installing with CPAN

2007-06-20 Thread Mumia W.

On 06/20/2007 08:40 AM, yitzle wrote:

I took down the firewall and got the same results.

Could not fetch authors/id/K/KA/KASEI/Crypt-Simple-0.06.tar.gz
Giving up on 
'/home/Admin/.cpan/sources/authors/id/K/KA/KASEI/Crypt-Simple-0.06.tar.gz'
Note: Current database in memory was generated on Sat, 05 May 2007 
21:09:57 GMT




May 5th is too long ago. Those mirrors might not be up-to-date; they 
might not even be CPAN mirrors anymore.


I suggest going through the entire CPAN configuration again: o conf 
init; you'll get a chance to select a new set of mirrors and other options.


Probably the indexes will be re-downloaded after you've finished the 
configuration, but if they're not, do reload index







--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: value of variable switches from ' ' to 'value'

2007-06-17 Thread Mumia W.

On 06/17/2007 12:36 AM, Mathew Snyder wrote:

[...]
In the debugger I've set the 'w' command to watch the variable containing the
day being looked for ($day).  I would have thought $day stays the same throught
an iteration of the while loop but the debugger keeps stopping to tell me it
switched from '2007-06-15' (for instance) to ''.  I then continue and it tells
me it switched back from '' to '2007-06-15'.  Is it supposed to do that?
Shouldn't the $day variable remain constant?
[...]


The variable $day on line 50 is restricted to the scope of the for loop. 
I suspect that $day becomes empty or undefined when execution goes into 
a subroutine who's scope is outside of the for loop.





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: character encoding regex

2007-06-16 Thread Mumia W.

On 06/16/2007 02:29 PM, Tom Allison wrote:
I'm trying to do some regular expression on strings in email. They could 
be encoded to something.  But I can't tell because I don't have a utf8 
unicode xterm window that will show me anything.  At best I get 
?a??  and other trash like that.  I think this is typical for ascii 
text renderings of two-bit characters.


Not be to deterred by the lack of anything this fancy in xterm I thought 
I would plug along.


I made a character thus:
my $string = chr(0x263a);  # reported to be a smiley face...

under 'use bytes' this prints as a ':'
without bytes this prints to something resembling a, a little box, a 
little circle.



And with unicode and locales and bytes it all gets extremely ugly.


I found something that SpamAssassin uses to convert all this goo into 
a repeatable set of characters (which is all I'm really after) by 
running something that looks like this:




What do you mean by a repeatable set of characters? Unicode characters 
are repeatable.



sub _quote_bytea {
my ($str) = @_;
my $buf = ;
foreach my $char (split(//,$str)) {
my $oct = sprintf (%lo, ord($char));
if (length( $oct )  2 ) { $oct = '0' . $oct; }
if (length( $oct )  3 ) { $oct = '0' . $oct; }
$buf .= '' . $oct;
}
return $buf;
}

Which is also ugly in it's own right.  But I found mention that the 
%lo is considered really backward compatable notation and not 
something you might want to use (or need to) in perldoc -f sprintf.




The way I read it, it says that %O is a backward compatible version of 
%lo.


So one question I have that might be useful is, what alternatives does 
modern perl offer to %lo ?


I probably have a lot more, but I honestly am not sure if I can get an 
answer I can live with.  I'm just trying to tokenize email and haven't 
seen a need to support these other character sets just yet.  I would 
like to.  But I haven't been able to find any sane way of doing it -- 
like can I convert everything into utf8 format or just convert 
everything into octal numbers?  I don't need perfect human-readable 
conversion, I just need consistent conversions.




You probably should convert everything to utf8. Also, you need a 
utf8-enabled xterm such as rxvt-unicode or gnome-terminal. On my Debian 
Etch system, the text console seems to be UTF8 by default :-O


BTW, I still have no clue what you mean by tokenize e-mail.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: character encoding regex

2007-06-16 Thread Mumia W.

On 06/16/2007 05:01 PM, Tom Allison wrote:

Mumia W. wrote:


On 06/16/2007 02:29 PM, Tom Allison wrote:
I'm trying to do some regular expression on strings in email. 
[...]

And with unicode and locales and bytes it all gets extremely ugly.

I found something that SpamAssassin uses to convert all this goo 
into a repeatable set of characters (which is all I'm really after) 
by running something that looks like this:




What do you mean by a repeatable set of characters? Unicode 
characters are repeatable.


The fundamental problem is that this:

$string =~ /(\w\w\w+)/
returns nothing because unicode/utf8/Big5 characters are not considered 
'words'.

[...]


Many UTF8 characters are words, and many are not. Consider this program 
(written in utf-8):


#!/usr/bin/perl
use strict;
use warnings;
use encoding 'utf8', 'STDOUT', 'utf8';

my $string2 = '☺ 膄 膅 膆 ☺
á é í ó ú ¶ | ✗ ∷ е み む も
ä ë ï ö ü µ  ± × ṁ · ';

my @wchars = $string2 =~ /(\w)/g;
print @wchars\n;

exit;
__END__

My output for this program is this:

膄 膅 膆 á é í ó ú е み む も ä ë ï ö ü µ ṁ

Notice that some characters made it and some didn't. In order to do this 
right, I had to enable a utf8 locale in my Debian O/S [ :-) ]. Then I 
set LANG=en_US.UTF-8 before writing the program in vim.


Furthermore, I had to tell Perl that the program was written in utf8 
using the 'encoding' module.


Basically, the '\w' in a regular expression is sensitive to the current 
locale, and if utf8 is enabled in the locale, '\w' will (probably) know 
which unicode characters are word characters and which are not.


BTW, I don't know Chinese or Korean. I just know how to play with vim 
digraphs enough to enter random foreign characters--sort of like a 
monkey banging on a computer keyboard :-)



And I don't really care to get exactly the right character.
I could just as easily use the character ascii values, but the regex for 
that is not something I'm familiar with.


I got this far:
my $string = chr(0x263a);
my @A = unpack C*, $string;

# @A = ( 226, 152, 186 )

At least this is consistent.
But there are a lot of characters that I want to break on and I don't 
know that I can do this.  The best I can come up with is:


my $string = chr(0x263a);
$string = $string .' '. $string;
print $string,\n;
foreach my $str (split / / ,$string) {
my @A = unpack C*, $str;
print FOO: @A\n;
}
exit;

Using the above I can get a consistent array of characters but I don't 
know if this will work for any character encoding.  I guess this is part 
of my question/quandry.


One thing I'm not sure about is if the MIME::Parser is even decoding 
things sanely.  I suspect it isn't because I get '?' a lot.


I installed urxvt from my Debian installation [ :) ] and I get...



:-)


Wide character in print at unicode_capture.pl line 5.
âº
Wide character in print at unicode_capture.pl line 9.
⺠âº
FOO: 226 152 186
FOO: 226 152 186

However it doesn't print the boxes, which is good.




Put use encoding 'iso-8859-1', STDOUT = 'utf8'; at the top of your 
file. Also read up on the encoding module (perldoc encoding).


This will probably work a lot better if you've configured your system to 
support a utf8 locale:


http://www.debian.org/doc/manuals/reference/ch-tune.en.html#s-activate-locales

BTW, you're using a great O/S ;-)



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: cgi-bin will not execute perl program

2007-06-14 Thread Mumia W.

On 06/14/2007 02:24 AM, whitsey wrote:

Mumia W. wrote:

On 06/12/2007 09:38 PM, whitsey wrote:

[...]
Directory /usr/local/apache2.0.54/bindist/cgi-bin
AllowOverride None
Options None


You need Options ExecCGI or (more probably) Options +ExecCGI


The Apache/Tomcat documentation states that the ScriptAlias
directive automatically assigns the alias as a cgi-bin, therefore all
files within this directory are by default assigned as files to be
executed.

I did add this however is made no difference...




You're right. Your configuration code (without +ExecCGI) worked on my 
system (Apache2, Debian 3.1 i386), so I can't say why it doesn't work 
for you.





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: cgi-bin will not execute perl program

2007-06-13 Thread Mumia W.

On 06/12/2007 09:38 PM, whitsey wrote:

[...]
Directory /usr/local/apache2.0.54/bindist/cgi-bin
AllowOverride None
Options None



You need Options ExecCGI or (more probably) Options +ExecCGI



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Set up env variables on Linux

2007-06-13 Thread Mumia W.

On 06/13/2007 12:26 AM, [EMAIL PROTECTED] wrote:

Hi All,

I'm pretty new to Perl. I was trying to write up a perl script that
can help set up my working env, for example, once log into Linux
server, run the perl script, it'll move to another folder and
configure some env variables.

I tried using
`cd dest_folder`   or
system cd dest_folder   or
exec cd dest_folder

but after running script, the current folder doesn't change at all.
Anyone please shed some lights on this.




You can't. To change environment variables and the current directory for 
the current shell, you have to use a script for that shell (e.g. a bash 
script for a bash shell), and you have to invoke it a certain way.


For example, if your script is called myscript.sh, you'd do this:

. myscript.sh

Notice the period at the beginning of the line.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: What happened to Getopt::Std ?

2007-06-13 Thread Mumia W.

On 06/13/2007 03:03 AM, Jorge Almeida wrote:

http://search.cpan.org/search?m=moduleq=getopts=21





Hmm: http://search.cpan.org/~tty/kurila-0_02/

Hmm: http://search.cpan.org/src/TTY/kurila-0_02/

It looks like this person, TTY, uploaded a modified version of Perl to 
his/her CPAN directory. For virtually every module in Perl 5, there is a 
rouge version provided by TTY.


I don't know what is going on. It smells like an attempt to compromise 
people's systems, although it could be a mistake.


Even if it is a mistake, it's a big one--one that the PAUSE maintainers 
should not overlook. Incompetence on this scale is a danger to CPAN.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: What happened to Getopt::Std ?

2007-06-13 Thread Mumia W.

On 06/13/2007 08:29 AM, John Peacock wrote:

Mumia W. wrote:
I don't know what is going on. It smells like an attempt to compromise 
people's systems, although it could be a mistake.


Then maybe you should use Google or even look at the distro, before 
making wild accusations:


http://www.nntp.perl.org/group/perl.perl5.porters/2007/04/msg123813.html
http://search.cpan.org/src/TTY/kurila-0_02/README

The Kurila project is a fork of Perl5 without the strict backwards 
compatibility required of v5.10.0, as a theoretical experiment.  You'll 
note now that under CPAN, it shows up as


** UNAUTHORIZED RELEASE **

which should make it highly unlikely that someone will install it by 
accident.


John



mea culpa



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Database insertion, escape issue

2007-06-12 Thread Mumia W.

On 06/11/2007 06:52 PM, Northstardomus wrote:

[...]
print br/Inserting into Database , @values.;


Use the quotemeta function to escape special characters
that may be in the values.

my @values_copy = @values;
@values = map quotemeta($_), @values;



$dbh-do(INSERT INTO area_status (areaID, survey_date,
update_time,

status ) VALUES ('$values[0]', '$values[1]', '$values[2]',
'$values[3]'));
$dbh-disconnect();
}
}




Read perldoc -f quotemeta

The do method also has a better way to input the values. See the top 
of perldoc DBI


I hope this helps.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Writing data row at a time using OLE

2007-06-11 Thread Mumia W.

On 06/11/2007 08:59 AM, ash wrote:

Hi everyone!

I am using Win32::OLE for writing data in existing Excel file. I would
like to know how to write data one row at a time. Writing one cell at
a time is too slow, it took 17mins to write 527KB file.

Thank you all very much for your help :).




You might look into the Spreadsheet::WriteExcel module which has a 
write_row method.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: simple tcp socket server:Is it possible, server wait for '!' sign, not '\n'?

2007-06-10 Thread Mumia W.

On 06/09/2007 09:44 PM, yitzle wrote:

[...]
If Perl.org wasn't down, you'd want http://perldoc.perl.org/perlvar.html
I guess perldoc perlvar will have to do.
[...]


For the time being, I've placed some of the Perl docs onto my website:

http://home.earthlink.net/~mumia.w.18.spam/perldoc/
http://home.earthlink.net/~mumia.w.18.spam/perldoc/man1/perlvar.html.gz



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Usenet messages are appearing on beginners@perl.org [perl #43141]

2007-06-08 Thread Mumia W..

On 06/08/2007 07:57 AM, Peter Scott wrote:

On Wed, 06 Jun 2007 19:54:16 -0500, Mumia W. wrote:
Are you sure that's not nntp.perl.org? Thunderbird says it can't connect 
to news.perl.org, and nntp.perl.org does not seem to allow posting.


You're right.  I'm always making that mistake.



No problem. And thanks for the hint about nntp.perl.org. It's a pretty 
good archive of the list.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Usenet messages are appearing on beginners@perl.org

2007-06-07 Thread Mumia W.

On 06/06/2007 11:23 AM, kens wrote:

[...]
Am I banished forever?
Ken Slater



Don't worry. No one is banished. There is a configuration problem, and 
the more I look into it, the more I think it's related to Google.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Usenet messages are appearing on beginners@perl.org [perl #43141]

2007-06-07 Thread Mumia W.

On 06/07/2007 01:30 AM, Dr.Ruud wrote:

Mumia W. schreef:


nntp.perl.org does not seem to allow posting.


To me it does. I don't know how reliable it is, but I have been posting
and follow-upping :) via that server for quite some time now.



Yes, I just noticed. Nntp.perl.org seems to impose a delay of a few 
hours, but the messages do make it.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Usenet messages are appearing on beginners@perl.org [perl #43141]

2007-06-07 Thread Mumia W.

On 06/06/2007 11:37 PM, Mumia W. wrote:

On 06/06/2007 07:54 PM, Mumia W. wrote:

[...]
This seems to have started around the 23rd of May.




No it didn't.

I apologize to the list owner and everyone else. There are several 
news-to-mail gateways that place onto beginners[at]perl.org, and they've 
been doing it for at least a year. The problem is on my end.

[...]


Only part is on my end*.

I have to apologize again. I was right the first time. Something of 
significance with respect to Google Groups and beginners[at]perl.org 
happened on May 25th.


Before May 25, no messages with an NNTP-Posting-Host header appeared 
on this list. After May 24, such messages started to appear, and *all* 
of them have a User-Agent of G2/1.0 (Google Groups).


I've placed a CSV file and an Excel worksheet on my website; they 
demonstrate the timing of the change:


http://home.earthlink.net/~mumia.w.18.spam/msgs3.csv
http://home.earthlink.net/~mumia.w.18.spam/msgs3.xls

I hope that the list managers can stop Google's messages from making it 
to the mailing list.


* I was looking at my archive of debian-user when I concluded that there 
was no problem (Doh!)




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Usenet messages are appearing on beginners@perl.org [perl #43141]

2007-06-07 Thread Mumia W.

On 06/07/2007 09:27 AM, Tom Yarrish via RT wrote:

On Jun 7, 2007, at 3:42 AM, Mumia W. wrote:

[...]
Before May 25, no messages with an NNTP-Posting-Host header  
appeared on this list. After May 24, such messages started to  
appear, and *all* of them have a User-Agent of G2/1.0 (Google  
Groups).





I'm assuming this is the source of the duplicate messages I asked  
about a few weeks back?


Tom


Perhaps.

Many of the Google Groups messages seem to have a To: header like so:

To: beginners@perl.org, [EMAIL PROTECTED]

That header was sampled from message id 
1180713180.391212.86030[at]g37g2000prf.googlegroups.com (at symbol 
munged to prevent Google munging).


That could explain some duplicates. However, some GG messages on this 
list don't have perl-beginners[at]moderators.isc.org in the To: header, 
so GG has another way of getting messages onto this list.





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Ram disk filling up - File::COPY

2007-06-07 Thread Mumia W.

On 06/07/2007 04:41 AM, Perl WANNABE wrote:

Hi,

I'm trying to copy a couple of DBM files from a disk to a RAM disk, one of the 
files is 500M the other quite small.
[...]


It looks to me like you're trying to copy a 499MB file onto a 254MB ramdisk.

Since 499 is greater than 254, the file won't fit.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Usenet messages are appearing on beginners@perl.org

2007-06-06 Thread Mumia W.

On 06/05/2007 10:36 PM, Chas Owens wrote:

On 6/5/07, Mumia W. [EMAIL PROTECTED] wrote:

A horrible thing has happened recently.

Messages from usenet seem to be appearing here.

snip

Some of the junk that
goes on on usenet doesn't need to happen here.

snip

The method of connecting to the list shouldn't matter.  We have
standards of conduct and those  who do not wish to follow them will be
asked not to post anymore.  Let's not go looking for trouble that
doesn't exist yet.



The problem is the certain people have developed certain demeanors on 
the Perl usenet newsgroups. Now whenever these people post to the Perl 
newsgroup perl.beginners, their posts will be reflected here on 
beginners[at]perl.org.


These people will never change, and I killfiled them a long time ago, 
but they will still change the character of this mailing list, and that 
I don't want.


There are two problems with asking them to leave:

1) They won't leave.

2) Where do they go? They've been posting to the perl.beginners 
newsgroup for ages, and when they post to that newsgroup, they should 
have no expectation that they messages will be reflected to our mailing 
list.


The problem is a gross misconfiguration somewhere that needs to be fixed 
ASAP. I hope that Google is not involved. Google has been doing to 
pretty weird things lately with mailing lists and moderators[at]isc.org 
(which presumably facilitates posting to moderated newsgroups).


I understand that Google has a big presence on usenet, but I hope that 
they haven't used that power to arbitrarily affect a major change to the 
structures of usenet and the mailing lists.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Perl can bind bash?

2007-06-06 Thread Mumia W.

On 06/06/2007 02:30 PM, jonatan perry wrote:

I would like to know if there is a way to BIND Perl and BASH, can someone
suggest a good way?
thanks
  Jonatan Perry.



Perhaps you could use the Shell module.

What are you trying to do?


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Usenet messages are appearing on beginners@perl.org [perl #43141]

2007-06-06 Thread Mumia W.

On 06/06/2007 08:36 AM, Peter Scott wrote:

On Tue, 05 Jun 2007 18:03:09 -0500, Mumia W. wrote:

A horrible thing has happened recently.

Messages from usenet seem to be appearing here.

I remember that messages posted to the list were reflected to the 
newsgroup perl.beginners, but newsgroup posts to perl.beginners didn't 
seem to show up here. Now they do :_(


I hope this is just a configuration mistake--not a change in policy. We 
definitely don't need usenet participants participating here. We have a 
pretty nice list. People are good to one another. Some of the junk that 
goes on on usenet doesn't need to happen here.


People who want usenet should subscribe to usenet newsgroups. I 
shouldn't have to see usenet happen on a mailing list I like. Whoever is 
in charge, I implore you to change the configuration of the maillist so 
that these usenet message don't come here any more.


Would you be more specific about how you have observed this and what you
mean by Usenet?



Google Groups posts to perl.beginners are showing up in the mailing list 
beginners[at]perl.org.



I have been using a newsreader to read and post to this group ever since
it was created, because like all the mailing lists hosted on perl.org, it
is bidirectionally gatewayed with the NNTP server at news.perl.org.  But
that server does not, AFAICT, exchange articles with the global network
known as Usenet.  I just added news.perl.org to my pan server list.



Are you sure that's not nntp.perl.org? Thunderbird says it can't connect 
to news.perl.org, and nntp.perl.org does not seem to allow posting.



A few years ago, Google started picking up the perl.org mailing
lists/newsgroups in Google Groups under the perl.* hierarchy.  I imagine
at that time it became possible to post to them from Google Groups as
well, although I've never tried and have no evidence of it.

I don't see anything 'recent' there.



For whatever reasons, some usenet servers carry perl.beginners. 
Traditionally, posts to the perl.beginners newsgroup didn't appear in 
the mailing list. Now they do, and all such posts I've found have 
originated from Google.


This seems to have started around the 23rd of May.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Usenet messages are appearing on beginners@perl.org [perl #43141]

2007-06-06 Thread Mumia W.

On 06/06/2007 07:54 PM, Mumia W. wrote:

[...]
This seems to have started around the 23rd of May.




No it didn't.

I apologize to the list owner and everyone else. There are several 
news-to-mail gateways that place onto beginners[at]perl.org, and they've 
been doing it for at least a year. The problem is on my end.


A few simple additional filters will possibly do me well.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Command Splice()

2007-06-05 Thread Mumia W.

On 06/05/2007 08:38 AM, Xu, Lizhe wrote:

[...]
I am confused about what the splice command does with the shift command =
and what the result of the command. Thanks.


Hello Lizhe. When you want information about a Perl function, you can 
get it using the perldoc utility, like so:


Start-Run-perldoc -f splice

Start-Run-perldoc -f shift

To get an overview of the information available through perldoc, do this:

Start-Run-perldoc perl

I hope this helps you in the future.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Leaving this list.

2007-06-05 Thread Mumia W.

On 06/05/2007 06:47 AM, Ron Goral wrote:

I am leaving this list even though I've been here for several years. While I
find the information and ideas exchanged very helpful, I am fully disgusted
by the amount of spam I receive. Over this last weekend, of 172 emails I
received from this list, 52 were spam. That's nearly 1 in every 3. I am told
that I get this spam simply because I sent a couple emails to the list and
that exposed this exclusive address to these spammers. Well, say what you
will, but I feel it is the list manager's job to protect me from this crap.
Since they either can't or won't, I'm signing off and deleting this mailbox.





I almost never get spammed to the address I use for this list. Spammer's 
don't like to send to e-mail addresses that have certain words in them, 
and my address has them both.


Anyway, I must disagree with you when you say it's the list-manager's 
responsibility to protect you from spam. No, your mailbox is your 
responsibility.


Unsubscribing deleting the mailbox and resubscribing with a better 
address is the smart option.


There are several things you can do as part of your responsibility to 
protect your mailbox from spam:


1) Use a mailbox that's specifically set up to receive mail only from 
this list. It's filters would send any message that doesn't have 
List-Id: beginners.perl.org to the trash.


2) Subscribe with an e-mail address that spammers don't like to 
spam--like I do.


3) Use a mailreader that has better junk filters such as Mozilla 
Thunderbird. You can obtain it from here: http://www.mozilla.com/


4) Unsubscribe.

Whatever you do, you don't use an exclusive e-mail address to post to 
a publicly accessible mailing list that's archived on the web.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Usenet messages are appearing on beginners@perl.org

2007-06-05 Thread Mumia W.

A horrible thing has happened recently.

Messages from usenet seem to be appearing here.

I remember that messages posted to the list were reflected to the 
newsgroup perl.beginners, but newsgroup posts to perl.beginners didn't 
seem to show up here. Now they do :_(


I hope this is just a configuration mistake--not a change in policy. We 
definitely don't need usenet participants participating here. We have a 
pretty nice list. People are good to one another. Some of the junk that 
goes on on usenet doesn't need to happen here.


People who want usenet should subscribe to usenet newsgroups. I 
shouldn't have to see usenet happen on a mailing list I like. Whoever is 
in charge, I implore you to change the configuration of the maillist so 
that these usenet message don't come here any more.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: freeze after STDIN

2007-06-03 Thread Mumia W.

On 06/03/2007 01:23 AM, Ryan wrote:
Hello.  This is my first post to the List. I am just getting my feet wet 
with perl, my first programming language.




Welcome to the list Ryan.

I'm running perl 5.8.4 on Libranet linux, a now-defunct distro based on 
out-of-date Debian (Sarge or before, I think).


I am having trouble inputting a value via STDIN.

Here is my troublesome script:

#!usr/bin/perl

use strict;

open F, JunkTestText.txt;
local $/ = \*\*\*;


You set the input record separator to \*\*\*, and since the * 
character does not change meaning when backslash-escaped, the 
backslashes are ignored, so the string is the same as ***




my @sections = F;
close F;

print @sections;
print \n\n end of echo check- \n\n;

my $patient=;

print Which patient are you looking for?\n;
chomp($patient = STDIN);
print you are looking for $patient\n;

When executed, it runs up to and including asking me for input from the 
terminal.  When I enter a value for $patient (a 7-digit number) and 
press enter, nothing happens.  The cursor goes down to the next line and 
just waits.


If I replace the whole STDIN thing with a fixed value for $patient, the 
script runs fine.


Appreciate any advice.

--Chris



Since *** is the record separator, you have to enter *** to get the 
program to continue.


Read perldoc perlvar on how to use $/ again.

I hope this helps.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: GMP for Math::BigInt not working ?

2007-06-03 Thread Mumia W.

On 06/03/2007 08:40 AM, David Unric wrote:

Any idea why the following code falls back to slow standard Perl
implementation of BigInt module instead of highspeed GMP being used ?
(no warnings, GMP module _is_ installed)

---
use Math::BigInt lib = 'GMP';

my $fac = Math::BigInt-new('4000');

print $fac-bfac(),\n;
---
time real ~ 4 secs !!



Here: time real ~ 0.12 secs



Equivalent code with the explicit use of GMP:
---
use Math::GMP;

my $fac = Math::GMP-new('4000');

print $fac-bfac(),\n;
---
time real ~ 0.08 secs !!



Here: time real ~ 0.08 secs

Perhaps the Math::BigInt::GMP module isn't being loaded by your system. 
Test it with this code:


perl -MMath::BigInt=lib,GMP -le 'print $_ for keys %INC'

On my Debian system, Math/BigInt/GMP.pm is listed.

I have Math::BigInt::GMP 1.14, and the docs say that the Math::GMP 
module is not used by Math::BigInt::GMP. Math::BigInt::GMP uses the 
binary GMP library if it's installed, so perhaps you could look there.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: GMP for Math::BigInt not working ?

2007-06-03 Thread Mumia W.

On 06/03/2007 10:42 AM, Mumia W. wrote:
[...] the docs say that the Math::GMP 
module is not used by Math::BigInt::GMP. Math::BigInt::GMP uses the 
binary GMP library if it's installed, so perhaps you could look there.






Duh. Of course you have the binary GMP library installed--otherwise 
Math::GMP wouldn't work. I'm sorry I can't find the problem for you.





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Matching of filename regular expression (was:pr warn die question)

2007-06-01 Thread Mumia W.

On 06/01/2007 11:04 AM, Ben Edwards wrote:

[...]
The variable $flist has something like '*.cvs' in it which I guess is
almost but not quite a regular expresion.

Any idea how I can find out if $file matches the filename 'mask'
$flist.  Alternatively is there a way of doing a ls and specifying a
file mask?

Ben


Try out the module Text::Glob.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-06-01 Thread Mumia W.

On 06/01/2007 12:36 PM, [EMAIL PROTECTED] wrote:

On May 31, 2:17 pm, [EMAIL PROTECTED] (Alma) wrote:

Hi ,

Urgent help.


[ snip - substantially the same thing as he posted a few days back ]

Please, if there is something you find unclear about the answers you
are given in a newsgroup or mailing list then follow-up with further
questions about the stuff you are finding unclear.
[...]


Huh? I can't find any such message from an Alma in the last few months 
on this mailing list.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: authentication check from file

2007-06-01 Thread Mumia W.

On 06/01/2007 10:53 AM, Alma wrote:

Hi All,

I have to store the authentication details like the user_id  password
in a file .

I do not want to include hard code in my file so basically what i am
trying is i wanted to authenticate the user who logged in by reading a
file which contains the user_id  pwd  then if valid , let him call
the subroutines defined  else provide him with error message..

I am using postgres db  apache2.. , my search has landed me to
mod_auth_pgsql.
[...]


No, mod_auth_pgsql does authentication from within Apache, but you seem 
to need to do authentication from within your program and independently 
of Apache.


I'd suggest that you create a database table that contains usernames and 
passwords for your users. Then you should use standard postgres database 
access (DBI) to fetch that data.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Outlook CSV Parser

2007-05-31 Thread Mumia W.

On 05/31/2007 02:32 AM, Laxminarayan G Kamath A wrote:


http://download.deeproot.in/~kamathln/outlook-encrtypted-sample.csv



Well I asked for it. :-)

It's impossible to tell where one record ends and another record begins 
with that file.





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Error:Can't locate object method prepare via package abc at xyz.pm

2007-05-31 Thread Mumia W.

On 05/31/2007 08:17 AM, Alma wrote:

[...]
$database_handle = abc-new('test','test123');
[...]


No, the 'new' method of 'abc' returns an object of type 'abc'--not a 
database handle. Review the return statement in abc::new again.





sub display()
{
my $self = shift;
my $sth = $database_handle-prepare(select * from table where status


This fails because $database_handle is not a database handle. You can 
force it to work by defining a 'prepare' method in the 'abc' package.



[...]
I am getting an error :
Can't locate object method prepare via package abc at xyz.pm

Is it not possible the way i am trying...can anyone tell me where i am
wrong.

Thanks ,
Alma







--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Outlook CSV Parser

2007-05-30 Thread Mumia W.

On 05/30/2007 12:40 AM, Laxminarayan G Kamath A wrote:
Hi PERLers, 
	We here at DeepRoot Linux were trying to parse Outlook's csv so

that I can add them to ldap addressbook.. [...]


The Perl module Text::CSV_XS would make your work much simpler, and it 
might execute a little faster.






--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: encode UTF8 - MIME

2007-05-30 Thread Mumia W.

On 05/29/2007 07:00 PM, cc96ai wrote:

I got UTF8 value %C3%A9
how could I encode it become é ?

I try encode_base64 , but no luck
maybe I miss some, anyone have idea ?




You need to provide more detail about your problem.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Outlook CSV Parser

2007-05-30 Thread Mumia W.

On 05/30/2007 03:04 AM, Laxminarayan G Kamath A wrote:

[...]
I tried a lot of different ways but just could not get the right
regexp :-(. 



I reiterate what the eminent Dr. Ruud said. I need some data to play 
with before I play with the code you posted.





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: accesing a hash of an array of hashes

2007-05-26 Thread Mumia W.

On 05/26/2007 07:17 AM, pauld wrote:

ive read a load of data in  from a CSV file with Text::CSV and ended
up with a hash (%hash) where the keys are the column labels.
my  @headings=split(/,/,$rows[0])
and then

for (my $j=1;$j$#rows;$j++)
{
my $status  = $csv-parse ($rows[$j]);   # parse a CSV string into
fields


You don't check $status to see if the parse succeeded.


my @columns = $csv-fields ();   # get the parsed fields

for (my $i=0;$i$#columns;$i++)
  {$hash{$headings[$i]}=$columns[$i];}



Now %hash contains the data for the last record processed; however, data 
from any previous records have been obliterated.



I want to  process the data once its grouped by the date field present
in $hash. So i think I want a hash of dates  where the key is that
date field
I  push onto the value the hashes of the records that contain the date

push @{$Hofdates{$hash{DATE}}},\%hash;

but im having a problem working out how to access the  individual
items in the  hashes that are elements of the array




The module Data::Dumper can help you see what's in your hash, but you 
need to rethink how you initialize the first hash (%hash).



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Why are people e-mailing perl-beginners [at] moderators.isc.org?

2007-05-26 Thread Mumia W.

Why are people CC'ing perl-beginners [at] moderators.isc.org?

This mail-list is reflected to the newsgroup, and the perl.beginners 
newsgroup is not moderated.


I've noticed that all of the Google posts (User-Agent: G2/1.0) for the 
last few weeks in beginners [at] perl.org seem to have this. Is Google 
doing this automatically? If so, why?



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: text file upload ... work around wide characters?

2007-05-23 Thread Mumia W.

On 05/23/2007 04:16 PM, Michael Higgins wrote:

-Original Message-
From: Michael Higgins [mailto:[EMAIL PROTECTED] 


Hello, List-ers --

I've come across a problem, unsure where to ask, so 
subscribed here. I upload a file through a browser. It's a 
'.txt' file and it comes as text/html. 

However, I've found some hyphen and single-quote like 
characters that are in this text file are from a higher 
codepoint... or something. What _seems_ to happen is the 
browser is stripping them and my script isn't getting all the 
info to dump into my database.


[8]


-Original Message-
From: Scott Statland [mailto:[EMAIL PROTECTED] 

The characters that you are describing, may need to be 
escaped or have their codes entered. 
It sounds like that they may have special meanings in either 
the scripting language or in the html output.


Hmm.

I guess my question wasn't clear. The issue is a file upload that is tagged
as text/html but has wide characters in it. The file doesn't make it out of
the browser right AFAICT. (If this is obviously incorrect, please post the
correction!)

A little more pain and research let me to find this:

open F, '', $ARGV[0] or die $!;
for (F){
s/([^\x00-\x7f])/sprintf('#%d;', ord($1))/ge;
print
} 


... helpful code snippet, which applied to my files before they are uploaded
gives me a new text file with lines like: Regarding the box #150; the
driver wouldn#146;t.

The cool part is that it is uploaded fully and when viewed in a browser the
characters are displayed correctly. Duh.

Now, if I could only get the browser to fix it up like this when sending...
rather than what it was doing. Since it's going to a *nix box, I don't care
about the text/binary thing, right? I guess I could test from a 'nix Firefox
and see if the behaviour is different.

Anyone have a thought on what is happening that the browser upload fails to
accommodate text with wide chars? I don't know how it determines ... maybe
if the first char was wide, it'd go up as a different mimetype?

Cheers,

 
Michael Higgins






What browser is creating the problem? What O/S is that browser running on?

MSIE reportedly performs some file type heuristics, so I suspect the 
browser is MSIE.


Evidently the .txt file looks like an HTML file. If it truly is an HTML 
file, you might be able to fix the problem by specifying the character 
set in a META tag.


Or you could compress the file with gzip or zip to convince MSIE to 
leave the file alone when uploading it.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Query an IP from file

2007-05-23 Thread Mumia W.

On 05/23/2007 03:01 AM, Jeff Pang wrote:



Hello Thomas,

I tried your codes,it's good I think.
I've modified some of the codes to fit my situation.
But if the network data files include too much IPs,my program used up 
all memory and couldn't get continued.

Below are my modified codes.Attachments are two network data files.

Any suggestion guys?Thanks.
[...]


See if the NetAddr::IP module can help you.

BTW, there were no attachments in your message.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Regarding files

2007-05-21 Thread Mumia W.

On 05/20/2007 11:37 PM, Dharshana Eswaran wrote:

Hi All,

The below code helps in reading a file in reverse:

use strict;
use warning;

open( FILE, $file_to_reverse )

 or die( Can't open file file_to_reverse: $! );

@lines = reverse FILE;
foreach $line (@lines) {
 # do something with $line
}

But i am trying to grep for a string in the file and once i get the string,

I need to read few lines which occurs before the string. For eg:

typedef union
{
   TYPE_T type;
  MODE_T mode;
} CHANNEL_INFO_T;

Here, I grep for CHANNEL_INFO_T, once i get that, i need to read the
elements defined in the union or structure.


I have written a code but i am unable to achieve what i wanted.

Can anyone guide me in this?

Thanks and Regards,
Dharshana



You could use Tie::File to treat the file's lines as an array:

use strict;
use warnings;
use Fcntl 'O_RDONLY';
require 'Tie/File.pm';

tie my @file, 'Tie::File', 'anyfile.txt', mode = O_RDONLY
or die(Tie::File failed: $!);

for my $n (0 .. $#file) {
local $\ = \n;
$_ = $file[$n];
if (/CHANNEL_INFO_T/) {
print $file[$n-2];
print $file[$n-1];
print;
}
}

untie @file;







--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Chinese word problem

2007-05-16 Thread Mumia W.

On 05/16/2007 12:57 AM, Neil wrote:

Dear All:

Question:

How come the length of Chinese word I print shows “ 3 “.
Isn’t it supposed to 2 bytes?

Program:
---
$str=”我”;

$str_len = length($str);

Print $str_len, “\n\n”;


The result is 3

I took a picture for the program. In case of it doesn’t show Chinese word
in some of your system,
[...]
My environment:
[...]
Encode: Big5



Something is messed up with your locale or environment. Since you only 
have one character in $str, the length should be 1--and that's what I get.


I saved your program two ways: as a utf8 file and as a big5 file; both 
programs produce the same result on my system: 1; however, to get your 
program to run, I had to change the quotes.


Here is the first program (saved in UTF8):
---
#!/usr/bin/perl
use utf8;
use strict;
use warnings;

my $str=我;

my $str_len = length($str);

print $str_len, \n\n;
--

Here is the second program (saved in Big5):

#!/usr/bin/perl
use encoding big5 = STDOUT = 'utf8';
use strict;
use warnings;

my $str=§Ú;

my $str_len = length($str);

print $str_len, \n\n;
print data = $str\n;


The second program displays this:
--start output---
1

data = 我
---end output

Evidently the Big5 character sequence \xA7\xDA represents the single 
Unicode character \x6211 which is the Chinese character 我. You probably 
just need to tell Perl about the encoding of your script.


My environment:
Perl 5.8.4
Debian 3.1
Encoding: UTF8


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: xterm fonts

2007-05-16 Thread Mumia W..

On 05/15/2007 04:38 PM, Deboo ^ wrote:

I installed a minimal X sysetm with fluxbox and xterm and two other
terminal emulators: eterm and mrxvt. But all three of them give very
small fonts. WIth xterm, I was able to get a reasonable font with the
HUGE option in the right-click menu but I need bigger fonts. How do
you exactly specify bigger fonts with xterm? I am aware it's possible
with -f or -fn option but what comes after that? Say I wan a 10x20
font? it doesn't work just by typing -f 10x20



I use rxvt, so I'd use this:
rxvt -fn 10x20

Back when I was using Eterm, I think I did this:
Eterm -F 10x20


And how do you incorporate the custom xterm options in the default
fluxbox menu? Is there something to edit the menu commands?



Fluxbox is based on blackbox, and blackbox menu file is in 
~/.blackbox/menu, so you might have to edit ~/.fluxbox/menu. I don't 
know of a menu editing utility for blackbox/fluxbox; just edit the text 
menu file.



Also how to use the dektop icons that DSL is able to use with fluxbox?
I already installed fbdesk but it seems of no use at all or is it
buggy?

Regards,
Deboo



I don't know anything about the icons.

For setting fonts in terminal emulators, read the associated manual 
pages and the documentation in /usr/share/doc/program. You can get a 
list of fonts that should work properly by typing xlsfonts | less.


You probably don't need to modify the menu to get mrxvt to change its 
look. If it's anything like rxvt, you can use X resources to configure it:


FILE name=~/.Xdefaults
mrxvt*font:10x20
/FILE

Execute this before starting mrxvt:
xrdb -merge ~/.Xdefaults


I hope this helps.





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: xterm fonts

2007-05-16 Thread Mumia W.

On 05/15/2007 07:04 PM, Mumia W.. wrote:

On 05/15/2007 04:38 PM, Deboo ^ wrote:

I installed a minimal X sysetm with fluxbox and xterm and two other
[...]


Sorry, wrong list :-(


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: cleaning up as application ends

2007-05-13 Thread Mumia W.

On 05/13/2007 05:32 PM, Mary Anderson wrote:

Mumia,
   Thanks for the mod_perl tip.  That [http://perl.apache.org/docs/1.0/guide/porting.html#END_blocks] seems to say that the code in the END 
block will be executed when the server stops, not when the session comes to 
an end.


   My END blocks are executed well before the session comes to an end.

   If I do something like this:

print header;
END {print Ending Now, hr}

my $login = param('Login');


my $page_name = param('Go');

if ($page_name eq 'Logged In'){

print a({-href=./fubar, fubar});
}
   
if (!$page_name){

print submit ({-name='Go', -Label = 'Logged In');
}

Then what happens when this (not real) code runs is that I type in login, 
hit the Logged In button, fubar is printed and then I see Ending Now.


My session is still running.  I want code executed when the session closes. 
Is it possible to do this in cgi?  (I am beginning to think not.)


mary



I'm assuming that you when you say session, you mean a group of requests 
that are associated with a single user. One option would be to execute 
the cleanup code when the user logs out; another option would be to 
periodically search for expired sessions and clean them up.


If you're using CGI::Session, you can probably subclass it and override 
the delete method to perform you cleanup operations (as well as call the 
superclass delete method).


You haven't confirmed what CGI-like environment you're using: mod_perl, 
fastcgi or regular CGI. Look at the documentation for the CGI and 
session management libraries you're using; they should describe how to 
register cleanup code.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: cleaning up as application ends

2007-05-12 Thread Mumia W.

On 05/12/2007 05:37 PM, Mary Anderson wrote:

 I would like to perform some clean up at various points in my application.
 Here is one of them.

 if ($pageName eq 'CSV'){
my $made_and_stuffed = make_and_stuff_query($pageName);
if ($made_and_stuffed == 1){
my $pathName = execute_CSV_query($pageName);
print a({-href=$pathName}, 'Open  CSV File'), hr;
}
 }
 On returning from viewing the file, or on hitting the submit button to go
to the next page, or on exiting the application I would like to get rid of
this file (using unlink, of course)  Perl's  END should do the trick, but I
find that it has rather odd notions of just what constitutes the END of the
application.  
Although this particular file can be unlinked anytime after it has been

opened, I do have some clean up jobs which can be performed only when the
application exits.  END, which has been tried, really does not work for this!

Thanks,
Mary Anderson



END blocks should work properly unless you're running under mod_perl. If 
you using a mod_perl environment, then special considerations must be made:


http://perl.apache.org/docs/1.0/guide/porting.html#END_blocks


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: $1 $2 var confusion

2007-05-12 Thread Mumia W.

On 05/12/2007 09:21 AM, Steve Bertrand wrote:
I have two scenarios here, and in the first one, I am not seeing the 
logic I would normally expect. I'll compact the code as to save everyone 
from scrolling. I have strict and warnings enabled (as I always do). Can 
someone tell me why in the first case $1 isn't initialized and in the 
second case it is?



# First run(catch $1 and $2, check $2 for correctness (it is), print $1)

my $email = '[EMAIL PROTECTED]';
$email =~ /(.*)@(.*)/;
if ($2 !~ /domain\.com/) {
print var 2 is bad\n;
}
print $1\n;

/** prints 'uninitialized' for line 'print $1\n;**/


# Second run(same as above, but the if will fail:

my $email = '[EMAIL PROTECTED]';
$email =~ /(.*)@(.*)/;
if ($2 !~ /domain\.com/) {
print var 2 is bad\n;
}
print $1\n;

/** prints
var 2 is bad
steveb
*/

Why does the $1 initialize and print only if the 'if' fails?

TIA,

Steve



That happens because the match variables ($1, $2, ...) are only changed 
when a regular expression matches; otherwise, they are left alone.


In the first case, $2 !~ /domain\.com/ succeeds but does not capture 
anything, so the numbered match variables are unset.


Your situation reinforces the rule that you should always test if the 
match succeeded before you attempt to use the match variables:


my $email = '[EMAIL PROTECTED]';
my @f = (undef, $email =~ /(.*)\@(.*)/);

(@f  1)  ($f[2] =~ /domain\.com/ ?
print $f[1]\n : print var 2 is bad\n );

The test @f  1 is my way of testing if the match succeeded.

HTH




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: $1 $2 var confusion

2007-05-12 Thread Mumia W.

On 05/12/2007 07:00 PM, Rob Dixon wrote:

[...]
No, it has no effect on $1. I thought it would cause confusion! The 
statement simply
assigns a list to @f. The first element of the list is undef, and the 
rest is the

result of applying the regex to $email, so it's the same as

 my @f = (undef);
 push @f, $email =~ /(.*)\@(.*)/;

and simply offsets the captured results by one. As I said, I can see no 
reason to have
written it this way unless Mumia wanted $f[1] to correspond to $1 and 
$f[2] to $2.

[...]


That was exactly my intention.

I thought I had to choose between that and setting $[ . Which is worse? ;-)

Anyway, I now think that a couple of scalars would have been better.





--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: regexp

2007-05-10 Thread Mumia W.

On 05/10/2007 12:54 PM, oryann9 wrote:

[...]
The strings I need out of this are:

msgagt=ESM_WMB_AIX

sec_id=Sec_id

severity=Low

msgnode=qwmbap01.cardinalhealth.net

utc={2007-04-26 18:01:59.472+00:00}

om={

UID=3a7affd6-f420-11db-80b1-

AlertCode=AEM001

AlertType=AEM-default

AppName=AEM-CommonService2

Message=5004:An error has been reported by the
BIPXML4C component.:XML

}

[...]


You could try it this way:

#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;

my $data = do { local $/; DATA };

my $regex = '
((?:msgagt|sec_id|severity|msgnode)=[\w.]+)
|
((?:utc|om)={[^}]+})
';

my @gotten = grep defined, $data =~ m/$regex/gx;
@gotten = map {
s/{([^}]+)}/
my $value = $1;
$value =~ s{\s+}{}g;
$value =~ s{,}{\n}g;
$value;
/e;
$_;
} @gotten;
print Dumper([EMAIL PROTECTED]);


__DATA__
Node:  dudbqa02 Message group: MoM_OpC_ADM-m-s
Application:   OGTP Object:syslog Severity:
  Critical Text:  WebSph

ere Broker v6003[2998366]:
(QWMB01.EG500)[8225]BIP2951I: Event generated by user
code. Additional information :
'msgagt=ESM_WMB_AIX,sec_id=Sec

_id,severity=Low,msgnode=qwmbap01.cardinalhealth.net,utc={2007-04-26
18:01:59.472+00:00},om={UID=3a7affd6-f420-11db-80b1-,AlertCod

e=AEM001,AlertType=AEM-default,AppName=AEM-CommonService2,Message=5004:An
error has been reported by the BIPXML4C
component.:XML}' 'MS_Alert_E

SM_Integrator.InsertToSYSLOG' '{2}' '{3}' '{4}' '{5}'
'{6}' '{7}' '{8}' '{9}' :
QWMB01.1aef50ec-1001--0080-dae5df22a0ad:
/build/S600_P/src

/DataFlowEngine/ImbRdl/ImbRdlThrowExceptionStatements.cpp:
158: SqlThrowExceptionStatement::execute:
ComIbmComputeNode: MS_Alert_ESM_Integrato

r#FCMComposite_1_2,cma={Location=Not_found,BusUnit=Not_found}

__HTH__


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: OT: Duplicate messages

2007-05-10 Thread Mumia W.

On 05/10/2007 06:39 PM, [EMAIL PROTECTED] wrote:

I am not getting duplicates.

jerry


nope.



-Original Message-

From: Tom Yarrish [EMAIL PROTECTED]
Sent: May 10, 2007 5:27 PM
To: beginners@perl.org
Subject: OT: Duplicate messages

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hey all,
Is it me or are there multiple copies of the same message going to
the list?  I've received either two or three copies of the same
message a lot today (just today though).

Thanks,
Tom


I am getting quite a few duplicates.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Exporting in two packages but one file

2007-05-08 Thread Mumia W.

On 05/08/2007 03:58 AM, Martin Barth wrote:

Hi all,

I have a Package A with serveral subs in it and now I want to make a package 
A::Types with some constants in it.

I have A.pm with:

..some code and subs ..

package A::Type;
use constant  { CONST1 = foo, CONST2 = bar};
package A;

..some more code and subs..



now I wanted to use the Exporter and wrote in the package A::Type part of the 
file:

sub BEGIN {
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(CONST1 CONST2);
our %EXPORT_TAGS = ( standard =  [qw(CONST1 CONST2)]);
}

but now I dont know to import the stuff. I can't do a use A::Type 
qw(:standard) because I dont have A/Type.pm
do you have any suggestions how this can be done?

thanks for the help!
 Martin



Import the stuff into A first, like so:

use strict;
use warnings;

package A::Type;
use constant  { CONST1 = foo, CONST2 = bar};
BEGIN {
use Exporter qw/import/;
our @EXPORT = qw/CONST1 CONST2/;
}

package A;

sub BEGIN {
use Exporter;
import A::Type qw/CONST1 CONST2/;

our @ISA = qw(Exporter);
our @EXPORT_OK = qw(CONST1 CONST2);
our %EXPORT_TAGS = ( standard =  [qw(CONST1 CONST2)]);
}

1;

__HTH__


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Passing a hash from a form field?

2007-05-01 Thread Mumia W.

On 04/30/2007 11:03 PM, [EMAIL PROTECTED] wrote:


I actually have the book as well ('Official Guide to Programming with 
CGI.pm') and have practically torn it apart trying to find a way to do 
what I want. I've tracked down and read a number of articles and forum 
postings as well.


I have a feeling that a hash can't be passed this way. Arrays and 
strings are no problem, but I believe the CGI protocol does not allow 
passing complex data structures like arrays of hashes, or hashes of hashes.




You are correct that CGI does not allow you to pass HoH structures 
directly; however, you can use Storable.pm to convert a HoH into a 
string that can be made the value of a form element (after it's been 
HTML-encoded).


Sessions are an even better idea for passing complex data between CGI 
programs written by the same author. Investigate the docs for 
CGI::Session and Apache::Session (if you're using Apache).



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Capturing an external program return code

2007-05-01 Thread Mumia W.

On 05/01/2007 07:09 PM, Vladimir Lemberg wrote:

 [...]
system ( $program -f $program.cfg );
if ($? == -3) {
 [...]


You're facing two problems: the return value for system() needs to be 
shifted right by eight bits; and that value is provided in unsigned 
form, so you have to massage it:


my $code = system(...);
$code = unpack 'c', pack 'c', $code  8;
if ($code == -3) {
}

Read perldoc -f system


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Help: Perl Module Installation Issue(s)

2007-04-28 Thread Mumia W.

On 04/27/2007 07:13 PM, Jefferson Kirkland wrote:

[...]
I was doing fine until today.  I tried the following:

  perl -MCPAN -e 'install OpenSSL'

Things started ok, but quickly took a down turn/nose dive into the
pavement.  The install failed horribly [...]


Probably the OpenSSL Perl module requires that the openssl package be 
installed onto your system.


Hmm, after taking a look at the README file for CPAN's OpenSSL, I think 
that the module is not ready for prime time. The README is ten lines 
long, contains a curse word and refers to itself as a hack.


It's so unprofessional, if I didn't know better, I'd think that someone 
had broken into the PAUSE author's account, and I don't know better.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Switching io redirection between display and file

2007-04-26 Thread Mumia W.

On 04/26/2007 07:05 AM, Nath, Alok (STSD) wrote:

Hi ,
Can somebody help me out ?

	I wanted to switch io redirection between log file and 
	standard display device.Basically sometimes I want to

print into a log file and other time to the display device.
[...]


perldoc -f open describes the technique.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: basename equivalent?

2007-04-25 Thread Mumia W.

On 04/25/2007 11:59 PM, Nishi wrote:

On 4/25/07, Rob Dixon [EMAIL PROTECTED] wrote:

[...]
  my ($name) = $path =~ m|([^/]+)$|;



I tried it, but somehow doesnt work for me, printing $name returns me the
entire string such as C:\temp\abc\abc.txt and not abc.txt.
Am I missing something?



Backslashes should be excluded from the character class, and the 
backslash character has to be doubled because it is special.


my ($name) = $path =~ m|([^/\\]+)$|;



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: iso-8859-1 to unicode problem

2007-04-24 Thread Mumia W.

On 04/24/2007 03:06 AM, Jeff Pang wrote:

2007/4/24, Beau E. Cox [EMAIL PROTECTED]:


How do I get a proper conversion from iso-8859-1 to perl's internal utf8?


Hello,

You may use Encode module's decode function to do this conversion.
ie,for this string which was 'gb2312' format,

$str = 中文;

We use decode to convert it to perl's internal utf8,

$str2 = decode('gb2312',$str);

But you can't see this $str2 since it's perl's internal encode
format.So you need to convert it to corresponding output format,like,

$output = encode('utf8',$str2);

then print it out,
print $output;

The whole things can be written one line,

$ perl -MEncode -e '$out=encode(utf8,decode(gb2312,中文));print $out'

That would get the correct result you wanted (output with utf8).
Hope this helps.



I don't think it'll work in this case because \x99 doesn't seem to be 
inside my list of iso-8859-1 characters.


The document Mr. Cox is downloading is less than truthful about its 
character set. Although it advertises itself as iso-8859-1, it's 
actually cp1250.


Mr. Cox, I got your program to decode the text properly by changing the 
decoding line to this:


my $name1 = decode( 'cp1250', $name );

Have a nice day.

BTW, I got the list of valid cp1250 characters here: 
http://www.microsoft.com/typography/unicode/1250.htm


Read perldoc Encode::Supported to see the list of supported character 
sets.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Cgi/perl

2007-04-21 Thread Mumia W.

On 04/20/2007 07:29 PM, John Maverick wrote:

Folks,

Got a question regarding perl code in cgi script.

I am running below line of code in cgi script which doesn't work as
expected.

my $ticket = qx{echo $p4pass | p4 login -p $p4user};

Basically command has to return a ticket or error message. I keep getting
$ticket as empty.

However, if I write same code in stand alone perl script, it works fine as
expected. Not sure what is going on.

I looked at other options like open(CMD, | $cmd) and open3. But, not sure
how to get output from the command.

Any idea what is going wrong here.

Nothing in webserver logs too.

Thanks,
Craig.



I have no idea what p4 is, but perhaps you should make sure it's in the 
path, e.g.;


print qx(which p4);

Also investigate the value of $?

Alternative ways to send the password to p4 would be to use Expect.pm or 
IPC::Open3:


perldoc Expect
perldoc IPC::Open3
perldoc perlvar


HTH



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: reqular expr for string manip.

2007-04-19 Thread Mumia W.

On 04/18/2007 10:26 PM, Nishi wrote:

Hi:

I am using the following reqular expression to extract the last part ie
$lang of the following string
$topdir = common/default/l_cs;
my $lang=$topdir =~ /.*\/(.+)$/;

But it doesnt seem to work, what am i missing here?

Thanks!



my $lang = ($topdir =~ /([^\/]+)$/)[0];


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Uninstalling perl module

2007-04-15 Thread Mumia W.

On 04/15/2007 12:49 AM, [EMAIL PROTECTED] wrote:

Hi,

Thanks for the reply, I think that I understand you point.
Now I am starting to fear cpan installations. 
Is there a chance that by doing a simple - naive cpan installation of a module I, potentially, can damage another installed module?



Best regards,

Yaron Kahanovitch   


Before you give up on CPAN uninstallations, take a look at the PODs for 
these modules:


ExtUtils::Packlist
ExtUtils::Install

I have no idea if the uninstallation methods described in those 
documents work, but I post them for your perusal.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Processing large data files.

2007-04-06 Thread Mumia W.

On 04/06/2007 03:27 PM, Bill Stephenson wrote:
Perl crashes when using the included script for large data files. How 
can I prevent this from happening?




What do you mean by crashes? Does it abort with an error message placed 
in the web-server log file? If so, that's not a crash; it's just an 
error abort of the script.




Kindest Regards,

--
Bill Stephenson


Sample data source is a Delimited text file with the following fields:

FMT:STORE:TIKEY:TITLE:QTY:DC:COMPANY:ZONE

DV:043712:20882903:DVD-ALL THE KING'S M('06/WS/2D:8.0:ECDC:Hlyw:4
DV:043712:20883071:DVD-ALTERED (2006/WS):8.0:ECDC:Hlyw:4
DV:043712:20883070:DVD-AMERICAN PIE 5-NAKE(UR/WS:32.0:ECDC:Hlyw:4
DV:043712:20883253:DVD-BROOKLYN LOBSTER (WS):2.0:ECDC:Hlyw:4
DV:043704:20882903:DVD-ALL THE KING'S M('06/WS/2D:16.0:WCDC:Hlyw:4
DV:043704:20883071:DVD-ALTERED (2006/WS):8.0:WCDC:Hlyw:4
DV:043693:20882903:DVD-ALL THE KING'S M('06/WS/2D:24.0:ECDC:Hlyw:4
DV:043693:20883071:DVD-ALTERED (2006/WS):8.0:ECDC:Hlyw:4
DV:043693:20883070:DVD-AMERICAN PIE 5-NAKE(UR/WS:24.0:ECDC:Hlyw:4
DV:043693:20883092:DVD-ZOMBIE NATION (2006/WS):4.0:ECDC:Hlyw:4
DV:043670:20882903:DVD-ALL THE KING'S M('06/WS/2D:8.0:ECDC:Hlyw:4

code

#!/usr/bin/perl

use strict;
use warnings;

# set-up our variable

my $source = dataSource.txt;
my $destination = testOUTPUT.txt;

my $fmt = ;
my $storeno = ;
my $co = ;
my $dc = ;
my $zone = ;
my $store = ;
my $tikey = ;
my $title = ;
my $qty = ;
my $text1 = ;
my $text2 = ;
my $output = ;

my @stores = ;


This creates an array with one element, an empty string. Usually people 
just want to create an empty array which can be created like so:


my @stores = ();




# start the work...

open my $IN, $source or die Can't read source file $source: $!\n;

# put all the stores into an array (@stores)...
my @lines = $IN;

foreach my $line(@lines) {



This reads all of the lines into memory at once. Whoa! You almost 
certainly want to use a while loop to read the lines one-by-one:


my @lines;
while (my $line = $IN) {

Or even better, use Tie::File to treat the lines in the file as an 
array. That would almost certainly suit you better since your code uses 
an array of lines that you search through more than once.


tie my @lines, 'Tie::File', $source
  or die Can't read file $source: $!\n;

Read the manual pages for Tie::File and perltie:
Start-Run-perldoc Tie::File
Start-Run-perldoc perltie


($fmt, $store, $tikey, $title, $qty, $dc, $co, $zone) = 
split(/:/,$line);
   
push @stores, $store;

}



# remove duplicate stores from the list...
my %seen = ();
my @uniq = ();

foreach my $item (@stores) {

unless ($seen{$item}) {
# if we get here, we have not seen it before
$seen{$item} = 1;
push(@uniq, $item);
}
}

# for each store in our @uniq store list we look for
# lines in our file that have a matching store

foreach my $uniqStore (@uniq) {

foreach my $line(@lines) {

($fmt, $store, $tikey, $title, $qty, $dc, $co, $zone) = 
split(/:/,$line);

# if they match we create our entry for the destination file

if ($store eq $uniqStore) {
   
$text1= Street Date $source \n. Company $co \n. 
Distribution Center $dc \n. Zone $zone \n. Store Number $store \n\n;
   
$text2 .= $tikey \t $title \t $qty\n;
   
}

 }

# then add it to the final $output.

if ($text1 ne ) {
$output .= 
$text1$text2\n\n\n\n\f\n;

$text2 = ;
}
}

# and finally print all out

# print $output; #for debugging

open(my $DATA,  $destination)
or die ( Error 1.3 Couldn't file:: $destination for writing: \n);

print $DATA ($output);

close $DATA;




Once you start using Tie::File, your program will be half its current 
size and much faster.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: Merge CSV Data Files - Ideas on how to do this.

2007-04-04 Thread Mumia W.

On 04/04/2007 02:56 PM, Bill wrote:
Hi all.  I have bunch of CSV files that have the same data.  This data is sent to clients.  Then the data is returned back with the Active/Remove field filled.  This field is only filled by 1 client.  All the files are returned back. Once they are returned back I need a script that will go through each of the CSV merge the data.  For example, below files are idential accept the active/remove field is filled in some files and not in other.  I had done this through putting all the files into a hash and looking at that way.  But it consumes alot of memory, which limits me with what i can do with a hash.  I just wanted to run this by the group and find out a more efficient way to do this. The program runs on Win32 system.  


Below are the files
[...]


Go through the files twice. The first time, only remember which users 
are either active or removed. The second time you go through the files, 
incorporate the information about active and removed users before you 
send the files.


Here is an example that uses your sample data files (not included):

#!/usr/bin/perl
use strict;
use warnings;
use Fcntl;
use DB_File;
use Text::CSV_XS;
use File::Spec::Functions;
use IO::File;
use Data::Dumper;

use constant SCAN = 0;
use constant WRITE = 1;

my $filesdir = 'dfiles';
my @files = glob(catdir($filesdir, '*.txt'));
my %users;
my $csv = Text::CSV_XS-new();

load_file($_, SCAN) for @files;
load_file($_, WRITE) for @files;


undef $csv;
exit;

#

sub load_file {
my ($filename, $mode) = @_;
my $fh = IO::File-new($filename,'r') or die(open failure: $!);
my $header = 0;
local $_;

if ($mode eq SCAN) {
while ($_ = $fh-getline) {
next unless $header++;
next unless $csv-parse($_);
my @fields = $csv-fields;
next unless @fields  2;
my $uname = $fields[0],$fields[1];

$users{$uname} = $fields[3]
if ($fields[3]  !$users{$uname});
}
}

if ($mode eq WRITE) {
print FILENAME: $filename\n;
while ($_ = $fh-getline) {
next unless $csv-parse($_);
my @fields = $csv-fields;
next unless @fields  2;
my $uname = $fields[0],$fields[1];

$fields[3] = $users{$uname} if ($users{$uname});
s/^\s+//, s/\s+$// for @fields;
$csv-print(\*STDOUT, [EMAIL PROTECTED]);
print \n;
}
}

print \n;
$fh-close or die (close failure: $!);
}


__HTH__


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




  1   2   3   4   >