Re: Simple question

2003-08-08 Thread Mike Flannigan

> Subject: Simple question
> Date: Fri, 8 Aug 2003 07:09:24 -0600
> From: "Trevor Morrison" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
>
> Hi,
>
> I am trying to compare two arrays to find  common numbers in both.
For the
> numbers that are not common to both, I want to write them to a file
for my
> review.  I have included the code below, but it is not working as
intended.
> I know that this is a real basic question, but I have been staring at
this
> for hours and am not seeing it.  I am assuming that there must me a
module
> that will do this, but I have decided to reinvent the wheel!
>
> TIA
>
> Trevor


If you ever decide to get away from reinventing the wheel,
you might want to use some script from perlfaq4:


# This program compares 2 arrays and gives the Intersection (elements
# common to both arrays), Difference (elements that are in one of
# the arrays, but not both) and Union (all elements in either array).
#
# First, duplicates records are removed from both arrays.
# Then the Intersection, Difference, and Union are calculated
# and printed.
#
use strict;
use warnings;

my @in1 = ("a","b","c","d","e","f","g","d");
my @in2 = ("h","k","b",'c',"i","g","k","j");

# This strips duplicates out of @in1
#
undef my %saw1;
my @array1 = grep(!$saw1{$_}++, @in1);

# This strips duplicates out of @in2
#
undef my %saw2;
my @array2 = grep(!$saw2{$_}++, @in2);

# This is the Intersection, Difference, and Union part
#
my @union = my @intersection = my @difference = ();
my %count = ();
foreach my $element (@array1, @array2) { $count{$element}++ }
foreach my $element (keys %count) {
push @union, $element;
push @{ $count{$element} > 1 ? [EMAIL PROTECTED] : [EMAIL PROTECTED] },
$element;
}

print "\n\nIntersection: @intersection\n\n";
print "Difference: @difference\n\n";
print "Union: @union\n\n";

__END__



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



Re: how do i list the methods connected to a object?

2003-08-08 Thread Ovid
--- "Martin A. Hansen" <[EMAIL PROTECTED]> wrote:
> hi
> 
> i wonder how i can list all the methods availible from a given object?
> 
> martin

Hi Martin,

The simple answer:  You can't.  Welcome to Perl.

The long answer:  there are a variety of strategies you can use to try and figure this 
out, but
all of them fall short.  For example, here's a snippet that prints out defined 
subroutines (or
methods) in a given package:

  {
no strict 'refs';
my $namespace = sprintf "%s::", $CLASS;
foreach (keys %{$namespace}) {
  my $test_sub = sprintf "%s%s", $namespace, $_;
  print "$test_sub\n" unless defined &$test_sub;
}
  }

The problem here is that it will not print inherited or AUTOLOADed methods.  It might 
be
sufficient for your needs now, but it's fragile.  You can also test whether or not a 
particular
method *is* implemented:

  if ($object->can('method_name_to_test')) {
# this works if $object can have methods called on it.  It will find
# inherited methods.  It can also find AUTOLOADed methods if they've
# already been called and installed in the symbol table
  }

A slightly more robust version of that syntax:

  if (UNIVERSAL::can($object, $method_name) {
# almost the same thing, but doesn't die a horrible death if, for example,
# $object is undef
  }

If you explain the problem you're trying to solve, we might be able to come up with a 
better
solution.

Cheers,
Ovid

=
Silence is Evilhttp://users.easystreet.com/ovid/philosophy/indexdecency.htm
Ovid   http://www.perlmonks.org/index.pl?node_id=17000
Web Programming with Perl  http://users.easystreet.com/ovid/cgi_course/

__
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

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



RE: data recovery ext3 (was RE: Recover zip file via Archive::Zi p)

2003-08-08 Thread West, William M

>From: Tassilo von Parseval [mailto:[EMAIL PROTECTED]


>Subject: Re: data recovery ext3 (was RE: Recover zip file via Archive::Zip)
>
>On Thu, Aug 07, 2003 at 03:09:06PM -0400 West, William M wrote:
>>
>> i am not sure what all the components do anymore- i did not document it
>well
>> :P
>
>Let me help. :-)

why thank you :)



>> now that i've looked at it, it's really for getting to files that are
>> unlinked etc. so i am not sure it will do you any good.
>
>Partly it might. The only problem with your script is that it cannot
>deal with data that is spanning more than 12 inodes (those were usually
>not in one block but fragmented over the harddisk). A line like this
>shows such a trickier example:
>
>99526  0 100644 6761321/1027 Sat Feb  2 09:11:58 2002

well.. this is interesting- i am not sure how to interpret this line
properly.  also, i assume that even split inodes will all get shoved through
the script... so, perhaps there is a way to concatonate/rename the split
inodes?  or is there no way to see which belongs to which group?


>
>I don't by hard know what to do with it, but it is laid out in the ext2
>undeletion how-to.

well- this gives me a place to start looking. :)

>
>> to bring this more on topic, i would like to see what ways something like
>> this can be improved- it served useful to me in the past, but i'm sure it
>> can be made more useful:::
>>
>>
>> #!/usr/bin/perl
>>
>> # added proper things when retyping it:
>> use warnings;
>> use diagnostics;
>> use strict;
>> #---
>>
>> my $cfile = "/tmp/commands.file";
>> my $filesystem ="/dev/hda6";
>> my @path = ("/tmp/recover","","/recover","",".ebu");  #making a path to
>put
>> my $date="Oct";  #just files from October#stuff later
>>
>> open (OUT,">$cfile");
>> print OUT "open $filesystem\n";# i wonder what this is for?
>
>Debug message?

no-> i wasn't all that sophisticated.. *shrug*  

>
>> foreach (`/sbin/debugfs -R lsdel /dev/hda6`){#why did i hard code
>/dev/hda6?
>>
>> #debugfs let's me list a bunch of inodes and i stick the list in a file
>>
>> m/(\d+)/;
>> $path[3]=$1;   #had to split this regex to dead with some edge
>case
>> $1=~m/(\d)/; # but i can't recall what
>>
>> $path[1]=$1;
>> my $quatch = join("",@path);
>> my $place= "path[0]$path[1]";
>> print OUT("dump <$path[3]> $quatch\n") if ((m/$date/));
>
>Essentially, from a line like
>
>2210070   1000 100600  228432/   6 Wed Jul 23 09:26:10 2003
>
>you extract the inode (2210070) and from that turn
>
>my @path = ("/tmp/recover","","/recover","",".ebu");
>
>into
>
>@path = ("/tmp/removed", 2, "/recover", 2210070, ".ebu");
>
>So the deleted inode gets dumped into
>
>/tmp/removed/2/recover/2210070.ebu
^^^--- typo!  *laugh*
>
>This could have been done more easily:
>
>@path[3,1] = /((\d)\d+)/;

fantastic!  i have never been terribly good with regexes and am trying to 
avoid learning them again until perl6  *laugh*  i must to too darn lazy!!


>
>> `mkdir $place`;
>> }



>>
>>
>> -
>>
>> then i chmod 755 command.file?  or is it a file used by another tool???
>
>command.file is the list of dump directives. It's supposedly a shell
>script that you can run later. So the above Perl script just generates
>another script. I am just not sure about
>
>> print OUT "open $filesystem\n";
>
>open /dev/hda6
>
>is not a meaningful command in shell scripts AFAIK.
>

i agree- but something is nagging at the back of my head, telling me that it
was useful perhaps it is readable by another command... instead of using
mount...  *sigh*  i don't know :P




>Tassilo


i'll try to rewrite it... see if i can get it to work again :)


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



Re: Regex Pattern

2003-08-08 Thread david
Trevor Morrison wrote:

> HI,
> 
> I am trying to use regex to extract the city,state and zip out of a file.
> Now, the problem is the city can have more then one word to it like
> 
> San Antonio
> 
> San Francisco
> 
> etc,
> 
> I have also, bumped into case of 4 or 5 words in the city name!  I am
> looking for a regex expression that will take this into account knowing
> that the form of the line is:
> 
> city[space]state(2 letters)[space] zip (could be 5 or 9 digits)
> 
> An example:
> 
> Loves Park IL 6
> or
> APO  AE NY 09012
> or
> St. George UT 84770
> or
> Columbus OH 43202
> or
> Salt Lake City UT 84118
> 
> 
> TIA
> 
> Trevor

try:

#!/usr/bin/perl -w

use strict;

while(<>){
chomp;
my($city,$state,$zip) = /(.+)\s+(\S+)\s+(\S+)/;
print pack("A7","city:"),$city,"\n";
print pack("A7","State:"),$state,"\n";
print pack("A7","Zip:"),$zip,"\n";
}

__END__

it doesn't really meet your "requirement" since it also matches:

Salt Lake City Ut. 84118-12345

but you might consider that to be a valid US address.

david

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



Re: Help with Unlink please

2003-08-08 Thread Janek Schleicher
Steve Grazzini wrote at Wed, 06 Aug 2003 23:38:00 -0400:

> On Wed, Aug 06, 2003 at 11:49:20PM -0400, perlwannabe wrote:
>> I have made the script as simple as possible and cannot get 
>> unlink to work.
>> 
>> unlink ("c:\testdir\*030977*.*") || die "unlink failed: $!";
> 
> You'd need to expand the wildcards yourself:
> 
>   my $pat = 'c:\testdir\*030977*.*';
>   foreach (glob($pat)) {
>   unlink or warn "Couldn't unlink '$_': $!";
>   }

Or if you want to write it as a one liner,
you can exploit that unlink also takes a list as its arguments:

unlink glob "c:/testdir/*030977*.*" or die "No files unlinked: $!";


Greetings,
Janek

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



Re: Simple question

2003-08-08 Thread Chris Carver
You seemed to have just answered your own question if I completely understand what 
you're asking.

@array = qw/1000 50 20 2000/;
$var1 = $array[0]/10;   #100
$var2 = $array[1]/10;   #2
$var3 = $array[3]/2000; #1

If anything is not clear just say so.

Chris Carver
Pennswoods.Net
Mail Administrator

On Tue, 5 Aug 2003 09:05:17 -0600 
"Sommer, Henrik" <[EMAIL PROTECTED]> wrote:

> Hi, 
>   How do I divide a variable in an array ?
>   Lets say element one need to be divided by 1000?
>   
>   $line[1] = $line[1]/1000; 
>   
>   Thanks, 
>   Henrik
> 
> -- 
> 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: Regex Pattern

2003-08-08 Thread Trevor Morrison
Jeff,

Thanks for taking the time to look over my problem.  In the end, I did end
up using your idea on the map ( scalar reverse).  It worked like a champ!
Thanks again.

Trevor

-Original Message-
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 07, 2003 6:19 PM
To: Trevor Morrison
Cc: [EMAIL PROTECTED]
Subject: Re: Regex Pattern


On Aug 7, Trevor Morrison said:

>I am trying to use regex to extract the city,state and zip out of a file.
>Now, the problem is the city can have more then one word to it like
>
>San Antonio
>San Francisco
>
>I have also, bumped into case of 4 or 5 words in the city name!  I am
>looking for a regex expression that will take this into account knowing
that
>the form of the line is:
>
>city[space]state(2 letters)[space] zip (could be 5 or 9 digits)
>
>Loves Park IL 6
>APO  AE NY 09012
>St. George UT 84770
>Columbus OH 43202
>Salt Lake City UT 84118

The simplest way is to ignore what form the city might take, and deal with
the knowns -- the state will be two uppercase letters, and the zip code
will be five to nine digits.

  my ($city, $state, $zip) = $line =~ /^(.*) ([A-Z]{2}) (\d{5,9})$/;

This assumes the fields are separated by a space.  It also only checks for
AT LEAST 4 and AT MOST 9 digits, so it would let a 7-digit zip code
through.  If you want to be more robust, the last part of the regex could
be

  (\d{5}(?:\d{4})?)

which ensures 5 digits, and then optionally matches 4 more.  Then again,
maybe just

  (\d{9}|\d{5})

is simpler on the eyes and brain.

Another approach, if you don't really care about the format of the lines,
and you just want to extract the fields regardless of HOW they look, is to
reverse the line, split it into three pieces, and then reverse each of
those pieces.  A line like "Salt Lake City UT 54321" would be reversed to
"12345 TU ytiC ekaL tlaS", split into three pieces ("12345", "TU", and
"ytiC ekaL tlaS"), and then each of those pieces would be reversed again,
to give back "54321", "UT", and "Salt Lake City".

  my ($zip, $state, $city) =
map { scalar reverse }  # reverse (in scalar context) (it's important)
split ' ', (reverse $line), 3;

But maybe that's more than you need.

--
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
 what does y/// stand for?   why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


--
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: data recovery ext3 (was RE: Recover zip file via Archive::Zi p)

2003-08-08 Thread West, William M
>> now that i've looked at it, it's really for getting to files that are
>> unlinked etc. so i am not sure it will do you any good.
>
>Partly it might. The only problem with your script is that it cannot
>deal with data that is spanning more than 12 inodes (those were usually
>not in one block but fragmented over the harddisk). A line like this
>shows such a trickier example:
>
>99526  0 100644 6761321/1027 Sat Feb  2 09:11:58 2002
>
>I don't by hard know what to do with it, but it is laid out in the ext2
>undeletion how-to.


well, the undeletion howto is a little old (1999) but interesting to look
through...


http://tldp.org/HOWTO/Ext2fs-Undeletion.html#toc9


>
>> to bring this more on topic, i would like to see what ways something like
>> this can be improved- it served useful to me in the past, but i'm sure it
>> can be made more useful:::
>>
>>
>> #!/usr/bin/perl
>>
>> # added proper things when retyping it:
>> use warnings;
>> use diagnostics;
>> use strict;
>> #---
>>
>> my $cfile = "/tmp/commands.file";
>> my $filesystem ="/dev/hda6";
>> my @path = ("/tmp/recover","","/recover","",".ebu");  #making a path to
>put
>> my $date="Oct";  #just files from October#stuff later
>>
>> open (OUT,">$cfile");
>> print OUT "open $filesystem\n";# i wonder what this is for?
>
>Debug message?
>

no!  :)   debugfs -f /filepath  :)  open opens the filesystem without
mounting it... then dump does its thing- all inside debugfs!!


>
>command.file is the list of dump directives. It's supposedly a shell
>script that you can run later. So the above Perl script just generates
>another script. I am just not sure about
>
>> print OUT "open $filesystem\n";
>
>open /dev/hda6
>
>is not a meaningful command in shell scripts AFAIK.


and the mystery is solved!!!


now i would like to look into using this to make a perl script to automate
file recovery well, someday at anyrate!

willy

:)


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



Re: win xp perl dist.

2003-08-08 Thread Oliver Schnarchendorf
On Wed, 06 Aug 2003 16:13:03 +1000, Dr J wrote:
> Dear Perl gurus, 
> Can someone please point me to a Perl distribution (compiler, sample
> scripts, CPAN stuff etc.) for 
> MS Windows? Preferably XP (home).
J,

you might want to use the standard perl distribution developed for 
Windows. You can download it from ActiveState.com under Active Perl.

ActiveState is actively developing the perl distribution and offers 
some nice extras like the perl package manager (something equal to 
cpan, but just for ActiveState modules).

Take a look, you might like it.

thanks
/oliver/


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



RE: Structuring Data in Perl

2003-08-08 Thread Smith Jeff D
Doh!!

Makes me humble every time.

Thanks for your help.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 05, 2003 12:54 PM
To: Smith Jeff D; '[EMAIL PROTECTED]'
Subject: RE: Structuring Data in Perl




On Tue, 5 Aug 2003 12:03:34 -0400 , Smith Jeff D
<[EMAIL PROTECTED]> wrote:

> Thanks for the response-I think that's got it.  I must have tried 
> everything but the correct approach, which looks so obvious after the 
> fact.
> 
> One small question.  In your sample code below, what format can I use 
> to refer to the individual members of the array referenced by $array  
> in the "each" loop?
> 
> --I know that @$array will produce all members of the array within the 
> hash--how do I refer to the individual members of this array 
> reference, however big it might be--1 to whatever number of elements.  
> In other words, if @$array for server01 contains "SUCCESS Today's Date 
> Other Details" and "WARNING Today's date Other", how do I refer to 
> array0 and array1 properly in a loop so I can deal with each one 
> separately---I know it isn't @$array[0] and @array$[1] because of the 
> errors I get, so it must be something else, ->[0], ->[1] but see the 
> following warning even though it gives me a result (this is a loop 
> following the grabbing of the $server and $array in the while/each 
> loop snippet you sent
> 
>   foreach my $i (@$array) {

Right here you have alraedy stored the array reference to $array, so when
you foreach over the array you are actually getting each element (detail
line) into $i. So...

>   print "Detail: @$array->[$i]\n";  #Produces the following
> warning:

In the above you are trying to index into an array using the value from that
array rather than an index. 

In other words what you are trying to retrieve is already in $i. If you want
to access individual elements of the array by index you need to loop over an
index range, not the array values themselves.

For instance,

foreach (0 .. @$array) {
   print $array->[$_];
}

>Argument "SUCCESS06/01/2003What wasn't done
> before\n" isn't numeric in array ele
>   ment at
> C:\local\win32app\EventLog\EventDumperinPerl\ha.pl line 29,  line
>   5.
>   Detail: WARNING06/01/2003Here are some details
> 

Now the really cool thing is that you can remove (if you want) the temporary
array dereference and access the elements directly, say you want the first
element of the 'server1's log...

$servers->{'server1'}->[0];

Or the first 5 elements of each of the servers...

- Untested -
foreach my $servername (keys (%$servers)) {
  my @first5lines = $servers->{$servername}->[0 .. 4];
}

There are any number of ways to access into the data structure directly.
Experience is about the only way to truly "get it" and once you do you won't
lose it again, and the doors will seemingly flood open to its uses, and of
course there is Perl OOP...

http://danconia.org

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



Re: Mime::Parser Question

2003-08-08 Thread awards
Hi,
thanks,

well MIME is the MOST Difficult module I've seen so far, I didn't use much
module tough :-).
is there any site that has good codes explanation on how to use
MIME::Parser.
The problem I have is that
I get the file into a folder called  c:\\gotmail  the mimeparser puts into
this folder the messages with its folder so i get now
C:\\gotmail\\msg-15435-54654-222
ok fine but the problem I have is that I have no control on how get the
folders name or even rename.
I tried to look at
MIME::Parser::Filer but no luck
And my second problem i have is to delete the folder
using
$parser->filer->purge  It deletes the files inside msg-15435-54654-222  but
not the folder itself!!
buh it is horrible.

Anyhow thank you!



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



Re: Getting refering page

2003-08-08 Thread Charles Logan
On Friday 08 August 2003 00:13, Randal L. Schwartz wrote:

> No you don't.  Referer is easily spoofed, sometimes stripped, and
> sometimes wrong.  You can log it, but only a fool would base a
> security mechanism around it.

Well, I'm certainly foolish enough without adding to it.  So, does Perl offer 
any fool proof mechanism to determine if a script is being called from
a local page, or if it's being 'borrowed' (hot linked) from some other site?
I don't know what information the C code I refered to uses, but it returns
the IP address and a full url of the requesting site that can be compared to
a list of allowed domains and/or pages.  Even this may not offer 100%
security, but it appears to be enough to thwart all but the most hard core
hotlinkers and bandwith thiefs.

Cheers,
Charles


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



RE: Last value in a array?

2003-08-08 Thread Bob Showalter
[EMAIL PROTECTED] wrote:
> Hi,
> 
> I have a couple of arrays which have different number of
> values - I need only the last value in each - are there a command to
> do that? 
> 
> e.g
> 
> $array[LAST]  :-)

Negative subscripts count from the end of the array, so the last element is:

   $array[-1]

You can also use the $#array notation to get the index of the last element:

   $array[$#array]

The total number of elements can be determined by using the array name in
scalar context. Array indices start at 0, unless you monkey with $[, which
is discouraged. So you could also use:

   [EMAIL PROTECTED] - 1]

Most folks would probably just use $array[-1]

If you want to get the last element and remove it from the array, just use
pop:

   my $last = pop @array;

> 
> or maybe a way to count each value in a given array? and then
> feed the $array[??] with that?

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



Quick export question

2003-08-08 Thread Dan Muey
I'm wanting to setup a module that will export whatever is in @EXPORT (if anythign) 
and ':basic'

IE  I want 
use Monkey;
To be identical to 
use Monkey qw(:basic);

So if I have this on the module which of 3 ways I'm trying to accoomplish that are 
valid (if any)?

%EXPORT_TAGS = {
':basic' => [qw(fred wilma barney dino)],
};
$EXPORT_TAGS{':DEFAULT'} = $EXPORT_TAGS{':basic'}; # this would do it right?
Or
$EXPORT_TAGS{':DEFAULT'} .= $EXPORT_TAGS{':basic'};
Or
$EXPORT_TAGS{':DEFAULT'} = ($EXPORT_TAGS{':basic'},@EXPORT);

TIA

Dan

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



Regex Pattern

2003-08-08 Thread Trevor Morrison
HI,

I am trying to use regex to extract the city,state and zip out of a file.
Now, the problem is the city can have more then one word to it like

San Antonio

San Francisco

etc,

I have also, bumped into case of 4 or 5 words in the city name!  I am
looking for a regex expression that will take this into account knowing that
the form of the line is:

city[space]state(2 letters)[space] zip (could be 5 or 9 digits)

An example:

Loves Park IL 6
or
APO  AE NY 09012
or
St. George UT 84770
or
Columbus OH 43202
or
Salt Lake City UT 84118


TIA

Trevor


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



RE: ERRNO ... What am I missing

2003-08-08 Thread Jeff 'japhy' Pinyan
On Aug 7, Allison, Jason (JALLISON) said:

>#!/usr/local/bin/perl
>  printf "Hello World\n";
>  printf "ERRNO:  %d\n", $!;
>#  use lib "$ENV{RTM_HOME}/rtm/src/vtm";
>#  printf "ERRNO:  %d\n", $!;

>$ t
>Hello World
>ERRNO:  0

Why are you bothering to look at $! here?

>#!/usr/local/bin/perl
>  printf "Hello World\n";
>  printf "ERRNO:  %d\n", $!;
>  use lib "$ENV{RTM_HOME}/rtm/src/vtm";
>  printf "ERRNO:  %d\n", $!;

That 'use lib' line is happening FIRST, because 'use' happens at
compile-time, and the rest of your program happens at run-time.

But WHY ARE YOU LOOKING AT $! here?  There's no reason to.  $! has no
meaningful value unless something has gone wrong.  Nothing has gone wrong,
so don't worry about it.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
 what does y/// stand for?   why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


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



win xp perl dist.

2003-08-08 Thread Dr J
 
Dear Perl gurus,
 
Can someone please point me to a Perl distribution (compiler, sample
scripts, CPAN stuff etc.) for 
MS Windows? Preferably XP (home).
I have Goggle'd around and found quite a few, but would like
recommendations from this list. Perhaps
this list has a common preference to a particular distribution?
I've been running Perl on Unix/Linux for some time now, but wouldn't
mind seeing how appealing the 
Windows GUI environment is.
Thanks
Janice
 


Can Perl dealing with PID ?

2003-08-08 Thread 中華大熊貓
Is there any module in Perl can dealing with Procession ID on Win32?
And does Perll able to stop or start a services / application? 
Any pointers where I can start from ?

Thank you very much...

RE: SOLVED: how do i list the methods connected to a object?

2003-08-08 Thread Dan Muey
> On Aug 7, Martin A. Hansen said:
> 
> >print &dump_functions( $obj );
> 
> I'd think it's better for dump_functions() to return an array 
> ref, and let the end-user decide how to use its contents.
> 
> >sub dump_functions {
> >use Data::Dumper;
> >use Class::Inspector;
> >
> >my ( $obj ) = @_;
> >
> >my ( $ref, $methods, @methods );
> 
> You never use @methods.
> 
> >$ref = ref $obj;
> >$methods = Class::Inspector->methods( $ref, 'full', 'public' );
> >
> >@{ $methods } = grep /$ref/, @{ $methods };
> >return Dumper( $methods );
> 
> That should probably be /^$ref/, for "safety".  And I'd 
> probably just do
> 
>   return [ grep /^$ref/, @{ Class::Inspector->methods(...) } ]
> 
> >}

So would this return the methods that the $obj sent to dump_functions then, only 
shorter?

sub dump_functions {
use Class::Inspector;
my $r = ref $_[0];
return [ grep /^$r/, @{ Class::Inspector->methods($r,'full','public')} ]
}

Dan

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



RE: get http through a proxy authentication

2003-08-08 Thread Darbesio Eugenio
Jose`, your suggestion works fine. Problem solved.

Thanks a lot.

E.

-Original Message-
From: NYIMI Jose (BMB) [mailto:[EMAIL PROTECTED]
Sent: giovedì 7 agosto 2003 17.20
To: Darbesio Eugenio; [EMAIL PROTECTED]
Subject: RE: get http through a proxy authentication


Try

use LWP::UserAgent;
 $ua = LWP::UserAgent->new;
 $ua->proxy(['http', 'ftp'] => 'http://proxy.mydomain:port');
 $req = HTTP::Request->new('GET',"http://www.perl.com";);
 $req->proxy_authorization_basic("username", "password");
 $res = $ua->request($req);
 print $res->content if $res->is_success;


José.

-Original Message-
From: Darbesio Eugenio [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 07, 2003 5:02 PM
To: [EMAIL PROTECTED]
Subject: get http through a proxy authentication


Hi

In this code I do http request through the env proxy:

   my $user_agent = new LWP::UserAgent;
   $user_agent->agent("Mozilla/4.0");
   $user_agent->timeout($timeOut);
   $user_agent->env_proxy();   
   $page = ($user_agent->request(HTTP::Request->new(GET=>$url)))->as_string;

but my proxy requests an authetication (username/password).

How can I introduce authetication in my code?

Thanks!

E.

LOQUENDO S.p.A. 
Vocal Technology and Services 
www.loquendo.it 
[EMAIL PROTECTED]  




CONFIDENTIALITY NOTICE
This message and its attachments are addressed solely to the persons above and may 
contain confidential information. If you have received the message in error, be 
informed that any use of the content hereof is prohibited. Please return it 
immediately to the sender and delete the message. Should you have any questions, 
please contact us by replying to [EMAIL PROTECTED] Thank you 


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



 DISCLAIMER 

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.




CONFIDENTIALITY NOTICE
This message and its attachments are addressed solely to the persons
above and may contain confidential information. If you have received
the message in error, be informed that any use of the content hereof
is prohibited. Please return it immediately to the sender and delete
the message. Should you have any questions, please contact us by
replying to [EMAIL PROTECTED] Thank you


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



Closing window in Perl/Tk

2003-08-08 Thread Sachin Hegde
Hi all,
I am writing an UI application inPerl/Tk. I have some functions which I am 
supposed to run before the application closes. How do I calll this function, 
say Funct(), when the user clicks on the close icon of the window?
Sachin

_
Want to visit Spain? Click here. 
http://server1.msn.co.in/sp03/spain/index.asp Win a free trip.

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


RE: Quick export question

2003-08-08 Thread Dan Muey
> I'm wanting to setup a module that will export whatever is in 
> @EXPORT (if anythign) and ':basic'
> 
> IE  I want 
> use Monkey;
> To be identical to 
> use Monkey qw(:basic);
> 
> So if I have this on the module which of 3 ways I'm trying to 
> accoomplish that are valid (if any)?
> 
> %EXPORT_TAGS = {
>   ':basic' => [qw(fred wilma barney dino)],
> };

Sorry about the mess there, Let me fix it:

$EXPORT_TAGS{':DEFAULT'} = $EXPORT_TAGS{':basic'};

Or 

$EXPORT_TAGS{':DEFAULT'} .= $EXPORT_TAGS{':basic'}; 

Or 

$EXPORT_TAGS{':DEFAULT'} = > ($EXPORT_TAGS{':basic'},@EXPORT);

There that's more readable!


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