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]
 



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]> 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]
 




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]
 




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]
 




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]
 




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]
 




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]
 




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]
 




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  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]
 




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]
 




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: 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]
 




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]
 




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]
 




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]
 




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 () {
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]
 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



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]
 



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]
 




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]
 



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 () {
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]
 




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]
 



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]
 



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]
 




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]
 



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]
 




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]
 




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]
 




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]
 




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/ 
> 1435206&mode=thread&tid=100&tid=126&tid=137&tid=145&tid=156

See also



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]
 




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]
 




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]> 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]
 




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




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]> 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]
 




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]