Re: help with progress bar -test site

2004-01-18 Thread Gerry Creighton
On Jan 17, 2004, at 12:37 PM, zentara wrote:

On Sat, 17 Jan 2004 11:54:55 -0500, [EMAIL PROTECTED] (Gerry
Creighton) wrote:
So can you suggest where to add the form processing to the upload.cgi?
I'm good with Flash and actionscripting but am not totally in tune  
with
perl (yet).
The guy who wrote that megaupload progress bar script said that it can
be done but has yet to return my message on where to paste the form
processing code.
Thanks for the help!
Gerry
Well I have to give my email address to get the files...sorry.
That's a sure way to get spam.
If it isn't too big, you could post the cgi script you want to
paste it into here.
P.S. My email address I use here is just a spam bucket, don't
send anything there, because I won't get it.
You need a cgi script to generate the form, a plain form won't
do. Why do you need this special FormBuilder anyways?
You should use this as an opportunity to write your own
that's the only way to learn.


--
When life conspires against you, and no longer floats your boat,
Don't waste your time with crying, just get on your back and float.

Correct me if I'm wrong but this should be the form processing that I  
need. This should send the form info to me and to the person filling it  
out.
Let me know what's up.
Thanks alot!
Gerry

code
#Standard variables which must be in every form :
#email  -- it submitter email address
#Example for form:
#Your email address : input type=text name=emailbr
#Your name  : input type=text name=name
#if field written in format as input type=text name=name_val
#that mean what script will be generate error if field name_val empty.
#input type=hidden name=order value=name,email,url
#it define order of fields in email
#Configure script here:

#You must define = where uploaded files will be stored.
#1. unix/nt path to uploaded files directory (must be chmoded to 777)
#2. full url of uploaded files directory
$files_path=/u/web/mydomainname/uploads;
$files_url =http://www.mydomainname.com/uploads;;
#Which file extensions must support script?

@ext=(gif,jpg,jpeg,tif,tiff,zip,pdf,sit,psd,mp3,mov 
,mp4,avi,ppt,doc,ai,qxd,eps,ttf,pub,sea);

#Maximum size of one uploaded file?

$maxsize=1; # 100 000 bytes by default

#How much files can be uploaded? Name it as file1..file12 for example
$maxfiles=2;
#File must be allways uploaded with form or not?
#Specify 0 - if your form can be without file or 1 - if as minimum  
uploading
#			of one file is requied

$requpload=1;

#Mailing. Send emails to admin/user via smtp or sendmail? Set only one!

$sendmail=/usr/lib/sendmail;
$smtp=;
#Admin email address.

$admin_email='[EMAIL PROTECTED]';

#Enter list of your websites which can call this script.

@domains=('domainName.com','IPNumber');

#Enable autoresponder? If set to 1, script will be send email to  
submitter.

$autoresponder=1;

#Subject for autoresponder message

$asubject='Thank you for uploading your files!';

#Autoresponder message

#Do we need to save information about submitted files/submitter email
#in database? If yes - set to unix/nt path to file
$store=; #Example with db : $store=./emails.db;

#End of configuration section

#Process form
#$efrom - this address of form submitter
$recipient=$CGI{'recepient'};
if (!$recepient) {$recipient=$admin_email;}else{delete  
$CGI{'recipient'};}

@order=split(/\,/,$CGI{'order'}); #Order of form

#Process form after this images with urls.

$redirect=$CGI{'redirect'};
if ($redirect) {delete $CGI{'redirect'};}
$msg1=; #Form fields
$msg2=; #Files urls
$msg3=; #File name
if ($order[0]) {
delete $CGI{'order'};
foreach $item (@order) {$msg1.=$item : $CGI{$item}\n;}
}else{
foreach $key (sort keys %CGI) {
if ($key !~ /file/is) {$msg1.=$key : $CGI{$key}\n;}
}
}
foreach $fo (@fname) {
$msg2.=$files_url/$fo\n;
$msg3.=$filename $fo\n;
}
$vrb=qq~Hello!

Visitor from $ENV{'REMOTE_ADDR'} has submitted form and attached $total  
files.

-
Job Information :
$msg1
-
Uploaded files :
$msg2
Best Regards,
Your uploader script
~;
#Autoresponder message
$amessage=qq~
Hello!
Thanks for uploading your job. We have received your job and will  
contact you with any questions.
You submitted the following:
-
Job Information :
$msg1
-
Uploaded files :
$msg3

Best Regards,
$admin_email
~;
#Send forms and autoresponder message if need
#$sendmail, $smtp
sendmail($sendmail,$smtp,New form is  
submitted,$recipient,$efrom,$efrom,New form is submitted,$vrb,0);

if ($autoresponder) {
sendmail($sendmail,$smtp,$asubject,$efrom,$recipient,$recipient,$asubjec 
t,$amessage,0);
}

#Headers
if ($redirect) {
print Location: $redirect \n\n;
}else{
print Content-type:text/html \n\n;
print load_template(submit-ok.html);
}
exit;
}

Re: help with progress bar -test site

2004-01-18 Thread Wiggins d'Anconia
zentara wrote:

snip

So now all you have to do is setup the mailings.
For example, this code should work, but there are many mail modules
available to make it easier.
my $mailprog='/usr/sbin/sendmail';
my $email = $emailaddr;
my $from = '[EMAIL PROTECTED]';
open( MAIL, |$mailprog -t )
 || safe_die(Can't start mail program $mailprog $!);
print MAIL To: $email\n;
print MAIL From: $from\n;
print MAIL Subject: Upload Notification\n;
print MAIL \n\n;  #important to print this
print MAIL Thank you for your upload .\n\n;
print MAIL $file_upload  - $fsize\n;
print MAIL - x 75 . \n;
close(MAIL);
And you can do it again to mail it to yourself with the $comment.

So there it's basically all done for you.

I agree with everything he's said, but please don't do mail this way, 
use a module from CPAN. There are plenty of good ones out there that 
range from incredibly simple to very complex.  I suspect zentara didn't 
want to go down this route as it involves CPAN, installing modules, 
learning documentation, and many more questions.  In the long run you 
are better off learning these things, in the end do what you will...But 
don't necessarily expect help on why your sendmail code is broken or you 
don't receive messages, etc.

http://danconia.org

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



Re: help with progress bar -test site

2004-01-18 Thread Gerry Creighton
On Jan 18, 2004, at 10:44 AM, zentara wrote:

On Sat, 17 Jan 2004 22:09:12 -0500, [EMAIL PROTECTED] (Gerry
Creighton) wrote:
On Jan 17, 2004, at 12:37 PM, zentara wrote:

You need a cgi script to generate the form, a plain form won't
do. Why do you need this special FormBuilder anyways?
You should use this as an opportunity to write your own
that's the only way to learn.


Correct me if I'm wrong but this should be the form processing that I
need. This should send the form info to me and to the person filling 
it
out.
Let me know what's up.
Ok, that FormBuilder code is written in an old style, which is not easy
to use.
I see what you want to do, and I'll offer my suggestions.
The first problem is your FormBuilder code uses an old manual
parsing style, which is no longer used much. The mega-uploader
uses the more widely used CGI.pm methods.  So they are kind of
incompatible without alot of rewritting.
- removed code -
So there it's basically all done for you.
Now this maillist is for helping people learn Perl, it's not a free
coding service. So you should take what I've showed you, and
test it on a local server, until you get it right.
If you have more questions, post it along with the code you are
trying.
Happy coding.

Thanks...that helps alot and get's me on the right track. That is 
basically what I wanted to know...where to put form code in the 
upload.cgi.
Gerry

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



RE: Redirect stdout, stderr to file and stdout

2004-01-18 Thread Larry Guest
This is very close.

But the script hangs and wont exit the tee command.

I ran the script using strace and it sits there like this.

write(1, Backup and Replication is comple..., 65Backup and Replication
is complete for mysite.com
) = 65
close(3)= 0
munmap(0x401fd000, 4096)= 0
rt_sigaction(SIGHUP, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGINT, {SIG_IGN}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_IGN}, {SIG_DFL}, 8) = 0
wait4(3576, 



And a ps-ef looks like this.

root  3576  3575  0 02:19 pts/000:00:00 tee YourLogFileHere

I have a close (TEE); at the end as well.

Any thoughts?

Thanks

-Original Message-
From: Randal L. Schwartz [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 17, 2004 9:55 AM
To: [EMAIL PROTECTED]
Subject: Re: Redirect stdout, stderr to file and stdout


 Larry == Larry Guest [EMAIL PROTECTED] writes:

Larry I have a small script that does some admin work for me. What I 
Larry need to do now is not only have is display information to STDERR 
Larry and STDOUT but also write the same information I see when I run 
Larry the command to a file.

Larry I have written it for others who are not very technical.  I want 
Larry them to be able to see the script working and what it is doing.  
Larry But I also need a log file of the same information so I can have 
Larry it mailed to me and keep a copy on the server.

Larry I cant seem to get this to work.

I think this might do it:

open TEE, | tee YourLogFileHere;
open STDOUT, TEE;
open STDERR, TEE;

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See
PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!

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




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




RE: Redirect stdout, stderr to file and stdout

2004-01-18 Thread Larry Guest
I think I have it.

I had to have

close (STDERR)
close (STDOUT)
close (TEE)

-Original Message-
From: Larry Guest [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 17, 2004 11:22 PM
To: 'Randal L. Schwartz'; [EMAIL PROTECTED]
Subject: RE: Redirect stdout, stderr to file and stdout


This is very close.

But the script hangs and wont exit the tee command.

I ran the script using strace and it sits there like this.

write(1, Backup and Replication is comple..., 65Backup and Replication
is complete for mysite.com
) = 65
close(3)= 0
munmap(0x401fd000, 4096)= 0
rt_sigaction(SIGHUP, {SIG_IGN}, {SIG_DFL}, 8) = 0 rt_sigaction(SIGINT,
{SIG_IGN}, {SIG_DFL}, 8) = 0 rt_sigaction(SIGQUIT, {SIG_IGN}, {SIG_DFL},
8) = 0 wait4(3576, 



And a ps-ef looks like this.

root  3576  3575  0 02:19 pts/000:00:00 tee YourLogFileHere

I have a close (TEE); at the end as well.

Any thoughts?

Thanks

-Original Message-
From: Randal L. Schwartz [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 17, 2004 9:55 AM
To: [EMAIL PROTECTED]
Subject: Re: Redirect stdout, stderr to file and stdout


 Larry == Larry Guest [EMAIL PROTECTED] writes:

Larry I have a small script that does some admin work for me. What I
Larry need to do now is not only have is display information to STDERR 
Larry and STDOUT but also write the same information I see when I run 
Larry the command to a file.

Larry I have written it for others who are not very technical.  I want
Larry them to be able to see the script working and what it is doing.  
Larry But I also need a log file of the same information so I can have 
Larry it mailed to me and keep a copy on the server.

Larry I cant seem to get this to work.

I think this might do it:

open TEE, | tee YourLogFileHere;
open STDOUT, TEE;
open STDERR, TEE;

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See
PerlTraining.Stonehenge.com for onsite and open-enrollment Perl
training!

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




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




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




Re: Suggestions for Submitting to CPAN

2004-01-18 Thread Tassilo von Parseval
On Sat, Jan 17, 2004 at 02:32:25PM -0500 Dan Anderson wrote:
 I've read the tutorial on creating a Makefile.PL for a module I'm
 submitting to CPAN, and I've applied for a PAUSE ID, but I was curious
 if anyone whos been through the process before knows of any pit falls I
 should be careful of, or any suggestions on how to make my life easier.

A thing you should never do is creating the structure of a module
yourself. Let perl do that for you by doing

h2xs -A -X -n Module::Name

This will create the outline of your module (including Makefile.PL) and
you just have to make the appropriate changes. Also, don't forget to put
the tests in the t/ directory.

Creating the tarball should ultimately be done with

make dist

Thus you can be sure not to violate any CPAN conventions.

It's also a good idea to consider back to which version of perl your
module should run. If you pass '-b 5.5.3' to h2xs the module draft only
uses features that can be understood by versions as old as 5.00503. In
my experience, there is rarely the need to use bleeding-edge features in
a module.

Tassilo
-- 
$_=q#,}])!JAPH!qq(tsuJ[{@tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?=sub).+q#q!'qq.\t$.'!#+sexisexiixesixeseg;y~\n~~;eval


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




Re: Why isn't perl used more in business and industry

2004-01-18 Thread Tassilo von Parseval
On Sat, Jan 17, 2004 at 06:52:27PM -0600 James Edward Gray II wrote:
 On Jan 17, 2004, at 3:51 PM, James Edward Gray II wrote:
 
 A recent article on Perl.com covered this a little:
 
 http://www.perl.com/pub/a/2004/01/09/survey.html
 
 And look what I read on Slashdot today:
 
 http://developers.slashdot.org/article.pl?sid=04/01/17/ 
 1435206mode=threadtid=100tid=126tid=137tid=145tid=156

See also

http://www.theregister.co.uk/content/64/34943.html

on the same issue.

 Heck, isn't the Slash code Perl too?

Yes.

Tassilo
-- 
$_=q#,}])!JAPH!qq(tsuJ[{@tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?=sub).+q#q!'qq.\t$.'!#+sexisexiixesixeseg;y~\n~~;eval


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




Perl/Tk on Windows (XP)

2004-01-18 Thread Robert
Is there a reference somewhere that talks about Windows XP theme
problems/issues or tips and tricks?

Specifically, a default menu does not have the right color, and if I make
the menu background white, the area around the tearoff is still the default
color.

Stuff like that.

MPTK will be on the way...



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




Search replace using 2 lines for pattern

2004-01-18 Thread Bertrand Mansion
Hi,

I have a big mail archive in which the From... top header has disappeared
and has been replaced by an empty newline. I know it is above the first
Received: header so I can locate it.

The mail headers start like this:

Received: from smtpout.mac.com ([204.179.120.85]) by lists.apple.com
  (8.11.6/8.11.6) with ESMTP id fB6BBGb27756 for
  [EMAIL PROTECTED]; Thu, 6 Dec 2001 03:11:16 -0800 (PST)
Received: from smtp-relay02.mac.com (server-source-si02 [10.13.10.6]) by
  smtpout.mac.com (8.12.1/8.10.2/1.0) with ESMTP id fB6B59Jl026926 for
  [EMAIL PROTECTED]; Thu, 6 Dec 2001 03:05:09 -0800 (PST)

etc...

Usually, it should start like the following (notice the From line):

From [EMAIL PROTECTED] Thu Dec  6 03:11:16 2001
Received: from smtpout.mac.com ([204.179.120.85]) by lists.apple.com
  (8.11.6/8.11.6) with ESMTP id fB6BBGb27756 for
  [EMAIL PROTECTED]; Thu, 6 Dec 2001 03:11:16 -0800 (PST)
Received: from smtp-relay02.mac.com (server-source-si02 [10.13.10.6]) by
  smtpout.mac.com (8.12.1/8.10.2/1.0) with ESMTP id fB6B59Jl026926 for
  [EMAIL PROTECTED]; Thu, 6 Dec 2001 03:05:09 -0800 (PST)

etc...

Perl seems the way to go to add the From line. Unfortunately, I have tried
many times with no success. I can easily change the Received: header to be
From [EMAIL PROTECTED]: but as there are more than one
Received: header, they all get replaced, which is bad.

I think I need a regex that would match \n\nReceived: and replace it with
\nFrom xx\nReceived:. It doesn't seem difficult but I am stuck.

I hope someone can help me, I have tried to solve this for hours...

TIA,

Bertrand Mansion
Mamasam


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




RE: Search replace using 2 lines for pattern

2004-01-18 Thread Charles K. Clarkson
Bertrand Mansion [EMAIL PROTECTED] wrote:
: 
[snip]
: I have tried many times with no success. I can easily change
: the Received: header to be
: From [EMAIL PROTECTED]: but as there
: are more than one Received: header, they all get replaced,
: which is bad.
: 
: I think I need a regex that would match \n\nReceived: and 
: replace it with \nFrom xx\nReceived:. It doesn't seem
: difficult but I am stuck.
: 
: I hope someone can help me, I have tried to solve this for hours...


Can you show us what you have? It would make solving this
much easier.


HTH,

Charles K. Clarkson
-- 
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328


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




Re: Search replace using 2 lines for pattern

2004-01-18 Thread Bertrand Mansion
[EMAIL PROTECTED] wrote :

 Bertrand Mansion [EMAIL PROTECTED] wrote:
 : 
 [snip]
 : I have tried many times with no success. I can easily change
 : the Received: header to be
 : From [EMAIL PROTECTED]: but as there
 : are more than one Received: header, they all get replaced,
 : which is bad.
 : 
 : I think I need a regex that would match \n\nReceived: and
 : replace it with \nFrom xx\nReceived:. It doesn't seem
 : difficult but I am stuck.
 : 
 : I hope someone can help me, I have tried to solve this for hours...
 
 
   Can you show us what you have? It would make solving this
 much easier.

Well, I don't have much, I am trying to do it from the command line:

perl -pi -e s/\n\nReceived:/\nFrom xxx\nReceived:/ file.txt

The archive is 70Mb approx. I am testing on a smaller subset.
This looks so simple and common that I am probably not taking the problem in
the right way.

Bertrand Mansion
Mamasam


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




Re: Use strict inside module to apply to entire script?

2004-01-18 Thread James Edward Gray II
On Jan 18, 2004, at 12:12 AM, Steve Grazzini wrote:

On Saturday, January 17, 2004, at 06:21 PM, Dan Muey wrote:
I was curious if it's possible to have a module like so:

package Foo:Monkey;

use strict;
use warnings;
You can call strict-import like this:

package Foo::Monkey;
sub import {
for my $pragma (qw(strict warnings)) {
require $pragma.pm;
$pragma-import;
}
}
Wow.  You learn something new all the time.  Thanks!

James

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



RE: Search replace using 2 lines for pattern

2004-01-18 Thread Charles K. Clarkson


: -Original Message-
: From: Bertrand Mansion [mailto:[EMAIL PROTECTED] 
: Sent: Sunday, January 18, 2004 7:56 AM
: To: Charles K. Clarkson; [EMAIL PROTECTED]
: Subject: Re: Search replace using 2 lines for pattern
: 
: 
: [EMAIL PROTECTED] wrote :
: 
:  Bertrand Mansion [EMAIL PROTECTED] wrote:
:  : 
:  [snip]
:  : I have tried many times with no success. I can easily change
:  : the Received: header to be
:  : From [EMAIL PROTECTED]: but as there
:  : are more than one Received: header, they all get replaced,
:  : which is bad.
:  : 
:  : I think I need a regex that would match \n\nReceived: and
:  : replace it with \nFrom xx\nReceived:. It doesn't seem
:  : difficult but I am stuck.
:  : 
:  : I hope someone can help me, I have tried to solve this 
: for hours...
:  
:  
:Can you show us what you have? It would make solving this
:  much easier.
: 
: Well, I don't have much, I am trying to do it from the command line:
: 
: perl -pi -e s/\n\nReceived:/\nFrom xxx\nReceived:/ file.txt
: 
: The archive is 70Mb approx. I am testing on a smaller subset.
: This looks so simple and common that I am probably not taking 
: the problem in
: the right way.

I have never understood why one-liners are so popular.
Perhaps because I abandoned the command line for the mouse
so many years ago.

Where is the xxx coming from? I think you should solve
that first, but your current problem is with '-p' which is
similar to (ignoring -i for now):



while () {

s/\n\nReceived:/\nFrom xxx\nReceived:/;

} continue {

print or die -p destination: $!\n;

}


If you only need one replacement, you need to adjust this
to stop after the first success.


HTH,

Charles K. Clarkson
-- 
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328





















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




Matching and general expressions

2004-01-18 Thread aSH
Hello,

I'm trying to learn and use the patterns. This is my first serious 
try with perl.

I have a long list of words and phrases that I need to find.

Let's take this example. I want to find this patterns anywhere, no 
matter if there are followed by other characters:

Central PendingCall object
PendingCall.getOutputParameter
PendingCall.getOutputParameterByName
PendingCall.getOutputParameters
I have been trying this:

pattern=m/Central PendingCall object/
pattern=m/PendingCall.getOutputParameter/
But the last one it shadows  PendingCall.getOutputParameterByName

So I tried this, but I'm not sure what this is doing:

pattern=m/\bPendingCall.getOutputParameter\b(?!B)/

I want to find my patterns always, with repetitions.

I have been following this tutorial
http://www.perldoc.com/perl5.6.1/pod/perlretut.html
But now I need help with the code because I'm lost and I need to send 
my code.

Thanks in advance.

aSH

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



Re: Why isn't perl used more in business and industry

2004-01-18 Thread Wiggins d'Anconia
Bakken, Luke wrote:

Most of the scripts I see end in an extension like .jsp, 
.asp, .dll, or
something which says that they aren't perl.  Is there a reason more
businesses and online companies don't use perl?

-Dan


I would bet just about every major company uses Perl in one way or
another. The financial company for whose loan software I write uses Perl
all over the place. Just because you don't see it via their web presence
doesn't mean it's not there.
From what I have seen and heard this is certainly true. My current 
employer (Fortune 500) employs me to hack on an application almost 
exclusively in Perl which has no web presence (the app, not the 
company). Though the web stuffs at the company are handled in ASP, and 
in general are hugely cost ineffective and overdesigned.  I think this 
is somewhat regional in nature, OSS has a much bigger presence on the 
two coasts (of the US) and much less presence in the heartland, this can 
also be said about Unix/Linux.

What I would like to see is more embracing of Perl to handle non-web 
enabled apps (though most apps these days are getting web enabled), or 
at least where the web portion is not the primary function of the app. C 
and C++ apps are a huge target where absolute speed is not needed, I 
won't even mention the nightmare that are legacy systems JCL this and 
COBOL that... Based on postings on jobs.perl.org, Yahoo and Amazon are 
two of the big internet guys using Perl, Google does as well, and I know 
AOL has a significant POE application running behind the scenes.

Though it is always an interesting question of why must Perl become 
bigger?  Is it for His glory, or yours? (name that movie)

http://danconia.org

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



Re: Matching and general expressions

2004-01-18 Thread Kenton Brede
On Sun, Jan 18, 2004 at 05:22:46PM +0100, aSH ([EMAIL PROTECTED]) wrote:
 Hello,
 
 I'm trying to learn and use the patterns. This is my first serious 
 try with perl.
 
 I have a long list of words and phrases that I need to find.
 
 Let's take this example. I want to find this patterns anywhere, no 
 matter if there are followed by other characters:
 
 Central PendingCall object
 PendingCall.getOutputParameter
 PendingCall.getOutputParameterByName
 PendingCall.getOutputParameters
 
 I have been trying this:
 
 pattern=m/Central PendingCall object/
 pattern=m/PendingCall.getOutputParameter/
 
 But the last one it shadows  PendingCall.getOutputParameterByName
 
 So I tried this, but I'm not sure what this is doing:
 
 pattern=m/\bPendingCall.getOutputParameter\b(?!B)/
 
 I want to find my patterns always, with repetitions.
 
 I have been following this tutorial
 http://www.perldoc.com/perl5.6.1/pod/perlretut.html
 But now I need help with the code because I'm lost and I need to send 
 my code.

First let me say I'm a beginner myself so the following is not
necessarily best practice but it works.  I'm sure someone will give you
a better solution.  It would be easier to help if you would have posted
code but I've taken a stab at what you are trying to do.

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

while (DATA) {
print $1\n if m/\b(Central PendingCall object)\b/;
print $1\n if m/\b(PendingCall.getOutputParameter)\b/;
}

__DATA__
Central PendingCall object what the
PendingCall.getOutputParameter add this
that is the truth PendingCall.getOutputParameterByName
Central PendingCall object the
PendingCall.getOutputParameters
Adding a line here
PendingCall.getOutputParameter
__END__

I think only one line really needs explanation here.

print $1\n if m/\b(Central PendingCall object)\b/;

$1 contains the matched text in () \b defines a word boundary.

Hth,
Kent

-- 

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




On import v. Just Do It.

2004-01-18 Thread drieux


p0: yes, one can use an import() from a package
to make something like the scam of 'require in line'
for the twin pragma of 'use strict' and 'use warnings'
{ oye! }
p1: But there is this minor technical overhead that
comes with the process -
1.a: one needs to use h2xs to make sure that the
module will conform with the current best practices
and be appropriately installable in the CPAN way
1.b: one has to maintain that module just to make the
two lines of pragma readily available to all of one's
perl code.
1.c: the count of lines of the perl module vice the
simple inclusion of the two lines makes the process
a bit Wonky if you know what I mean.
p2: clearly the fact has been established that it can be done,
but it also notes the 'and you want this pain why?' problem
ciao
drieux
---

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



Re: AUTOLOAD error in a module

2004-01-18 Thread Luca Ognibene
On Sat, Jan 17, 2004 at 06:58:56PM -0800, drieux wrote:
 
 but when he try to launch a simple example :
  ./hello-world.pl
  Use of inherited AUTOLOAD for non-method gai::gai_init() is deprecated
  at ./hello-world.pl line 9. Can't locate auto/gai/gai_init.al in @INC
  (@INC contains: /usr/lib/perl5/5.8.0/i386-linux /usr/lib/perl5/5.8.0
  /usr/lib/perl5/site_perl/5.8.0/i386-linux
  /usr/lib/perl5/site_perl/5.8.0
  /usr/lib/perl5/site_perl .) at ./hello-world.pl line 9
 
  mmm what is this? if you want i can send Makefile.PM and gai.pm
 [..]
 
 There are clearly two or more problems here:
 
   a. the 'inherited autoload' problem - where something
   in your gai.pm has been set to 'autoload' the code
   gai::gai_init()
   that it thinks it is suppose to be finding by inheritence
   rather than from bootstrap
 
   b. Hence you should have set that up for use DynaLoader
   vice use AutoLoader?

ehm.. This is mine gai.pm

package gai;
require Exporter;
require DynaLoader;
@ISA = qw(Exporter DynaLoader);
package gai;
bootstrap gai;
package gai;
@EXPORT = qw( );
1;


 Is there a difference between the version of perl you are
 using on your PC and the 5.8 version on the linux box???
yes, i'm using perl-5.8.1 and he is using 5.8.0

hi!
Luca

-- 
Linux is obsolete
(Andrew Tanenbaum)

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




Fwd: AUTOLOAD error in a module

2004-01-18 Thread drieux
Sometimes life is Ironic. I had meant
to send this to the list, sent it, and
then remembered that I wanted to add something.
As a general rule of good form, one should leave
all upper case package names to sections and
all lower case package names to 'pragma' - as
such one may want to think about solving the form
here with say
	package Virgilio::Gai;

So that one has both upper and lower case letters
in the name space. I opted to hang it in the Virgilio
section because that is the 'name' you were emailing from.
On Jan 18, 2004, at 9:32 AM, Luca Ognibene wrote:
package gai;
require Exporter;
require DynaLoader;
@ISA = qw(Exporter DynaLoader);
package gai;
bootstrap gai;
package gai;
@EXPORT = qw( );
1;
looks like you have one package line too many in there.

I would of course start with h2xs...
Amongst other things it will help with your initial
frame work and provide the first test script.
get all of the declaration stuff out of your way
and THEN call bootstrap. eg
package Virgilio::Gai;
use 5.006;
use strict;
use warnings;
require Exporter;
require DynaLoader;
our @ISA = qw(Exporter DynaLoader);
our @EXPORT = qw( );
our %EXPORT_TAGS = ( 'all' = [ qw() ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
	our $VERSION = '1.03';

	bootstrap Virgilio::Gai $VERSION;

	1;

So how exactly ARE you exporting the names of functions
in this module to the user???
Is there a difference between the version of perl you are
using on your PC and the 5.8 version on the linux box???
yes, i'm using perl-5.8.1 and he is using 5.8.0
Strange.

ciao
drieux
---

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



Re: Matching and general expressions

2004-01-18 Thread aSH
It works like charm Kenton!

Thank you very much! :)

aSH

On Sunday, January 18, 2004, at 06:14 PM, Kenton Brede wrote:

On Sun, Jan 18, 2004 at 05:22:46PM +0100, aSH 
([EMAIL PROTECTED]) wrote:
Hello,

I'm trying to learn and use the patterns. This is my first serious
try with perl.
I have a long list of words and phrases that I need to find.

Let's take this example. I want to find this patterns anywhere, no
matter if there are followed by other characters:
Central PendingCall object
PendingCall.getOutputParameter
PendingCall.getOutputParameterByName
PendingCall.getOutputParameters
I have been trying this:

pattern=m/Central PendingCall object/
pattern=m/PendingCall.getOutputParameter/
But the last one it shadows  PendingCall.getOutputParameterByName

So I tried this, but I'm not sure what this is doing:

pattern=m/\bPendingCall.getOutputParameter\b(?!B)/

I want to find my patterns always, with repetitions.

I have been following this tutorial
http://www.perldoc.com/perl5.6.1/pod/perlretut.html
But now I need help with the code because I'm lost and I need to send
my code.
First let me say I'm a beginner myself so the following is not
necessarily best practice but it works.  I'm sure someone will give you
a better solution.  It would be easier to help if you would have posted
code but I've taken a stab at what you are trying to do.
#!/usr/bin/perl
use warnings;
use strict;
while (DATA) {
print $1\n if m/\b(Central PendingCall object)\b/;
print $1\n if m/\b(PendingCall.getOutputParameter)\b/;
}
__DATA__
Central PendingCall object what the
PendingCall.getOutputParameter add this
that is the truth PendingCall.getOutputParameterByName
Central PendingCall object the
PendingCall.getOutputParameters
Adding a line here
PendingCall.getOutputParameter
__END__
I think only one line really needs explanation here.

print $1\n if m/\b(Central PendingCall object)\b/;

$1 contains the matched text in () \b defines a word boundary.

Hth,
Kent
--

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



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



Building Perl 5.8.2 for distribution

2004-01-18 Thread Holler, Lesley W
Hi all,

  I am current attempting to build perl for distribution at my site.  I want to build 
perl and all modules that I need in one directory, and distribute it in another.
(*NOTE  I want this to do this on our dedicated compile server and therefore wish to 
separate build from install directories as to not degrade other developers 
capabilities)

Example:

build in /home/myuser/PERL582
distribute to /opt/perl5

It looks like Configure has some options to help with this but I am LOST!.
The primary problem I can think of is the @INC array.  But I don't know the proper way 
to change it for this situation, and maybe there are more problems that I don't know 
about.

Please help and thanks!

L. Wade Holler
email: [EMAIL PROTECTED]




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




Re: Why isn't perl used more in business and industry

2004-01-18 Thread Robert
Dan Anderson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Most of the scripts I see end in an extension like .jsp, .asp, .dll, or
 something which says that they aren't perl.  Is there a reason more
 businesses and online companies don't use perl?

 -Dan


There was a huge outcry from the other programming languages that Perl was
being unfair because it was so good.



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




RE: Why isn't perl used more in business and industry

2004-01-18 Thread Charles K. Clarkson
Robert [EMAIL PROTECTED] wrote:
: 
: There was a huge outcry from the other programming languages
: that Perl was being unfair because it was so good.

I hate it when languages cry.


Charles K. Clarkson
-- 
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328



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




Re: Building Perl 5.8.2 for distribution

2004-01-18 Thread Kenton Brede
On Sun, Jan 18, 2004 at 09:07:44AM -0500, Holler, Lesley W ([EMAIL PROTECTED]) wrote:
 Hi all,
 
   I am current attempting to build perl for distribution at my site.  I want to 
 build perl and all modules that I need in one directory, and distribute it in 
 another.
 (*NOTE  I want this to do this on our dedicated compile server and therefore wish to 
 separate build from install directories as to not degrade other developers 
 capabilities)
 
 Example:
 
   build in /home/myuser/PERL582
   distribute to /opt/perl5
 
 It looks like Configure has some options to help with this but I am LOST!.
 The primary problem I can think of is the @INC array.  But I don't know the proper 
 way to change it for this situation, and maybe there are more problems that I don't 
 know about.
 

You didn't mention which OS you are working with.  I've seen opt
directories on various *nix so maybe -
http://asic-linux.com.mx/~izto/checkinstall/index.php
would be of help.
Kent

-- 

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




C# on linux

2004-01-18 Thread rhlinux
hello all,
Do any one know how can i run C# on linux, and if i can use the visual studio editor.
and How please 
thanks 


Re: Fwd: AUTOLOAD error in a module

2004-01-18 Thread Luca Ognibene
On Sun, Jan 18, 2004 at 10:08:53AM -0800, drieux wrote:
 
 On Jan 18, 2004, at 9:32 AM, Luca Ognibene wrote:
 
 package gai;
 require Exporter;
 require DynaLoader;
 @ISA = qw(Exporter DynaLoader);
 package gai;
 bootstrap gai;
 package gai;
 @EXPORT = qw( );
 1;
 
 
 looks like you have one package line too many in there.
 
 I would of course start with h2xs...
I've used swig, it created a gai_wrap.c file.. now i'll try with h2xs
when i'll have free time! 
Thanks!
hi!
-- 
56. Sorry, we deleted that package last week...

--Top 100 things you don't want the sysadmin to say

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




Re: C# on linux

2004-01-18 Thread Oliver Schnarchendorf
On Mon, 19 Jan 2004 11:26:52 +0200, rhlinux wrote:
 Do any one know how can i run C# on linux, and if i can use the 
 visual studio editor.

This is not really the place to ask this question... still you will get an 
answer:

You can run C# on Linus by going to http://www.go-mono.org/ and downloading 
(a) mono and (b) the C# compiler.

One problem though... you can't use Visual Studio on Linux, because it's 
MS-ware.

/oliver/


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




Re: C# on linux OT

2004-01-18 Thread Dan Anderson
On Mon, 2004-01-19 at 04:26, rhlinux wrote:
 hello all,
 Do any one know how can i run C# on linux, and if i can use the visual studio editor.
 and How please 

This is way off topic.  However, there are a number of ways to run
windows programs on Linux, including Wine, Crossover Office, VMWare (I
think that's what it's called), and Exceed hummingbird.  Google for all
of those.

-Dan


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




Re: C# on linux

2004-01-18 Thread Dan Anderson
   One problem though... you can't use Visual Studio on Linux, because it's 
 MS-ware.

That's not 100% true.  Of course, whether or not he can run it without
any problems is a different story.  If I remember correctly and
Hummingbird allows him to do the Windoze equivalent of an ssh with X
forwarding into a windows box, he could.  Of course, for $500+ a head,
why not just use Windoze?

-Dan


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




Calculations with date

2004-01-18 Thread danield
Hello all,

I am looking for an advice or suggestion in this task:

I do have a Perl script which contains 2 variables ($low, $high). The
value assigned to them depends on which day am I running that Perl
script. Moreover, the variable $low has always be the first day of the
previous month and similarly the variable $high the last day of the
previous month.

For instance:
If I run this script today (2004, January 18), the low should be (18
days of current month + total days of previous month (2003, December
(31)))= 49. The $high
would get (how many days ago was the last day of the previous month) =
18.
 
$low = 49
$high = 18
 
I am doing this calculations manually before I run the script. I would
like to have this value determined and substituted inside the script. In
addition the script should know how much day each month has and also
correctly recognize when the month February has 28 and when 29 days and
so on...


I would appreciate any suggestions or examples. Thank you for your time.

danield


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




Re: Calculations with date

2004-01-18 Thread Dan Anderson
100:1 there's a date arithmetic module on CPAN which would do exactly
what you need.

However, (at least from my point on the net), CPAN appears to be down.

-Dan


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




exit perl script and cd in bash?

2004-01-18 Thread Kenton Brede
I've been searching the archives and google for an answer.  I suspect it
can't be done but thought I'd ask.  

What I'm trying to do is create a tool such as cdargs, in perl, to
simplify moving between directories on the command line.

The problem I'm having of course is actually changing the shell's
working directory from the Perl script.  Is there anyway I can do this 
with Perl?   
Thanks,
Kent

-- 

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




Re: Calculations with date

2004-01-18 Thread Owen Cook

On Sun, 18 Jan 2004, danield wrote:
 
 I am looking for an advice or suggestion in this task:
 
 I do have a Perl script which contains 2 variables ($low, $high). The
 value assigned to them depends on which day am I running that Perl
 script. Moreover, the variable $low has always be the first day of the
 previous month and similarly the variable $high the last day of the
 previous month.
 
 For instance:
 If I run this script today (2004, January 18), the low should be (18
 days of current month + total days of previous month (2003, December
 (31)))= 49. The $high
 would get (how many days ago was the last day of the previous month) =
 18.
  
 $low = 49
 $high = 18
  
 I am doing this calculations manually before I run the script. I would
 like to have this value determined and substituted inside the script. In
 addition the script should know how much day each month has and also
 correctly recognize when the month February has 28 and when 29 days and
 so on...


If you have Date::Calc installed, run this and see if it gives you any
clues

#!/usr/bin/perl -w

use Date::Calc qw(Days_in_Month Add_Delta_YM);

@t = localtime(time);
$mon = $t[4]+1; $yr = $t[5]+1900; $day=$t[3];

$days_in_month = Days_in_Month($yr,$mon);
print $days_in_month \t $yr \t $mon\n;

($yr,$mon,$day) = Add_Delta_YM($yr,$mon,$day,0,-1);

$days_in_month = Days_in_Month($yr,$mon);
print $days_in_month \t $yr \t $mon\n;
 


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




Re: C# on linux

2004-01-18 Thread Randal L. Schwartz
 Oliver == Oliver Schnarchendorf [EMAIL PROTECTED] writes:

Oliver You can run C# on Linus

I think Linus would object to that. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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




Re: Calculations with date

2004-01-18 Thread James Edward Gray II
On Jan 18, 2004, at 5:20 PM, danield wrote:

Hello all,

I am looking for an advice or suggestion in this task:

I do have a Perl script which contains 2 variables ($low, $high). The
value assigned to them depends on which day am I running that Perl
script. Moreover, the variable $low has always be the first day of the
previous month and similarly the variable $high the last day of the
previous month.
For instance:
If I run this script today (2004, January 18), the low should be (18
days of current month + total days of previous month (2003, December
(31)))= 49. The $high
would get (how many days ago was the last day of the previous month) =
18.
$low = 49
$high = 18
If I understand the request correctly, the following seems to work:

#!/usr/bin/perl

use strict;
use warnings;
my $high = (localtime)[3];
my $low = (localtime time - $high * 24 * 60 * 60)[3] + $high;
print Low:  $low, High:  $high\n;

__END__

Hope that helps.

James

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