searching file and printing output

2002-01-10 Thread katia goforth

hello,

i have a file with contact information for a bunch of people (sometimes
other info)
name: katia
phone: 123-456-789

I want to read through this file and grab everything after name: and the
entire next like and print it in an out file like:

katia,123-456-789

I can parse the file and print the lines, but i haven't figured out how
to get them on the same line or only print what is after name: or phone:

#!/usr/bin/perl

open(FILE, "namelist") or die $!;
while () {
print $_ if(/name/ or /phone/);}
close FILE

the phone # is always right after the name.  I want to grab the #'s in
the next line instead of searching for "phone" to ensure i get the
correct phone # with the correct name.

any help or links is appreciated.
thank you
-katia


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




Compile .cgi programs

2002-01-10 Thread kondreddy Rama koti Reddy


Dear Friends, can u tell me, how can i create an executable file for the perlcgi 
program on linux. 
The cgi program is written in perl and it also have 
javascript for client side validations. 
cgi file have "require" and "use" statements. 

A1) How can i create exe files for the .cgi files with perlcc command. 
when i tried with perllcc -prog  
its giving the following error. 

/tmp/ccdiyw10.o: In function `xs_init': 
/tmp/ccdiyw10.o(.text+0x33b9): undefined reference to `boot_DynaLoader' 
collect2: ld returned 1 exit status 
ERROR: In compiling code for test.pl.c ! 


2) when i try to generate exe from .pl files with 
perllcc -o  =0D=0AIt's giving the following error. 


/tmp/ccdiyw10.o: In function `xs_init': 
/tmp/ccdiyw10.o(.text+0x33b9): undefined reference to `boot_DynaLoader' 
collect2: ld returned 1 exit status 
ERROR: In compiling code for test.pl.c ! 

I am using redhat linux 7.1 . 
what's is the problem, and how can i solve it. 
  
Thanking you. 

K.Rama koti Reddy 


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




return code

2002-01-10 Thread Ahmed Moustafa

Hi All,

I'm calling a Java application using "system". How can I know the return 
code of the called Java application?

Your help will be appreciated so much.

Ahmed
--
[EMAIL PROTECTED] | http://www.photo.net/users/ahmed


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




Completed Script

2002-01-10 Thread garrett esperum

Thank you all for helping me with my script! Below is it's final WORKING 
incarnation. You all were very nice and very helpful!!
Thank You!

#!/usr/local/bin/perl -w

use strict;
use File::Path;

my $file;
my $type;
my $currentLocation;
my $newLocation;
my $owner;
my $permissions;

open (MDATA, "meta-data") or die "Cannot open $!\n";
while () {
chomp;
my ( $file, $type, $currentLocation, $newLocation, $owner, 
$permissions ) = split ( /\t/ );
mkpath ( $newLocation, $owner, $permissions ) unless (-d 
$newLocation );
system ( "chmod '$permissions' '$newLocation'" );
system ( "chown  '$owner' '$newLocation'" );
system ( "cvs checkout -d '$newLocation' '$file' " );


}
close MDATA

Till next time,

-garrett

_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




Re: Calculate the distance between 2 coordinates

2002-01-10 Thread Brett W. McCoy

On Thu, 10 Jan 2002, Ray Seals wrote:

> I've been looking for either a perl script or module to help me
> calculate the distance between 2 coordinates.  Does anyone have any
> ideas or scripts?

There is a simple vector algebra algorithm for this:

If you have two points, p and q

p(a, b)

q(c, d)

the distance between p and q is the square root of the sum of the squares
of the differences between corresponding components:

d(p, q) = sqrt( (a - c )**2 + (b - d)**2 )

This applies to points of N-dimensions:

p(a1, a2, ... aN)
q(b1, b2, ... bN)

d(p, q) = sqrt( (a1 - b1)**2 + (a2 - b2)**2 + ... (aN - bN)**2 )

-- Brett
  http://www.chapelperilous.net/

Wharbat darbid yarbou sarbay?


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




RE: Calculate the distance between 2 coordinates

2002-01-10 Thread Ray Seals

I searched google and found several examples.  Should have done that
first but didn't think about it before I posted.

Sorry for the wasted bandwidth.

Ray

-Original Message-
From: Mel Matsuoka [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, January 10, 2002 6:03 PM
To: [EMAIL PROTECTED]
Subject: Re: Calculate the distance between 2 coordinates


At 09:56 PM 01/10/2002 -0600, you wrote:
>I've been looking for either a perl script or module to help me 
>calculate the distance between 2 coordinates.  Does anyone have any 
>ideas or scripts?

No need for a module, all you need to do is remember basic high-school
geometry. Two words: Pythagorean Theorem :)

Aloha,
mel


--
mel matsuoka
Technical Director/Trained Primate
Hawaiian Image Productions

[vox] +1 808.531.5474 
[fax] +1 808.526.4040
[e-mail] [EMAIL PROTECTED]
[www] http://www.hawaiianimage.com

-- 
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: Calculate the distance between 2 coordinates

2002-01-10 Thread Mel Matsuoka

At 09:56 PM 01/10/2002 -0600, you wrote:
>I've been looking for either a perl script or module to help me
>calculate the distance between 2 coordinates.  Does anyone have any
>ideas or scripts?

No need for a module, all you need to do is remember basic high-school
geometry. Two words: Pythagorean Theorem :)

Aloha,
mel


--
mel matsuoka
Technical Director/Trained Primate
Hawaiian Image Productions

[vox] +1 808.531.5474 
[fax] +1 808.526.4040
[e-mail] [EMAIL PROTECTED]
[www] http://www.hawaiianimage.com

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




Calculate the distance between 2 coordinates

2002-01-10 Thread Ray Seals

I've been looking for either a perl script or module to help me
calculate the distance between 2 coordinates.  Does anyone have any
ideas or scripts?


Ray


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




Re: Apache running perl scripts

2002-01-10 Thread Steve Maroney

never had to install perl on a windows box but the localhost problems
seems like you need to use a hosts file so localhost resolves.


hope this helps
Steve


On Fri, 11 Jan 2002, rabs wrote:

>
>  Hi All
>
>  Apologies as this is not strictly a perl question, Im trying to install an
>  apache websever onto a WIN95 system. I have managed to successfully install
>  it so far as it runs under the the URL http://127.0.0.1/  but will not run
>  when I type http://localhost.
>
>  I am running Apache 1.3.20,
>
>  Once this oddity is corrected ,I wish to test perl cgi using my localhost.
> I
>  believe that I need to alter the apache config file to run perl, but Im not
> sure which parts. I think its the ScriptAlias part, the httpd.conf file is
>  included as an attatchment, so hopefullly you can see what I have done
>  wrong, but Ive changed that to where I keep the perl script and I get is
>  this
>
>  << -
>
>  Internal Server Error
>  The server encountered an internal error or misconfiguration and was unable
>  to complete your request.
>  Please contact the server administrator, [EMAIL PROTECTED] and inform
>  them of the time the error occurred, and anything you might have done that
>  may have caused the error.
>
>  More information about this error may be available in the server error log.
>
>
>
>  ---
> -
>  
>
> Apache/1.3.20 Server at localhost Port 80
>
>
>  -->>>
>
>








Thank you,
Steve Maroney





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




Re: Apache running perl scripts

2002-01-10 Thread A. Rivera

Edit your hosts file (C:\windows\hosts, I think)

Add this line

127.0.0.1   localhost

- Original Message -
From: "rabs" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 10, 2002 4:35 PM
Subject: Apache running perl scripts


>
>  Hi All
>
>  Apologies as this is not strictly a perl question, Im trying to install
an
>  apache websever onto a WIN95 system. I have managed to successfully
install
>  it so far as it runs under the the URL http://127.0.0.1/  but will not
run
>  when I type http://localhost.
>
>  I am running Apache 1.3.20,
>
>  Once this oddity is corrected ,I wish to test perl cgi using my
localhost.
> I
>  believe that I need to alter the apache config file to run perl, but Im
not
> sure which parts. I think its the ScriptAlias part, the httpd.conf file is
>  included as an attatchment, so hopefullly you can see what I have done
>  wrong, but Ive changed that to where I keep the perl script and I get is
>  this
>
>  << -
>
>  Internal Server Error
>  The server encountered an internal error or misconfiguration and was
unable
>  to complete your request.
>  Please contact the server administrator, [EMAIL PROTECTED] and
inform
>  them of the time the error occurred, and anything you might have done
that
>  may have caused the error.
>
>  More information about this error may be available in the server error
log.
>
>
>
>  -
--
> -
>  
>
> Apache/1.3.20 Server at localhost Port 80
>
>
>  -->>>
>
>






> --
> 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: out vs my for efficiency Was: 'my' for each loop or no ?

2002-01-10 Thread Eric Beaudoin

Thanks for the info Curis.

I don't think I saw any answers from the more internal aware gurus out there and like 
Curtis, I would certainly like to know more about this.

TIA

At 14:32 2002.01.08, Curtis Poe wrote:
>--- Eric Beaudoin <[EMAIL PROTECTED]> wrote:
>> I was wondering if someone could explain why a variable define with a global scope 
>was slower
>> that one define within the local lexical scope when used in a loop?
>
>If I recall correctly, you should usually get better performance from lexically 
>scoped variables
>than from global ones.  Lexically scoped variables are stored in a private 
>"scratchpad" array and
>can be accessed directly by Perl.
>
>Globals, on the other hand, are stored in a public symbol table in a typeglob. Perl 
>has to do a
>hash lookup in the symbol table and then get the corresponding entry in the typeglob 
>for the
>variable you need.  No such lookup in necessary for lexicals, hence the better 
>performance.
>
>Any internals people around?   I'd love to hear some more knowledgeable people 
>/(?:correct|expand
>upon)/ this.
>
>Cheers,
>Curtis "Ovid" Poe
>
>=
>"Ovid" on http://www.perlmonks.org/
>Someone asked me how to count to 10 in Perl:
>push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
>shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A
>
>__
>Do You Yahoo!?
>Send your FREE holiday greetings online!
>http://greetings.yahoo.com
>
>-- 
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]

---
Éric Beaudoin


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




Apache running perl scripts

2002-01-10 Thread rabs


 Hi All

 Apologies as this is not strictly a perl question, Im trying to install an
 apache websever onto a WIN95 system. I have managed to successfully install
 it so far as it runs under the the URL http://127.0.0.1/  but will not run
 when I type http://localhost.

 I am running Apache 1.3.20,

 Once this oddity is corrected ,I wish to test perl cgi using my localhost.
I
 believe that I need to alter the apache config file to run perl, but Im not
sure which parts. I think its the ScriptAlias part, the httpd.conf file is
 included as an attatchment, so hopefullly you can see what I have done
 wrong, but Ive changed that to where I keep the perl script and I get is
 this

 << -

 Internal Server Error
 The server encountered an internal error or misconfiguration and was unable
 to complete your request.
 Please contact the server administrator, [EMAIL PROTECTED] and inform
 them of the time the error occurred, and anything you might have done that
 may have caused the error.

 More information about this error may be available in the server error log.



 ---
-
 

Apache/1.3.20 Server at localhost Port 80


 -->>>




httpd.conf
Description: Binary data

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


Log Users

2002-01-10 Thread Msftblows

I already have a user registration form set up, but now I want to be able to
display the last 10 visitors which logged into my site.

The current code I have does the following:

displays the last user to login 
what they did 
what anonymous users are doing using 3 different files


$session_username = user name
$pvaluekw = last key word by logged in user
$pnovaluekw = anonymouse users last key word

Any help would be appreciated

Thanks!

The current script:
###
sub get_username_now {

if ($session_username eq "") { print qq~Welcome to  $sitename! ~;}

if ($session_username ne "") { print qq~

  

Loged in as:   $session_username!
Log off

  

~;}




if ($session_username ne "") {
open (FILElastuser, ">$path/language/english/logs/lastuser.log");
print FILElastuser "$session_username";
  close (FILElastuser);}

open(IPS,"<$path/language/english/logs/lastuser.log");
$pvalue = ;
close(IPS); 

if ($session_username ne "") {
if ($helptopic ne "") {
open (FILElastuser, ">$path/language/english/logs/lastkw.log");
print FILElastuser "$helptopic";
  close (FILElastuser);
}
}

open(IPS,"<$path/language/english/logs/lastkw.log");
$pvaluekw = ;
close(IPS); 


if ($session_username eq "") {
if ($helptopic ne "") {
open (FILElastuser, ">$path/language/english/logs/nolastkw.log");
print FILElastuser "$helptopic";
  close (FILElastuser);
}
}

open(IPS,"<$path/language/english/logs/nolastkw.log");
$pnovaluekw = ;
close(IPS); 


print qq~

  

 Usage Details


  

~;

if ($pvalue ne "") { print qq~Last User to login:   $pvalue!~;}

if ($pvaluekw ne "") { print qq~Last action:   $pvaluekw!~;}

if ($pnovaluekw ne "") { print qq~Last public user action: 
  $pnovaluekw!~;}

print qq~




~;
}


1;

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




Re: V2 Sandbox Creation Script

2002-01-10 Thread garrett esperum

OK, I am almost there!

Current Script (it's named cre3.pl)

#!/usr/local/bin/perl -w

use strict;
use File::Path;
use File::Copy;

my $file;
my $type;
my $currentLocation;
my $newLocation;
my $owner;
my $permissions;
open (MDATA, "meta-data") or die "Cannot open $!\n";
while () {
chomp;
my ( $file, $type, $currentLocation, $newLocation, $owner, 
$permissions ) = split ( /\t/ );
mkpath ( $newLocation, $owner, $permissions ) unless (-d 
$newLocation );
chmod ( $permissions, $newLocation );
chown ( $owner, $newLocation );
system ( "cvs checkout '$file'" );
copy ( $file, $newLocation );
chmod ( $permissions, "newLocation/$file" );
chmod ( $owner, $newLocation/$file );


}
close MDATA

Error:

mkdir www
Argument "index.html" isn't numeric in division (/) at ./cre3.pl line 23, 
 line 1.
Argument "www" isn't numeric in division (/) at ./cre3.pl line 23,  
line 1.
Illegal division by zero at ./cre3.pl line 23,  line 1.

What am I doing wrong still? I am so close!

-garrett


>From: Curtis Poe <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: garrett esperum <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
>CC: [EMAIL PROTECTED]
>Subject: Re: V2 Sandbox Creation Script
>Date: Thu, 10 Jan 2002 16:29:03 -0800 (PST)
>
>--- garrett esperum <[EMAIL PROTECTED]> wrote:
> > Thanks! That helped,
> > This is what my script looks like now:
> >
> > #!/usr/local/bin/perl -w
> >
> > use strict;
> > use File::Path;
> > use File::Copy;
> >
> > my $file;
> > my $type;
> > my $currentLocation;
> > my $newLocation;
> > my $owner;
> > my $permissions;
> > open (MDATA, "meta-data") or die "Cannot open $!\n";
> > while () {
> > chomp;
> > ($file, $type, $currentLocation, $newLocation, $owner, 
>$permissions)
> > = split /\t/;
> > forech $newLocation
> > if ( not -d $newLocation );
> > mkpath($newLocation, $owner, $permissions) or die 
>"Couldn't
> > make the target directory: $!\n";
> >
> >
> > }
> > close MDATA
> >
> > And this is the error I get:
> >
> > Can't locate object method "forech" via package "www" (perhaps you 
>forgot to
> > load "www"?) at ./creat
> > ion.pl line 17,  line 1.
>
>Aack!  I just read the error message and didn't look at the code.  There 
>are a few other issues
>there.  Here's my guess as to what you were looking for:
>
> #!/usr/local/bin/perl -w
> use strict;
> use File::Path;
> use File::Copy;
>
> open (MDATA, "meta-data") or die "Cannot open $!\n";
> while () {
> chomp;
> my ($newLocation, $owner, $permissions) = (split/\t/)[ 3.. 5];
> foreach ( $newLocation ) {
> if ( not -d $newLocation ) {
> mkpath($newLocation, $owner, $permissions) or die 
>"Couldn't make the target
>directory: $!\n";
> }
> }
> }
> close MDATA
>
>I also wonder if you're misunderstand the use of mkpath().  From 'perldoc 
>File::Path':
>
> File::Path - create or remove directory trees
>
>SYNOPSIS
> use File::Path;
>
> mkpath(['/foo/bar/baz', 'blurfl/quux'], 1, 0711);
> rmtree(['foo/bar/baz', 'blurfl/quux'], 1, 1);
>
>DESCRIPTION
> The "mkpath" function provides a convenient way to create directories,
> even if your "mkdir" kernel call won't create more than one level of
> directory at a time. "mkpath" takes three arguments:
>
> *   the name of the path to create, or a reference to a list of paths 
>to
> create,
>
> *   a boolean value, which if TRUE will cause "mkpath" to print the 
>name
> of each directory as it is created (defaults to FALSE), and
>
> *   the numeric mode to use when creating the directories (defaults to
> 0777)
>
>The second argument is merely a boolean and not the owner.
>
>Also, you have File::Copy in your script, but you don't use it.  Is this 
>something you plan to use
>later?  If not, having it in your script may confuse someone (namely, me :)
>
>Cheers,
>Curtis "Ovid" Poe
>
>=
>"Ovid" on http://www.perlmonks.org/
>Someone asked me how to count to 10 in Perl:
>push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
>shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A
>
>__
>Do You Yahoo!?
>Send FREE video emails in Yahoo! Mail!
>http://promo.yahoo.com/videomail/
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>




_
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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




Re: regex for shared object files

2002-01-10 Thread John W. Krahn

Zentara wrote:
> 
> Hi,

Hello,

> I'm trying to find all .so.xxx files on my system.
> Eventually I want to do things with them, but for
> now I just want to identify them.
> 
> I pretty much have it, except I'm lacking enough
> regex knowledge to separate out the  so  from the .so.
> files.
> 
> I'm matching
> 
> cursor
> moc_sound
> libqt.so.2
> libqt-mt.so
> etc.
> 
> ##
> #!/usr/bin/perl -w
> use strict;
> use File::Basename;
> use File::Find;
> my $name;
> my $dirname= '/usr/lib';
> 
> find (\&found, $dirname);
> 
> sub found {
> ($name) = basename("$File::Find::name");

There is really no point in using basename() like this because
File::Find provides the file name.

perldoc File::Find

[snip]
   The wanted() function does whatever verifications you
   want.  `$File::Find::dir' contains the current directory
   name, and `$_' the current filename within that directory.
 ^^^
   `$File::Find::name' contains the complete pathname to the
   file. You are chdir()'d to `$File::Find::dir' when the
   function is called, unless `no_chdir' was specified.  When


> if ($name =~ m/.so/){
> print $name,"\n";
> }}
> ##


#!/usr/bin/perl -w
use strict;
use File::Find;

my $dirname = '/usr/lib';

find( \&found, $dirname );

sub found {
print "$_\n" if /\.so\./;
# or maybe
#   print "$_\n" if /\.so\.[^.]+$/;
}



John
-- 
use Perl;
program
fulfillment

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




Re: V2 Sandbox Creation Script

2002-01-10 Thread John W. Krahn

Garrett Esperum wrote:
> 
> Hello all,

Hello,

> Below is what I have so far for my script, I can get every piece to work
> correctly on it's own, nut I cannot get these two pieces to work together. I
> think I am messing up the syntax of this script. What Am I doing wrong?? How
> do I loop in the Directory creation, and file copy procedures??
> 
> #!/usr/local/bin/perl -w
> 
> use strict;
> use File::Path;
> use File::Copy;
> 
> my $file;
> my $type;
> my $location;
> my $owner;
> my $permissions;
> open (MDATA, "meta-data") or die "Cannot open $!\n";
> while () {
> chomp;
> ($file, $type, $location, $owner, $permissions) = split /\t/;

Because these variables are only used inside the while loop you should declare them 
here.

 my ($file, $type, $location, $owner, $permissions) = split /\t/;

Also, if you are only using one of the variables ($location) there is no
need to declare the other variables.

 my $location = (split /\t/)[2];


> forech $location
  ^^ ^
The first word should be "for" or "foreach".
The expression must be enclosed in parentheses.

foreach ( $location ) {
# OR
for ( $location ) {

But because $location is a single value (scalar) there is really no need to use a loop.

if ( $location ) {


> {
> unless( -d $location )
> {
> system mkdir $location or die "Couldn't make the target directory: 
>$!\n";
  
Is there any reason that you are not using the built-in mkdir() function?

perldoc -f mkdir


> }
> }
> }
> close MDATA
> 
> Error:
> 
> Global symbol "%location" requires explicit package name at ./creation.pl
> line 17.
> syntax error at ./creation.pl line 17, near "$location
> {"
> syntax error at ./creation.pl line 22, near "}"
> Execution of ./creation.pl aborted due to compilation errors.



John
-- 
use Perl;
program
fulfillment

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




Re: V2 Sandbox Creation Script

2002-01-10 Thread Curtis Poe

Okay, I'll confess.  I stayed up wy too late last night and my Perl skills 
seems inversely
proportional to my energy level.  I wasn't paying attention to the fact that you were 
doing a
foreach on a scalar, which is typically not ver useful.

Here's the code, as I understand your intent, and I'll stop posting about this :)

#!/usr/local/bin/perl -w
use strict;
use File::Path;
use File::Copy;

open (MDATA, "meta-data") or die "Cannot open $!\n";
while () {
chomp;
my ($newLocation, $owner, $permissions) = (split/\t/)[ 3 .. 5 ];
if ( ! -d $newLocation ) {
mkpath($newLocation, $owner, $permissions) or die "Couldn't make the target 
directory:
$!\n";
}
}
close MDATA

Cheers,
Curtis "tired and stupid" Poe

=
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Re: V2 Sandbox Creation Script

2002-01-10 Thread Curtis Poe

--- garrett esperum <[EMAIL PROTECTED]> wrote:
> Thanks! That helped,
> This is what my script looks like now:
> 
> #!/usr/local/bin/perl -w
> 
> use strict;
> use File::Path;
> use File::Copy;
> 
> my $file;
> my $type;
> my $currentLocation;
> my $newLocation;
> my $owner;
> my $permissions;
> open (MDATA, "meta-data") or die "Cannot open $!\n";
> while () {
> chomp;
> ($file, $type, $currentLocation, $newLocation, $owner, $permissions) 
> = split /\t/;
> forech $newLocation
> if ( not -d $newLocation );
> mkpath($newLocation, $owner, $permissions) or die "Couldn't 
> make the target directory: $!\n";
> 
> 
> }
> close MDATA
> 
> And this is the error I get:
> 
> Can't locate object method "forech" via package "www" (perhaps you forgot to 
> load "www"?) at ./creat
> ion.pl line 17,  line 1.

Aack!  I just read the error message and didn't look at the code.  There are a few 
other issues
there.  Here's my guess as to what you were looking for:

#!/usr/local/bin/perl -w
use strict;
use File::Path;
use File::Copy;

open (MDATA, "meta-data") or die "Cannot open $!\n";
while () {
chomp;
my ($newLocation, $owner, $permissions) = (split/\t/)[ 3.. 5];
foreach ( $newLocation ) {
if ( not -d $newLocation ) {
mkpath($newLocation, $owner, $permissions) or die "Couldn't make the 
target
directory: $!\n";
}
}
}
close MDATA

I also wonder if you're misunderstand the use of mkpath().  From 'perldoc File::Path':

File::Path - create or remove directory trees

SYNOPSIS
use File::Path;

mkpath(['/foo/bar/baz', 'blurfl/quux'], 1, 0711);
rmtree(['foo/bar/baz', 'blurfl/quux'], 1, 1);

DESCRIPTION
The "mkpath" function provides a convenient way to create directories,
even if your "mkdir" kernel call won't create more than one level of
directory at a time. "mkpath" takes three arguments:

*   the name of the path to create, or a reference to a list of paths to
create,

*   a boolean value, which if TRUE will cause "mkpath" to print the name
of each directory as it is created (defaults to FALSE), and

*   the numeric mode to use when creating the directories (defaults to
0777)

The second argument is merely a boolean and not the owner.

Also, you have File::Copy in your script, but you don't use it.  Is this something you 
plan to use
later?  If not, having it in your script may confuse someone (namely, me :)

Cheers,
Curtis "Ovid" Poe

=
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Re: regex for shared object files

2002-01-10 Thread Christopher Solomon

On Thu, 10 Jan 2002, Christopher Solomon wrote:

>
> On Thu, 10 Jan 2002, zentara wrote:
>
> > Hi,
> > I'm trying to find all .so.xxx files on my system.
> > Eventually I want to do things with them, but for
> > now I just want to identify them.
> >
> > I pretty much have it, except I'm lacking enough
> > regex knowledge to separate out the  so  from the .so.
> > files.
> >
> > I'm matching
> >
> > cursor
> > moc_sound
> > libqt.so.2
> > libqt-mt.so
> > etc.
> >
> > It's pretty close but not clean enough.
> > Anyone? Thanks.
>
> Assuming you're on a *nix system, you can skip Perl altogether, and use
> the unix command-line tool 'find':
>
>
> [%prompt%] find /usr/lib -type f -print -name '*.so*'

actually, you probably want to put the print after -name '*.so*':

 [%prompt%] find /usr/lib -type f -name '*.so* -print

or omit it the -print altogether (you may not need it).

>
>
> If you want to save the list to file, just redirect the output with the
> greater-than symbol '>' and specify a file name:
>
>
> [%prompt%] find /usr/lib -type f -print -name '*.so*' > some_file.txtB
>

ditto..



Chris


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




Re: V2 Sandbox Creation Script

2002-01-10 Thread Curtis Poe


--- garrett esperum <[EMAIL PROTECTED]> wrote:
> Thanks! That helped,
> This is what my script looks like now:
> 
> #!/usr/local/bin/perl -w
> 
> use strict;
> use File::Path;
> use File::Copy;
> 
> my $file;
> my $type;
> my $currentLocation;
> my $newLocation;
> my $owner;
> my $permissions;
> open (MDATA, "meta-data") or die "Cannot open $!\n";
> while () {
> chomp;
> ($file, $type, $currentLocation, $newLocation, $owner, $permissions) 
> = split /\t/;
> forech $newLocation
> if ( not -d $newLocation );
> mkpath($newLocation, $owner, $permissions) or die "Couldn't 
> make the target directory: $!\n";
> 
> 
> }
> close MDATA
> 
> And this is the error I get:
> 
> Can't locate object method "forech" via package "www" (perhaps you forgot to 
> load "www"?) at ./creat
> ion.pl line 17,  line 1.

It's "foreach", not "forech" :)

Cheers,
Curtis "Ovid" Poe

=
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Re: V2 Sandbox Creation Script

2002-01-10 Thread garrett esperum

Thanks! That helped,
This is what my script looks like now:

#!/usr/local/bin/perl -w

use strict;
use File::Path;
use File::Copy;

my $file;
my $type;
my $currentLocation;
my $newLocation;
my $owner;
my $permissions;
open (MDATA, "meta-data") or die "Cannot open $!\n";
while () {
chomp;
($file, $type, $currentLocation, $newLocation, $owner, $permissions) 
= split /\t/;
forech $newLocation
if ( not -d $newLocation );
mkpath($newLocation, $owner, $permissions) or die "Couldn't 
make the target directory: $!\n";


}
close MDATA

And this is the error I get:

Can't locate object method "forech" via package "www" (perhaps you forgot to 
load "www"?) at ./creat
ion.pl line 17,  line 1.

This is the line creation.pl is reading from the meta-data file:

index.html  html/one/two/three/  www me  0755

What am I doing wrong?

-garrett


>From: Steve Mayer <[EMAIL PROTECTED]>
>To: garrett esperum <[EMAIL PROTECTED]>
>CC: [EMAIL PROTECTED]
>Subject: Re: V2 Sandbox Creation Script
>Date: Thu, 10 Jan 2002 14:49:57 -0800
>
>Garrett,
>
>   Try changing the following line:
>
>   system mkdir $location or die "Couldn't make the target directory: 
>$!\n";
>
>   to:
>
>   mkpath($location,1,0777) or
>die "Couldn't make the target directory: $!\n";
>
>  Good luck,
>
>Steve
>
>On Thu, Jan 10, 2002 at 02:38:50PM -0800, garrett esperum wrote:
> > Hello all,
> >
> > Below is what I have so far for my script, I can get every piece to work
> > correctly on it's own, nut I cannot get these two pieces to work 
>together.
> > I think I am messing up the syntax of this script. What Am I doing 
>wrong??
> > How do I loop in the Directory creation, and file copy procedures??
> >
> >
> > #!/usr/local/bin/perl -w
> >
> > use strict;
> > use File::Path;
> > use File::Copy;
> >
> > my $file;
> > my $type;
> > my $location;
> > my $owner;
> > my $permissions;
> > open (MDATA, "meta-data") or die "Cannot open $!\n";
> > while () {
> >chomp;
> >($file, $type, $location, $owner, $permissions) = split /\t/;
> >forech $location
> >{
> >unless( -d $location )
> >{
> >system mkdir $location or die "Couldn't make the target
> > directory: $!\n";
> >}
> >}
> > }
> > close MDATA
> >
> > Error:
> > 
> > Global symbol "%location" requires explicit package name at 
>./creation.pl
> > line 17.
> > syntax error at ./creation.pl line 17, near "$location
> >{"
> > syntax error at ./creation.pl line 22, near "}"
> > Execution of ./creation.pl aborted due to compilation errors.
> > -
> >
> > Thank You!
> >
> > -garrett
> >
> > _
> > MSN Photos is the easiest way to share and print your photos:
> > http://photos.msn.com/support/worldwide.aspx
> >
> >
> > --
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>=
>Steve MayerOracle Corporation
>Senior Member of Technical Staff   1211 SW 5th Ave.
>Portland Development CenterSuite 900
>[EMAIL PROTECTED]   Portland, OR 97204
>Phone:  503-525-3127
>=
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>




_
Chat with friends online, try MSN Messenger: http://messenger.msn.com


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




Re: regex for shared object files

2002-01-10 Thread Christopher Solomon


On Thu, 10 Jan 2002, zentara wrote:

> Hi,
> I'm trying to find all .so.xxx files on my system.
> Eventually I want to do things with them, but for
> now I just want to identify them.
>
> I pretty much have it, except I'm lacking enough
> regex knowledge to separate out the  so  from the .so.
> files.
>
> I'm matching
>
> cursor
> moc_sound
> libqt.so.2
> libqt-mt.so
> etc.
>
> It's pretty close but not clean enough.
> Anyone? Thanks.

Assuming you're on a *nix system, you can skip Perl altogether, and use
the unix command-line tool 'find':


[%prompt%] find /usr/lib -type f -print -name '*.so*'


If you want to save the list to file, just redirect the output with the
greater-than symbol '>' and specify a file name:


[%prompt%] find /usr/lib -type f -print -name '*.so*' > some_file.txtB


Of course a Perl script will work, and will even be more flexible, but
if that's all you need, the unix tools work great.

Chris


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




Re: regex for shared object files

2002-01-10 Thread Curtis Poe

--- zentara <[EMAIL PROTECTED]> wrote:
> Hi,
> I'm trying to find all .so.xxx files on my system.
> Eventually I want to do things with them, but for
> now I just want to identify them.
> 
> I pretty much have it, except I'm lacking enough
> regex knowledge to separate out the  so  from the .so.
> files.
> 
> I'm matching 
> 
> cursor
> moc_sound
> libqt.so.2
> libqt-mt.so
> etc.
> 
> It's pretty close but not clean enough.
> Anyone? Thanks.
> 
> ##
> #!/usr/bin/perl -w
> use strict;
> use File::Basename;
> use File::Find;
> my $name;
> my $dirname= '/usr/lib';
> 
> find (\&found, $dirname);
> 
> sub found {
> ($name) = basename("$File::Find::name"); 
> if ($name =~ m/.so/){
> print $name,"\n";
> }}
> ##

If I read your question correctly, you wanted to match files with a literal ".so." 
embedded in the
same (i.e., a dot both before and after the 'so'):

#!/usr/bin/perl -w
use strict;
use File::Basename;
use File::Find;
my $dirname= '/usr/lib';
 
find (\&found, $dirname);
 
sub found {
my $name = basename( $File::Find::name ); 
if ($name =~ m/\.so\./){
print "$name\n";
}
}

Note that I also declared $name in found() instead of outside of it.  Once the 
subroutine is
finished, you would only have the last value in $name anyway, so declaring it outside 
of the
function is useless.  On the other hand:

my @names;

sub found {
my $name = basename( $File::Find::name ); 
if ($name =~ m/\.so\./){
push @names, $name;
}
}

I list that in the event you were trying to preserve the filenames for some reason.

Cheers,
Curtis "Ovid" Poe

=
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




RE: regex for shared object files

2002-01-10 Thread Mark Anderson

It's not clear to me if you like matching libqt-mt.so
If you do, then change your regex to:
if ($name =~ m/\.so/) # escape the period makes it match an actual
period
If not, then change it to:
if ($name =~ m/\.so\./) #matches libqt.so.2, but not libqt-mt.so

the . character in your original regex is matching any character before the
so, and you want to match an actual period.

/\/\ark

-Original Message-
From: zentara [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 10, 2002 3:31 PM
To: [EMAIL PROTECTED]
Subject: regex for shared object files


Hi,
I'm trying to find all .so.xxx files on my system.
Eventually I want to do things with them, but for
now I just want to identify them.

I pretty much have it, except I'm lacking enough
regex knowledge to separate out the  so  from the .so.
files.

I'm matching

cursor
moc_sound
libqt.so.2
libqt-mt.so
etc.

It's pretty close but not clean enough.
Anyone? Thanks.

##
#!/usr/bin/perl -w
use strict;
use File::Basename;
use File::Find;
my $name;
my $dirname= '/usr/lib';

find (\&found, $dirname);

sub found {
($name) = basename("$File::Find::name");
if ($name =~ m/.so/){
print $name,"\n";
}}
##



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




regex for shared object files

2002-01-10 Thread zentara

Hi,
I'm trying to find all .so.xxx files on my system.
Eventually I want to do things with them, but for
now I just want to identify them.

I pretty much have it, except I'm lacking enough
regex knowledge to separate out the  so  from the .so.
files.

I'm matching 

cursor
moc_sound
libqt.so.2
libqt-mt.so
etc.

It's pretty close but not clean enough.
Anyone? Thanks.

##
#!/usr/bin/perl -w
use strict;
use File::Basename;
use File::Find;
my $name;
my $dirname= '/usr/lib';

find (\&found, $dirname);

sub found {
($name) = basename("$File::Find::name"); 
if ($name =~ m/.so/){
print $name,"\n";
}}
##



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




Re: interesting JAPH, how does this work?

2002-01-10 Thread Michael R. Wolf

[EMAIL PROTECTED] (Zentara) writes:

> I get it, so "perl" equals 285075 in a base24 number
> system, with the alphabet as it's units.

24?  What's 24?  There are _26_ letters in the alphabet!  Or
was "24" a base _11_ number?  And if so, what extra digit
were you using other than your fingers?  :-)

> For the sake of theoretical babbling, could this base24
> number system be used to perform math operations in perl?
> Carry it to decimal points etc.  Like  perl.sdc ?

For the sake of theoretical responses, here's the
"Programming Perl" explanation:

=> The autoincrement operator has a little extra built-in magic
=> to it. If you increment a variable that is numeric, or that
=> has ever been used in a numeric context, you get a normal
=> increment.  If, however, the variable has only been used in
=> string contexts since it was set, and has a value that is
=> not null and matches the pattern /^[a-zA-Z]*[0-9]*$/, the
=> increment is done as a string, preserving each character
=> within its range, with carry:
=> 
=> print ++($foo = '99');  # prints '100'
=> print ++($foo = 'a0');  # prints 'a1'
=> print ++($foo = 'Az');  # prints 'Ba'
=> print ++($foo = 'zz');  # prints 'aaa'
=> 
=> The autodecrement operator, however, is not magical.

I guess by "within its range" implies 3 (not 2) ranges:
[a-z]
[A-Z]
[0-9]

-- 
Michael R. Wolf
All mammals learn by playing!
[EMAIL PROTECTED]

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




Log Users

2002-01-10 Thread Msftblows

I already have a user registration form set up, but now I want to be able to display 
the last 10 visitors which logged into my site.

The current code I have does the following:

displays the last user to login 
what they did 
what anonymous users are doing using 3 different files


$session_username = user name
$pvaluekw = last key word by logged in user
$pnovaluekw = anonymouse users last key word

Any help would be appreciated

Thanks!



perl.txt
Description: Binary data

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


Re: V2 Sandbox Creation Script

2002-01-10 Thread Steve Mayer

Garrett,

  Try changing the following line:

  system mkdir $location or die "Couldn't make the target directory: $!\n";

  to:

  mkpath($location,1,0777) or 
   die "Couldn't make the target directory: $!\n";

 Good luck,

Steve
  
On Thu, Jan 10, 2002 at 02:38:50PM -0800, garrett esperum wrote:
> Hello all,
> 
> Below is what I have so far for my script, I can get every piece to work 
> correctly on it's own, nut I cannot get these two pieces to work together. 
> I think I am messing up the syntax of this script. What Am I doing wrong?? 
> How do I loop in the Directory creation, and file copy procedures??
> 
> 
> #!/usr/local/bin/perl -w
> 
> use strict;
> use File::Path;
> use File::Copy;
> 
> my $file;
> my $type;
> my $location;
> my $owner;
> my $permissions;
> open (MDATA, "meta-data") or die "Cannot open $!\n";
> while () {
>chomp;
>($file, $type, $location, $owner, $permissions) = split /\t/;
>forech $location
>{
>unless( -d $location )
>{
>system mkdir $location or die "Couldn't make the target 
> directory: $!\n";
>}
>}
> }
> close MDATA
> 
> Error:
> 
> Global symbol "%location" requires explicit package name at ./creation.pl 
> line 17.
> syntax error at ./creation.pl line 17, near "$location
>{"
> syntax error at ./creation.pl line 22, near "}"
> Execution of ./creation.pl aborted due to compilation errors.
> -
> 
> Thank You!
> 
> -garrett
> 
> _
> MSN Photos is the easiest way to share and print your photos: 
> http://photos.msn.com/support/worldwide.aspx
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
=
Steve Mayer Oracle Corporation
Senior Member of Technical Staff1211 SW 5th Ave.
Portland Development Center Suite 900
[EMAIL PROTECTED]Portland, OR 97204 
Phone:  503-525-3127
=

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




V2 Sandbox Creation Script

2002-01-10 Thread garrett esperum

Hello all,

Below is what I have so far for my script, I can get every piece to work 
correctly on it's own, nut I cannot get these two pieces to work together. I 
think I am messing up the syntax of this script. What Am I doing wrong?? How 
do I loop in the Directory creation, and file copy procedures??


#!/usr/local/bin/perl -w

use strict;
use File::Path;
use File::Copy;

my $file;
my $type;
my $location;
my $owner;
my $permissions;
open (MDATA, "meta-data") or die "Cannot open $!\n";
while () {
chomp;
($file, $type, $location, $owner, $permissions) = split /\t/;
forech $location
{
unless( -d $location )
{
system mkdir $location or die "Couldn't make the target 
directory: $!\n";
}
}
}
close MDATA

Error:

Global symbol "%location" requires explicit package name at ./creation.pl 
line 17.
syntax error at ./creation.pl line 17, near "$location
{"
syntax error at ./creation.pl line 22, near "}"
Execution of ./creation.pl aborted due to compilation errors.
-

Thank You!

-garrett

_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




Thanks! Re: Using SMPT on Windows NT

2002-01-10 Thread Rohesia Hamilton Metcalfe

Thanks Pete!

Really nice of you to have searched! Looks like just what I needed.

So that's: many many thanks,

Rohesia Hamilton Metcalfe

--- Pete Emerson <[EMAIL PROTECTED]> wrote:
> Rohesia,
>I'm not a Windows user and I don't play one on TV, but did a
> little bit of Google searching
> http://www.google.com/search?q=perl+mailer+windows
> and came up with this:
> http://www.atexcellence.com/windows-nt-perl-mail-problems.htm#mailmod
> 
> This website goes through examples, using a "Linux Way" as a
> prototype (open MAIL, "|/bin/mail")
> and then doing three examples the Windows NT way using each of the
> different modules.
> 
> In a nutshell, you might look at using one of the following Perl
> Modules:
> 
> Mail::Sender - module for sending
> mail with attachments through an SMTP server - object oriented.
> Mail::Sendmail - Simple platform
> independent mailer, also sends attachments.
> Net::SMTP  - Simple Mail Transfer
> Protocol client from the libnet bundle.
> 
> which can be downloaded and installed from www.cpan.org. Good luck!
> Pete Emerson
> 
> --
> Mynd you, møøse bites Kan be pretty nasti...
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


=
Rohesia Hamilton Metcalfe

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Array output

2002-01-10 Thread Frank Newland

Readers:
I'm running a query on a list (input file)  and capturing the first column
of the results to an array.
When I print the array, the first element is null why is this ??
There are 5 items in my list, 6 rows of output.

My goal is to do more processing on @skulisting (which requires not having a
null entry), not just to print the results.
-
## Begin Code
use strict ; 
use DBI ;
my $item_number ; 
$dbh = DBI -> connect..

while () {
chomp $_ ;
$item_number =$_ ; 

$sql_stmt =<<"EOF+"
select sku_mark, description  from inventory 
where item_number = $item_number
EOF+

$sth = $dbh -> prepare ;
$sth ->execute ;

while (@row = $sth->fetchrow_array ) {  ## Capture the sku mark 
push (@skulisting, $row[0]  
}  

foreach $entry (@skulisting) {  ## Print the sku mark
print $entry . "\n" ;
}

=
Results:
   ## Why is this line of output here??
5134313234
3923392432


TIA
Frank

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




Re: interesting JAPH, how does this work?

2002-01-10 Thread Randal L. Schwartz

> "Zentara" == Zentara  <[EMAIL PROTECTED]> writes:

Zentara> I get it, so "perl" equals 285075 in a base24 number system,
Zentara> with the alphabet as it's units.

There are only 24 letters in your alphabet? :)

-- 
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: Can Perl display .gif files and .wav files

2002-01-10 Thread Hanson, Robert

Yes you can.  You would need to use the Tk module (or some other windowing
system) to build your own GUI.  Tk has support for GIF files, but I can't
say for sure about the others.  For sound there is a module for Windows
called Win32::Sound which can play wav file as far as I know.  You can get
Tk from www.cpan.org (or use CPAN.pm to install them), and there is a great
O'Reilly book on it as well.  If you are on Windows, you can get
Win32::Sound and Tk from www.ActiveState.com/packages/zips (or use ppm to
install them).

"I know that Perl is mainly for text file manipulation"

That and a thousand other things.  In the past I have written windows apps,
XML converters, an AIM bot, CGI apps, Windows DLL's, COM objects, apps to
modify Windows NT permissions, database access, email access (SMTP/POP), IRC
access, make graphs, convert images to SVG, etc, etc.  ...It is hard to
think of something that can't be done in Perl (not that it is always the
best choice, but for me it usually is).

Rob


-Original Message-
From: Joe Slaven [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 10, 2002 3:52 PM
To: [EMAIL PROTECTED]
Subject: Can Perl display .gif files and .wav files


I know that Perl is mainly for text file manipulation
I wish to display a .gif file when a key is pressed, and then run a .wav 
file while it is on display, until such time as the next key is pressed.
Can Perl do this?  

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




RE: interesting JAPH, how does this work?

2002-01-10 Thread Hanson, Robert


Yes, well sort of, it can do whatever you want.  Incrementing letters like
the example is built in, but for what you are talking about you would need
to build that functionality yourself.  You could use the overload pragma
(see perldoc overload) to override the built in operators and write your own
addition and subtraction routines so that $a + $b added letters instead of
number (or both letters and numbers).

Rob

-Original Message-
From: zentara [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 10, 2002 3:51 PM
To: [EMAIL PROTECTED]
Subject: Re: interesting JAPH, how does this work?


On Thu, 10 Jan 2002 12:11:53 -0500, [EMAIL PROTECTED] (Robert Hanson)
wrote:

>You can increment letters just like you increment numbers.
>$x = "a";
>$x++;
>print $x; # prints "b"
>
>And the letter "z" incremented becomes "aa".
>
>$x = "z";
>$x++;
>print $x; # prints "aa"
>
>So here is the script...
>
>$A = "a"; # assign "a" to $A.
>for(0..285074){$A++;} # increment $A 285,074 times
>print"$A\n"; # prints the new value

I get it, so "perl" equals 285075 in a base24 number system,
with the alphabet as it's units.

For the sake of theoretical babbling, could this base24
number system be used to perform math operations in perl?
Carry it to decimal points etc.  Like  perl.sdc ?
 



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

2002-01-10 Thread Casey West

On Thu, Jan 10, 2002 at 04:09:40PM -0500, Chaarani, Sana wrote:
:
:Hi ,
:
:I have the following error when trying to run a PERL script ( that i didn't
:write ) :
:
:
:Can't locate Net/FTP.pm in @INC (@INC contains:
:/opt/perl5/lib/5.6.1/PA-RISC1.1 /opt/perl5/lib/5.6.1
:/opt/perl5/lib/site_perl/5.6.1/PA-RISC1.1 /opt/perl5/lib/site_perl/5.6.1
:/opt/perl5/lib/site_perl .) at ./ftp_kpi line 4.
:BEGIN failed--compilation aborted at ./ftp_kpi line 4.

You need to install the Net::FTP module.  You can do it the long way,
download from the CPAN and then do:

  perl Makefile.PL; make; make test; make install

or the quick way with the following command:

  perl -MCPAN -e'install Net::FTP';


  Casey West

-- 
There is no reason for any individual to have a computer in his home. 
 -- Kenneth H. Olson, President of DEC,
Convention of the World Future Society, 1977

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




FTP

2002-01-10 Thread Chaarani, Sana

Hi ,

I have the following error when trying to run a PERL script ( that i didn't
write ) :


Can't locate Net/FTP.pm in @INC (@INC contains:
/opt/perl5/lib/5.6.1/PA-RISC1.1 /opt/perl5/lib/5.6.1
/opt/perl5/lib/site_perl/5.6.1/PA-RISC1.1 /opt/perl5/lib/site_perl/5.6.1
/opt/perl5/lib/site_perl .) at ./ftp_kpi line 4.
BEGIN failed--compilation aborted at ./ftp_kpi line 4.

The begining of the script is the following :

#!/opt/perl5/bin/perl -w

use Socket;
use Net::FTP;
 

Is there something I didn't install on the system so it can't compile ?

Thanks for your help,

Sana


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




Can Perl display .gif files and .wav files

2002-01-10 Thread Joe Slaven

I know that Perl is mainly for text file manipulation
I wish to display a .gif file when a key is pressed, and then run a .wav 
file while it is on display, until such time as the next key is pressed.
Can Perl do this?  


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




Re: interesting JAPH, how does this work?

2002-01-10 Thread zentara

On Thu, 10 Jan 2002 12:11:53 -0500, [EMAIL PROTECTED] (Robert Hanson) wrote:

>You can increment letters just like you increment numbers.
>$x = "a";
>$x++;
>print $x; # prints "b"
>
>And the letter "z" incremented becomes "aa".
>
>$x = "z";
>$x++;
>print $x; # prints "aa"
>
>So here is the script...
>
>$A = "a"; # assign "a" to $A.
>for(0..285074){$A++;} # increment $A 285,074 times
>print"$A\n"; # prints the new value

I get it, so "perl" equals 285075 in a base24 number system,
with the alphabet as it's units.

For the sake of theoretical babbling, could this base24
number system be used to perform math operations in perl?
Carry it to decimal points etc.  Like  perl.sdc ?
 



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




RE: rand() function

2002-01-10 Thread Wagner-David

What Perl module is needed for plot or is this under the browser or 

Thanks.

Wags ;)

-Original Message-
From: Roger C Haslock [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 10, 2002 11:36
To: Gary Hawkins; [EMAIL PROTECTED]
Subject: Re: rand() function


My apologies: a typo has crept in

For 'plot rand(),read()'
Read 'plot rand(),rand()'

That is, generate x,y randomly in the interval (0,1).

Regards
- Roger -

- Original Message -
From: "Gary Hawkins" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 09, 2002 11:49 PM
Subject: RE: rand() function


> > to take successive pairs, and plot them on a graph. Bad generators would
> > show distinct lines after a while.
> >
> > eg
> >
> > for (0..1) {
> > plot rand(), read()
> > }
> >
>
> What would it require to make that do something?
>
> >ppm search plot
> Packages available from
> http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/PPMServer:
> Chart-Plot  [0.10] Plot two dimensional data in an image. Version 0.10.
> Geo-GNUPlot [0.01] Perl extension for plotting position tracks onto a
world
>
>
> --
> 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: perl/tk Mainwindow

2002-01-10 Thread Curtis Poe

--- Venkatesh Karnam <[EMAIL PROTECTED]> wrote:
> 
> I'm trying to run the following code and open a new window. But the
> program finishes without opening a window. Is there something wrong in
> the code?

You needed to add "MainLoop;" at the bottom:

#!/usr/local/bin/perl5 -w
use Tk;
use strict;

my $main = MainWindow->new();

my $menubar =
$main->Frame(
-relief  => "raised",
-borderwidth => 2
)->pack(
-anchor => "nw",
-fill   => "x"
);

my $file_menu =
$menubar->Menubutton(
-text  => "File",
-underline => 1
)->pack(
-side => "left"
);

$file_menu->command(
-label   => "Print",
-command => \&Print
);

MainLoop;

See "perldoc Tk::Overview".

Cheers,
Curtis "Ovid" Poe

=
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

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




DNS Changes

2002-01-10 Thread Tisdel, Matthew









What is the best approach
for changing DNS on Windows NT machines via a login script? I have been looking
around in the Win32 modules, but I am not sure how to best implement it. I know
that there are difficulties finding the correct registry entry if you go that
direction. Any example scripts out there for this challenge?

 

Matthew J. Tisdel

Service Resources, Inc.

864 272-2777

 







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


perl/tk Mainwindow

2002-01-10 Thread Venkatesh Karnam


I'm trying to run the following code and open a new window. But the
program finishes without opening a window. Is there something wrong in
the code?

#!/usr/local/bin/perl5 -w
use Tk;

$main = MainWindow->new();

$menubar = $main->Frame(-relief => "raised",
-borderwidth => 2)
->pack(-anchor => "nw",
-fill   => "x");

$file_menu = $menubar->Menubutton(-text =>  "File",
  -underline=>  1)
->pack(-side=>  "left");
$file_menu->command(-label  =>  "Print",
-command=>  \&Print);


Thanks,
Venkat



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




Re: rand() function

2002-01-10 Thread Roger C Haslock

My apologies: a typo has crept in

For 'plot rand(),read()'
Read 'plot rand(),rand()'

That is, generate x,y randomly in the interval (0,1).

Regards
- Roger -

- Original Message -
From: "Gary Hawkins" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, January 09, 2002 11:49 PM
Subject: RE: rand() function


> > to take successive pairs, and plot them on a graph. Bad generators would
> > show distinct lines after a while.
> >
> > eg
> >
> > for (0..1) {
> > plot rand(), read()
> > }
> >
>
> What would it require to make that do something?
>
> >ppm search plot
> Packages available from
> http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/PPMServer:
> Chart-Plot  [0.10] Plot two dimensional data in an image. Version 0.10.
> Geo-GNUPlot [0.01] Perl extension for plotting position tracks onto a
world
>
>
> --
> 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: why does open()ing happen only at the line ?

2002-01-10 Thread Michael Fowler

On Thu, Jan 10, 2002 at 06:54:25PM +, Prahlad Vaidyanathan wrote:
> 
> open(FD,"sudo less /var/log/messages |") ;
> print "test\n" ;
> my $line =  ;
> print "$line\n" ;
> print "test #2\n" ;
> 
> 
> $ ./test.pl
> Password:test
> [waits for password here]
> Jan  6 06:51:13 marvin syslogd 1.4-0: restart.
> 
> test #2
> 
> 
> As you can see, it runs 'sudo' _after_ printing "test\n". ie. when it
> reads from the file.

Um, how do you figure?  The sudo program prints out the "Password:" prompt,
and from your output you can clearly see "test" is after "Password:".  So
sudo is being run before "test" is printed.


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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




Re: Using SMPT on Windows NT

2002-01-10 Thread Pete Emerson

Rohesia,
   I'm not a Windows user and I don't play one on TV, but did a little bit of Google 
searching
http://www.google.com/search?q=perl+mailer+windows
and came up with this:
http://www.atexcellence.com/windows-nt-perl-mail-problems.htm#mailmod

This website goes through examples, using a "Linux Way" as a prototype (open MAIL, 
"|/bin/mail")
and then doing three examples the Windows NT way using each of the different modules.

In a nutshell, you might look at using one of the following Perl Modules:

Mail::Sender - module for sending mail with 
attachments through an SMTP server - object oriented.
Mail::Sendmail - Simple platform independent 
mailer, also sends attachments.
Net::SMTP  - Simple Mail Transfer Protocol client 
from the libnet bundle.

which can be downloaded and installed from www.cpan.org. Good luck!
Pete Emerson

--
Mynd you, møøse bites Kan be pretty nasti...


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




RE: Add locations to ppm

2002-01-10 Thread Wagner-David

Within ppm:

 set repository NAME LOCATION
 - Adds a repository to the list of PPD repositories for this
   session.  'NAME' is the name by which this repository will
   be referred; 'LOCATION' is a URL or directory name.

So could do:

set repository ROTH http://www.roth.net/perl/packages/
set save

Wags ;) ps Use help within ppm for different options.

-Original Message-
From: Gary Hawkins [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 10, 2002 10:51
To: [EMAIL PROTECTED]
Subject: Add locations to ppm


Example:  http://www.roth.net/perl/packages/ has some packages.  How can I
permanently add such a location so ppm will include it in searches.

Mainly want to install win32-registry used by GetIP.pl.

/g


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




Using SMPT on Windows NT

2002-01-10 Thread Rohesia Hamilton Metcalfe

Hello,

Thanks to Eric and Christopher, who pointed out the bit of my form-processing script 
that doesn't
carry over to Windows NT (from UNIX, where it is working fine) -- following my post 
yesterday. 

And apologies to all for what I realize was a too-long post.

However, I am still in the dark as to HOW much needs changing.

The reference, which I know is wrong for the NT server the script will be moving to, 
is to a
sendmail program, like so:

$emailProgram   = "| /usr/sbin/sendmail -oi -t";

I tried changing this to:

$emailProgram   = "| /usr/sbin/SMPT -oi -t";

just in case this would do it (as I was told I'd have to "genericize" the script 
to use SMPT),
but it didn't. Christopher tells me NT probably doesn't understand the / / way of 
describing
directory structures either.

Is there somewhere I can go to find out how different a script needs to be for Windows 
NT than for
a UNIX server? Or how to write to use SMPT instead of sendmail? (I don't know anything 
about
different mail systems). I'm hoping it's no more difficult than finding the right path 
to SMPT
(and then everything will work?) but perhaps "genericize" means much more than that?

Many many thanks if anyone can point me in a bit more of the right direction,

Rohesia



=
Rohesia Hamilton Metcalfe

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Add locations to ppm

2002-01-10 Thread Gary Hawkins

Example:  http://www.roth.net/perl/packages/ has some packages.  How can I
permanently add such a location so ppm will include it in searches.

Mainly want to install win32-registry used by GetIP.pl.

/g


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




RE: interesting JAPH, how does this work?

2002-01-10 Thread Stout, Joel R

Readability wasn't a concern with making this obfu.  I did want to show that
it worked with "use strict;" so I put that on a seperate line.  Original
Monks post below.

Joel
Calaban on Monks


#!c:\perl\perl.exe -w
use strict;
my $A="a";for(0..285074){$A++;}print"$A";
 

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 10, 2002 9:47 AM
> To: Hanson, Robert
> Cc: [EMAIL PROTECTED]; 'zentara'
> Subject: RE: interesting JAPH, how does this work?
> 
> 
> 
> Try this:
> 
> #!/opt/local/bin/perl
> #!/usr/bin/perl
> my $A="a";
> for(0..285074){
> $A++;
> print" $A:";
> }
> print"\n\n$A\n";
> 
> --
> This reemphasizes a mail I just read from someone on this
> list about the need to write "clearly readable" codes.
> 
> 
> 
> __
> 
> William Ampeh (x3939)
> Federal Reserve Board
> 
> 
> -- 
> 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: interesting JAPH, how does this work?

2002-01-10 Thread Jon Molin

[EMAIL PROTECTED] wrote:
> 
> Try this:
> 
> #!/opt/local/bin/perl
> #!/usr/bin/perl
> my $A="a";
> for(0..285074){
> $A++;
> print" $A:";

perhaps you should consider NOT printing that 285074 times? would kinda
flood the term :)


> }
> print"\n\n$A\n";
> 
> --
> This reemphasizes a mail I just read from someone on this
> list about the need to write "clearly readable" codes.
> 
> __
> 
> William Ampeh (x3939)
> Federal Reserve Board
> 
> --
> 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: interesting JAPH, how does this work?

2002-01-10 Thread William.Ampeh


Try this:

#!/opt/local/bin/perl
#!/usr/bin/perl
my $A="a";
for(0..285074){
$A++;
print" $A:";
}
print"\n\n$A\n";

--
This reemphasizes a mail I just read from someone on this
list about the need to write "clearly readable" codes.



__

William Ampeh (x3939)
Federal Reserve Board


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




RE: Manageable code

2002-01-10 Thread John Edwards

I prefer to lay out code like this myself.

if ($foo) {
$foo--;
&stuff;
}

if ($bar) {
$baz += $foo
} else {
$baz = $foo < 9 
? 3 
: 1;
}

There is less vertical whitespace (by putting the opening brace on the same
lines as the if/else statements. It is also clearer to see which 'if' the
'else' is refering to by placing it on the same line as the closing brace.
Just my opinion, no doubt there are hundreds more. I agree with the rest of
your mail though. Whitespace in code can greatly improve readability if used
correctly, and consistently throughout your programs. Once you find a
readable coding style, it's good practice to stick to it as it will make
reading and debugging your own code much easier.

http://www.perlmonks.org/index.pl?node=perlman%3Aperlstyle&lastnode_id=148

John

-Original Message-
From: Curtis Poe [mailto:[EMAIL PROTECTED]]
Sent: 10 January 2002 16:45
To: Scott; [EMAIL PROTECTED]
Subject: Re: Manageable code


--- Scott <[EMAIL PROTECTED]> wrote:
> I admit I am a newbie and making this harder than it really is :)  But, I 
> have a program that is growing by the minute and I want to split it apart 
> into chunks or sub routines.
> 
> Here is an example:
> 
> sub init_type_99{
> print NEWQUOTES "99"; #RecordType
> printf NEWQUOTES ("%08d", "1");   #FileBatchTotal
> printf NEWQUOTES ("%08d", $count-1);  #TotalRecords
> printf NEWQUOTES ("%-237s");  #RecordFiller
> print NEWQUOTES "\n";
> }
> 
> Yet when I call the sub doing this:
> 
> init_type_99();
> I do not get the results I was looking for.  Is it a bad idea to do a sub 
> like this and reserve it to only return a value?

Scott,

A subroutine doesn't necessarily need to return a value, but there are a
couple of things you
could do, in my opinion, to improve it.

1.  Fix the indentation.

Good indentation does not mean good code, but bad indentation is usually
indicative of bad code
and it's harder to read.  Consider the difference between these:

if ($foo){$foo--;&stuff;};if($bar){$baz += $foo}
else {$baz = $foo < 9 ? 3 : 1;};

Ugh.  That's pretty confusing.  What is the 'else' associated with?  It's
easy to get this wrong. 
Consider an alternative:

if ($foo)
{
$foo--;
&stuff;
}
if ($bar)
{
$baz += $foo
}
else
{
$baz = $foo < 9 
? 3 
: 1;
}

You might object to all of the whitespace in this version, but it's much
easier to read and to
determine the scope of everything.

2.  Subs should usually be black boxes.  Stuff goes in and stuff goes out.
You should be able to
cut and paste a subroutine directly into another piece of code without any
problems.  This means
that a subroutine should be dependant on its arguments and nothing else.

sub foo
{
my $bar = shift;
if ( $bar > $baz )
{
return;
}
return ++$bar;
}

The above snippet is problematic because it depends upon $baz being declared
outside of itself. 
Two immediate problems crop up.  The first is that changing the name $baz
means you need to track
it down in the subs that use it and change it there, too (part of the goal
of programming should
be to minimize bugs stemming from excessive maintenance).  The other problem
is that this sub is
not general purpose.  What if you want a different test?  You can't.  Here's
a better way:

sub foo
{
my ( $bar, $baz ) = @_;
if ( $bar > $baz )
{
return;
}
return ++$bar;
}

You can now change the variable names to your heart's content and you have a
more general
subroutine!  Good stuff.  Let's apply these thoughts to your code:

   sub init_type_99
   {
   my ( $fh, $count ) = @_;

   my $record = "990001";  # recordtype and
filebatchtotal
   $record   .= sprintf("%08d", $count-1); # total records
   $record   .= ' ' x 237, "\n";   # filler

   print $fh $record;
   }

Now, you might not like exactly how I applied everything above (I'd probably
build the record
differently), but I think it gives you a better idea of what I am referring
to.  Since this looks
like a routine to print the header of a report, I might generalize it more.
Maybe passing in the
record type, file batch total and filler length, for example, to make this
applicable to different
record types.

Incidentally, to pass a filehandle in a variable (as I did in the example),
check out the
FileHandle module or IO::File.

Cheers,
Curtis "Ovid" Poe

=
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do You Yahoo!?
Send your FREE holiday greetings 

Re: Compile .cgi programs

2002-01-10 Thread William.Ampeh


This is the obvious solution, but one may also ask "what is the '.cgi'
written in?"
That is, is a Perl cgi, a Shell script cgi, a C cgi, etc.

If it is a Shell script cgi, a Perl script, then, of course you will need
to make it
executable, you also will want to include

#!{location of shell}

If it is a C/C++ , then you need to compile it.

So Merlyn is right "you need to be more specific".

__

William Ampeh (x3939)
Federal Reserve Board


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




RE: using stat and file::find

2002-01-10 Thread Wagner-David

Believe you could add something like:

map {$_=>1} $DIREC;
my @MyStats = stat($File::Find::name);
print DEST stat("$File::Find::name;" . join(";", @MyStats) . "\n");

Tried it out and it generated data like this:

d:/CurrWrka/00CommonPerl/examples/Extending/Typemaps_with_XS/Car_c++_obj3;0;1689
5;1;0;0;3;0;1010646407;1001340376;984543492;;
d:/CurrWrka/00CommonPerl/examples/Extending/Typemaps_with_XS/Car_c++_obj/Car.pm3
;0;33206;1;0;0;3;141;1008788170;878944074;984543492;;

To do the stat you need the fully qualified.

Wags ;)
-Original Message-
From: Ben Crane [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 10, 2002 07:41
To: [EMAIL PROTECTED]
Subject: using stat and file::find


hey guys, I have this code that prints out the direc
structure/filenames for whatever root i choose...I
would like to have a stat for each file...how do i go
about doing this? I thought about adding it in the
wanted() sub but I've had little success...I want each
file to have all the necessary stat's so my text file
has all the information i need on each file...I plan
on using vb to create a mini dbase to "mess" around
with the webstructure.txt file

#!usr/bin/perl -w
use File::Find;


$DIREC=;
chomp($DIREC);

open(DEST,">WebStructure.txt") || die "$!";
  
find \&wanted, $DIREC;

sub wanted()

{

 map {$_=>1} $DIREC;
 print DEST stat("$File::Find::name\n");
 
}
close(DEST)

Ben

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

-- 
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: interesting JAPH, how does this work?

2002-01-10 Thread Luke Bakken

C:\users>perl -e "$A=qq(a);for(0..285074){$A++}print qq($A\n);"
perl

C:\users>perl -e "$A=qq(a);for(0..28){$A++}print qq($A\n);"
ad

C:\users>perl -e "$A=qq(a);for(0..2){$A++}print qq($A\n);"
d

C:\users>perl -e "$A=qq(a);for(0..1){$A++}print qq($A\n);"
c

C:\users>perl -e "$A=qq(a);for(0){$A++}print qq($A\n);"
b

C:\users>perl -e "$A=qq(a);for(0..10){$A++}print qq($A\n);"
l

C:\users>perl -e "$A=qq(a);for(0..26){$A++}print qq($A\n);"
ab

C:\users>

etc etc etc

:-)
Luke


On Thu, 10 Jan 2002, zentara wrote:

> Hi,
> I saw this on perlmonks.org.
> I can't understand how it works.
> Can anyone enlighten me?
>
> #!/usr/bin/perl
> my $A="a";
> for(0..285074){$A++;}print"$A\n";
>
>
>
> --
> 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: Manageable code

2002-01-10 Thread William.Ampeh


Could you let us know the results you were expecting?

Also, remember that the "printf" statements will be printing
to a file with "NEWQUOTES" as a pointer.
If NEWQUOTES has net been declared, nothing will be printed, and without
"use strict", PERL will complain.

__

William Ampeh (x3939)
Federal Reserve Board


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




RE: interesting JAPH, how does this work?

2002-01-10 Thread Hanson, Robert

You can increment letters just like you increment numbers.

For example:

$x = "a";
$x++;
print $x; # prints "b"

And the letter "z" incremented becomes "aa".

$x = "z";
$x++;
print $x; # prints "aa"

So here is the script...

$A = "a"; # assign "a" to $A.
for(0..285074){$A++;} # increment $A 285,074 times
print"$A\n"; # prints the new value

Rob


-Original Message-
From: zentara [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 10, 2002 12:01 PM
To: [EMAIL PROTECTED]
Subject: interesting JAPH, how does this work?


Hi,
I saw this on perlmonks.org.
I can't understand how it works.
Can anyone enlighten me?

#!/usr/bin/perl

my $A="a";for(0..285074){$A++;}print"$A\n";


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




interesting JAPH, how does this work?

2002-01-10 Thread zentara

Hi,
I saw this on perlmonks.org.
I can't understand how it works.
Can anyone enlighten me?

#!/usr/bin/perl 
my $A="a";  
for(0..285074){$A++;}print"$A\n";   



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




Re: Compile .cgi programs

2002-01-10 Thread Randal L. Schwartz

> "Kondreddy" == Kondreddy Rama Koti Reddy <[EMAIL PROTECTED]> writes:

Kondreddy> Dear Friends, 
Kondreddy> can u tell me, how can i create an executable 
Kondreddy> file for the .cgi program on linux whihc 
Kondreddy> is having perl and javascript statements. 
Kondreddy> 

chmod +x filename 

If that isn't what you mean, please ask again.

-- 
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: Manageable code

2002-01-10 Thread Curtis Poe

--- Scott <[EMAIL PROTECTED]> wrote:
> I admit I am a newbie and making this harder than it really is :)  But, I 
> have a program that is growing by the minute and I want to split it apart 
> into chunks or sub routines.
> 
> Here is an example:
> 
> sub init_type_99{
> print NEWQUOTES "99"; #RecordType
> printf NEWQUOTES ("%08d", "1");   #FileBatchTotal
> printf NEWQUOTES ("%08d", $count-1);  #TotalRecords
> printf NEWQUOTES ("%-237s");  #RecordFiller
> print NEWQUOTES "\n";
> }
> 
> Yet when I call the sub doing this:
> 
> init_type_99();
> I do not get the results I was looking for.  Is it a bad idea to do a sub 
> like this and reserve it to only return a value?

Scott,

A subroutine doesn't necessarily need to return a value, but there are a couple of 
things you
could do, in my opinion, to improve it.

1.  Fix the indentation.

Good indentation does not mean good code, but bad indentation is usually indicative of 
bad code
and it's harder to read.  Consider the difference between these:

if ($foo){$foo--;&stuff;};if($bar){$baz += $foo}
else {$baz = $foo < 9 ? 3 : 1;};

Ugh.  That's pretty confusing.  What is the 'else' associated with?  It's easy to get 
this wrong. 
Consider an alternative:

if ($foo)
{
$foo--;
&stuff;
}
if ($bar)
{
$baz += $foo
}
else
{
$baz = $foo < 9 
? 3 
: 1;
}

You might object to all of the whitespace in this version, but it's much easier to 
read and to
determine the scope of everything.

2.  Subs should usually be black boxes.  Stuff goes in and stuff goes out.   You 
should be able to
cut and paste a subroutine directly into another piece of code without any problems.  
This means
that a subroutine should be dependant on its arguments and nothing else.

sub foo
{
my $bar = shift;
if ( $bar > $baz )
{
return;
}
return ++$bar;
}

The above snippet is problematic because it depends upon $baz being declared outside 
of itself. 
Two immediate problems crop up.  The first is that changing the name $baz means you 
need to track
it down in the subs that use it and change it there, too (part of the goal of 
programming should
be to minimize bugs stemming from excessive maintenance).  The other problem is that 
this sub is
not general purpose.  What if you want a different test?  You can't.  Here's a better 
way:

sub foo
{
my ( $bar, $baz ) = @_;
if ( $bar > $baz )
{
return;
}
return ++$bar;
}

You can now change the variable names to your heart's content and you have a more 
general
subroutine!  Good stuff.  Let's apply these thoughts to your code:

   sub init_type_99
   {
   my ( $fh, $count ) = @_;

   my $record = "990001";  # recordtype and filebatchtotal
   $record   .= sprintf("%08d", $count-1); # total records
   $record   .= ' ' x 237, "\n";   # filler

   print $fh $record;
   }

Now, you might not like exactly how I applied everything above (I'd probably build the 
record
differently), but I think it gives you a better idea of what I am referring to.  Since 
this looks
like a routine to print the header of a report, I might generalize it more.  Maybe 
passing in the
record type, file batch total and filler length, for example, to make this applicable 
to different
record types.

Incidentally, to pass a filehandle in a variable (as I did in the example), check out 
the
FileHandle module or IO::File.

Cheers,
Curtis "Ovid" Poe

=
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

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




Re: Re: Simple regex string replacement problem

2002-01-10 Thread webmaster

Yes, I am in fact changing the template file.  Personally my first experience
with CGI::FastTemplate has made me wish it were a bit more flexible, but
I suppose it's certainly conceivable that the flexibility is there and I
just haven't found it based on what I read in perldoc.

-Ian

-- Original Message --

>On Jan 10, [EMAIL PROTECTED] said:
>
>>>Personally, I find that odd -- moving from an array of 21 elements to
21
>>>DIFFERENT scalars?!
>>
>>You're right, it is odd.  But unless I've missed how to take a populated
>>array and create a usable hash from it to pass to CGI::FastTemplate, this
>>is what I believe I have to do.
>
>Oh, you're changing the template file then?
>
>--
>Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
>RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
>** Look for "Regular Expressions in Perl" published by Manning, in 2002
**
> what does y/// stand for?   why, yansliterate of course.
>
>




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




Re: Re: Simple regex string replacement problem

2002-01-10 Thread Jeff 'japhy' Pinyan

On Jan 10, [EMAIL PROTECTED] said:

>>Personally, I find that odd -- moving from an array of 21 elements to 21
>>DIFFERENT scalars?!
>
>You're right, it is odd.  But unless I've missed how to take a populated
>array and create a usable hash from it to pass to CGI::FastTemplate, this
>is what I believe I have to do.

Oh, you're changing the template file then?

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
 what does y/// stand for?   why, yansliterate of course.


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




RE: Manageable code

2002-01-10 Thread Bob Showalter

> -Original Message-
> From: Scott [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 10, 2002 10:40 AM
> To: [EMAIL PROTECTED]
> Subject: Manageable code
> 
> 
> I admit I am a newbie and making this harder than it really 
> is :)  But, I 
> have a program that is growing by the minute and I want to 
> split it apart 
> into chunks or sub routines.
> 
> Here is an example:
> 
> sub init_type_99{
> print NEWQUOTES "99"; #RecordType
> printf NEWQUOTES ("%08d", "1");   #FileBatchTotal
> printf NEWQUOTES ("%08d", $count-1);  #TotalRecords
> printf NEWQUOTES ("%-237s");  #RecordFiller
> print NEWQUOTES "\n";
> }
> 
> Yet when I call the sub doing this:
> 
> init_type_99();
> I do not get the results I was looking for.  

What exactly is happening? No output? Wrong output? Compile error?

The code on its face looks OK. Are you opening NEWQUOTES before
calling your sub? Do you have 'use strict' enabled? Is $count
a global, or a file-scoped lexical?

> Is it a bad idea 
> to do a sub 
> like this and reserve it to only return a value?

No, not a bad idea. But always 'use strict' and 'use warnings' (or -w)
to catch potential problems.

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




Re: Simple regex string replacement problem

2002-01-10 Thread webmaster

Jeff et al,

>>I have a file which has many strings like "$something[0]" through
>>"something[20]" amongst other text (quotes only provided here for
>>clarity).
>>
>>What I want to do is replace these strings with: "$SOMETHING0" through
>>"$SOMETHING20".
>
>Personally, I find that odd -- moving from an array of 21 elements to 21
>DIFFERENT scalars?!


You're right, it is odd.  But unless I've missed how to take a populated
array and create a usable hash from it to pass to CGI::FastTemplate, this
is what I believe I have to do.


>It should be writing back to file.  If you want to make a backup, give
the
>-i flag an extension:
>
>  perl -p -i.bak -e 's/something\[(\d\d?)\]/SOMETHING$1/g' file

Thanks for this; I was making the mistake of putting a space between the
-i argument and the ".bak" extension.

-Ian




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




RE: Manageable code

2002-01-10 Thread Scott

On Thu, 10 Jan 2002, Bob Showalter wrote:

> > The file handle NEWQUOTES isn't in scope inside the subroutine.
> 
> Huh? How so? Filehandles are global, no? Assuming he's opened
> NEWQUOTES before calling his sub, all should be fine.

I did open NEWQUOTES before the sub.  But after reading the FAQ I should 
be using the FileHandle module.  Coding it now.

-Scott




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




Re: traversing a file tree...one step further (find duplicate files)

2002-01-10 Thread Joshua Nye

Hi list,

I've already emailed Ben but I forgot to email the list also. Below is a
small script for a *nix system to find and pretty print a list of duplicate
files. Maybe that will help someone trying to do the same thing.

--Josh

---cut--- COMMAND LINE ---cut---

find ./perl-5.6.1 -type f -ls | perl dup_find.pl

---cut--- dup_find.pl ---cut---

#!/usr/bin/perl -w
use strict;

my %files;
#
# expects input from a 'find . -type f -ls' command like so:
#
# 23266164 -r--r--r--   1 josh users3619 Jan  9 11:46
../perl-5.6.1/lib/XSLoader.pm
#

while(<>) {
  chomp;
  my $line = $_;
  my @f = split(' ', $line, 11);
  my ($file_name) = $f[10] =~ m/\/([^\/]+)$/;
  my $sig = $file_name . $f[6];
  if(exists $files{$sig}) {
push @{$files{$sig}{'dups'}}, $line;
  } else {
$files{$sig}{'orig'} = $line;
$files{$sig}{'dups'} = [];
  }
}

foreach my $sig (sort keys %files) {
  my $orig = $files{$sig}{'orig'};
  my @dups = @{$files{$sig}{'dups'}};
  foreach ($orig, @dups) {
s/^\s+//;
s/\s+$//;
  }
  if($#dups != -1) {
print "File:  $orig\n";
print "Duplicate: ";
print join("\nDuplicate: ", @dups);
print "\n\n";
  }
}

---cut--- OUTPUT ---cut---

File:  1310726   56 -r--r--r--   1 josh users   49651 Apr  6
2001 ./perl-5.6.1/ext/B/B/C.pm
Duplicate: 3653636   56 -r--r--r--   1 josh users   49651 Apr  6
2001 ./perl-5.6.1/lib/B/C.pm

File:  1310727   60 -r--r--r--   1 josh users   56243 Mar 19
2001 ./perl-5.6.1/ext/B/B/CC.pm
Duplicate: 3653641   60 -r--r--r--   1 josh users   56243 Mar 19
2001 ./perl-5.6.1/lib/B/CC.pm

File:  1310728   28 -r--r--r--   1 josh users   25562 Apr  8
2001 ./perl-5.6.1/ext/B/B/Concise.pm
Duplicate: 3653638   28 -r--r--r--   1 josh users   25562 Apr  8
2001 ./perl-5.6.1/lib/B/Concise.pm



- Original Message -
From: "Ben Crane" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 10, 2002 8:39 AM
Subject: traversing a file tree...one step further


> Hi list,
>
> I have got a program running that opens a text file,
> finds file names within the txt file and then runs a
> file::find to determine the location of these files
> (within the same directory). My next question is: If i
> want to write a list of all the files within more than
> one directory how do I do it.
>
> I have the initial start directory, it locates all the
> files within it and prints them out. but within the
> directory are more subdirectories...what I want is to
> produce a list of every file within the main directory
> and the sub directories.
>
> why? the files in these directories change on a
> constant basis and I want a txt file (updated every
> day) to determine what's there and what isn't...its
> part of our corporate website and simple file
> management is becoming very hard.
>
> I was thinking of using file::depth but am not
> entirely sure if it's the right solution. My next idea
> was to put a list of sub directories in an array and
> then loop through the array opening each respective
> sub direc and printing the files within...at the
> moment my text file returns a set of files within the
> directory and a list of sub directories...if this
> method is simple, how do I dump info into an array for
> later use (the array will have data added to it whilst
> inside a foreach(..) loop...
>
> Any/all help would be appreciated.
>
>
> __
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
>
> --
> 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: Simple regex string replacement problem

2002-01-10 Thread Jeff 'japhy' Pinyan

On Jan 10, [EMAIL PROTECTED] said:

>I have a file which has many strings like "$something[0]" through
>"something[20]" amongst other text (quotes only provided here for
>clarity).
>
>What I want to do is replace these strings with: "$SOMETHING0" through
>"$SOMETHING20".

Personally, I find that odd -- moving from an array of 21 elements to 21
DIFFERENT scalars?!

>perl -p -i -e 's/something\[([0-9][0-9]?)\]/SOMETHING$1/g' file
>
>"file" becomes 0 bytes.  I'm not quite sure why this is happening; is it
>a fault of my regex?  Or - maybe less likely - could it because "file" is
>on a file system Samba mounted from Linux to NT?  I know there is a command
>line option to use a backup file instead of modifying the original, but
>no matter how many times I've seen this, I can't recall it.

It should be writing back to file.  If you want to make a backup, give the
-i flag an extension:

  perl -p -i.bak -e 's/something\[(\d\d?)\]/SOMETHING$1/g' file

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
 what does y/// stand for?   why, yansliterate of course.


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




Re: Date stuff

2002-01-10 Thread Luke Bakken

three days ago =

$threedays = time() - (3 * 24 * 60 * 60);

@date = localtime($threedays);


On Wed, 9 Jan 2002, Jeff 'japhy' Pinyan wrote:

> On Jan 9, Scott Taylor said:
>
> >Can anyone tell me how I can set a variable to a date, then subtract x
> >number of days from it and output the new date?  I can't seem to find it
> >anywhere.


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




Simple regex string replacement problem

2002-01-10 Thread webmaster

Hello All,

I know this is very basic and similar items have come up numerous times
on this list, but I'm not sure where my boneheaded mistake is here.

I have a file which has many strings like "$something[0]" through "something[20]"
amongst other text (quotes only provided here for clarity).

What I want to do is replace these strings with: "$SOMETHING0" through "$SOMETHING20".

When I run:

perl -p -i -e 's/something\[([0-9][0-9]?)\]/SOMETHING$1/g' file

"file" becomes 0 bytes.  I'm not quite sure why this is happening; is it
a fault of my regex?  Or - maybe less likely - could it because "file" is
on a file system Samba mounted from Linux to NT?  I know there is a command
line option to use a backup file instead of modifying the original, but
no matter how many times I've seen this, I can't recall it.

Thanks much,

-Ian






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




RE: Manageable code

2002-01-10 Thread Bob Showalter

> -Original Message-
> From: Joshua Nye [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 10, 2002 10:56 AM
> To: Scott; [EMAIL PROTECTED]
> Subject: Re: Manageable code
> 
> 
> The file handle NEWQUOTES isn't in scope inside the subroutine.

Huh? How so? Filehandles are global, no? Assuming he's opened
NEWQUOTES before calling his sub, all should be fine.

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




Re: Manageable code

2002-01-10 Thread Joshua Nye

The file handle NEWQUOTES isn't in scope inside the subroutine.

Search the perlfaq for 'How can I make a filehandle local to a subroutine?'
e.g. perldoc -q 'filehandle local to a subroutine'


--Josh


- Original Message -
From: "Scott" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 10, 2002 10:39 AM
Subject: Manageable code


> I admit I am a newbie and making this harder than it really is :)  But, I
> have a program that is growing by the minute and I want to split it apart
> into chunks or sub routines.
>
> Here is an example:
>
> sub init_type_99{
> print NEWQUOTES "99"; #RecordType
> printf NEWQUOTES ("%08d", "1"); #FileBatchTotal
> printf NEWQUOTES ("%08d", $count-1); #TotalRecords
> printf NEWQUOTES ("%-237s"); #RecordFiller
> print NEWQUOTES "\n";
> }
>
> Yet when I call the sub doing this:
>
> init_type_99();
> I do not get the results I was looking for.  Is it a bad idea to do a sub
> like this and reserve it to only return a value?
>
> Thanks,
>
> -Scott
>
>
>
> --
> 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]




Manageable code

2002-01-10 Thread Scott

I admit I am a newbie and making this harder than it really is :)  But, I 
have a program that is growing by the minute and I want to split it apart 
into chunks or sub routines.

Here is an example:

sub init_type_99{
print NEWQUOTES "99";   #RecordType
printf NEWQUOTES ("%08d", "1"); #FileBatchTotal
printf NEWQUOTES ("%08d", $count-1);#TotalRecords
printf NEWQUOTES ("%-237s");#RecordFiller
print NEWQUOTES "\n";
}

Yet when I call the sub doing this:

init_type_99();
I do not get the results I was looking for.  Is it a bad idea to do a sub 
like this and reserve it to only return a value?

Thanks,

-Scott



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




Re: Formatting with printf

2002-01-10 Thread Scott

On Wed, 9 Jan 2002, John W. Krahn wrote:
> printf is based on the C language printf function and can be a bit
> tricky.  The format "%-5s" will not truncate a value longer than 5
> characters but it will pad a shorter value with spaces.  To truncate a
> longer value use the format "%-5.5s".  Also, the variable @fields[14] is
> an array slice, you want a scalar $fields[14].
> printf( NEWQUOTES "%-5.5s", $fields[14] );

Thank you John and everyone else.  The .5 worked.

-Scott



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




using stat and file::find

2002-01-10 Thread Ben Crane

hey guys, I have this code that prints out the direc
structure/filenames for whatever root i choose...I
would like to have a stat for each file...how do i go
about doing this? I thought about adding it in the
wanted() sub but I've had little success...I want each
file to have all the necessary stat's so my text file
has all the information i need on each file...I plan
on using vb to create a mini dbase to "mess" around
with the webstructure.txt file

#!usr/bin/perl -w
use File::Find;


$DIREC=;
chomp($DIREC);

open(DEST,">WebStructure.txt") || die "$!";
  
find \&wanted, $DIREC;

sub wanted()

{

 map {$_=>1} $DIREC;
 print DEST stat("$File::Find::name\n");
 
}
close(DEST)

Ben

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Re: IP address from the registry

2002-01-10 Thread Briac Pilpré

Jorge Goncalvez wrote:
> Hi, Is there a way to obtain the IP address from the registry in Both Windows 98 
> and NT with Perl moduls.

Dave Roth's GetIP script should do what you want, hopefully with a
miminmum amount of tweaking:
  http://www.roth.net/perl/scripts/scripts.asp?GetIP.pl

-- 
briac
A pair of thrushes flying 
over the pool. Bankei 
under a maple.

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




RE: Should I use -e -d or opendir ?

2002-01-10 Thread Michael Stidham

The -e isif file exist and the -d is if the directory exist. I would have to 
agree with your third snip of code.

if (-d $path){&get_on_with_it}
else {&errorMsg}




>From: Bob Showalter <[EMAIL PROTECTED]>
>To: "'K.L. Hayes'" <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
>Subject: RE: Should I use -e -d or opendir ?
>Date: Thu, 10 Jan 2002 08:49:17 -0500
>
> > -Original Message-
> > From: K.L. Hayes [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, January 10, 2002 12:28 AM
> > To: [EMAIL PROTECTED]
> > Subject: Should I use -e -d or opendir ?
> >
> >
> > Hello All,
> >
> > I've found lot's of info on how to check if a file exists but nothing
> > about checking if a directory exists. I've posted the relevant code
> > below along with 3 variations of how I "think" it might work. If
> > somebody could point to the one that is "correct" or knows of a better
> > way I'd appreciate the help. Thank you.
> >
> > 
> > use constant USER_PATH => '/home/~client/htdocs/clients/';
> > $path = USER_PATH . $personal_key;
> >
> > ## Is This Correct? ##
> > if (-e "$path") {
> > &get_on_with_it }
> > else { &errorMsg }
> >
> > ## Or This? ##
> > opendir(CLIENT, "$path") or die " &errorMsg ";
> > closedir(CLIENT);
> > &get_on_with_it
> >
> > ## Or Is It This? ##
> > if (-d $path) {
> > &get_on_with_it }
> > else { &errorMsg }
> > 
>
>Probably you just want -d.
>
>-e returns true for plain files, symlinks, sockets, etc. as well as
>for directories, so that's not what you want.
>
>opendir() will fail if you don't have read permission on the directory.
>
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>


_
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


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




Re: If statement

2002-01-10 Thread walter valenti

Ther'isn syntax error.

How failing ??

> I want the following statement to do something if either of this conditions
> exist.  "or" Statement
>
> if ((substr($_, 42, 7) eq "Running") || (substr($Nextline, 42, 7) eq
> "Running"))
>
> It is reading the right substrings but failing.
> What am I doing wrong?
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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




Re: 第一步

2002-01-10 Thread Joshua Nye

You can use ActivePerl from the company ActiveState.

http://www.activestate.com/Products/ActivePerl/

Or you could install Cygwin and have a complete Unix
emulation environment including Perl.

http://sources.redhat.com/cygwin/

--Josh

- Original Message -
From: "yun yun" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 10, 2002 9:17 AM
Subject: µÚÒ»²½


> How can I begin my first step in programming with PERL
> in Windows 2k?
> Is there any integrated including debug tools with it?
>
> Thanks!
>
> _
> Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ! http://mail.yahoo.com.cn
>
> ÎÞÁÄ£¿ÓôÃÆ£¿¸ßÐË£¿Ã»ÀíÓÉ£¿¶¼À´ÁÄÌì°É£¡¡ª¡ª
> ÑÅ»¢È«ÐÂÁÄÌìÊÒ! http://cn.chat.yahoo.com/c/roomlist.html
>
> --
> 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:IP address from the registry

2002-01-10 Thread Jorge Goncalvez

Hi, Is there a way to obtain the IP address from the registry in Both Windows 98 
and NT with Perl moduls.
Thanks.


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




µÚÒ»²½

2002-01-10 Thread yun yun

How can I begin my first step in programming with PERL
in Windows 2k?
Is there any integrated including debug tools with it?

Thanks!

_
Do You Yahoo!? µÇ¼Ãâ·ÑÑÅ»¢µçÓÊ! http://mail.yahoo.com.cn

ÎÞÁÄ£¿ÓôÃÆ£¿¸ßÐË£¿Ã»ÀíÓÉ£¿¶¼À´ÁÄÌì°É£¡¡ª¡ª 
ÑÅ»¢È«ÐÂÁÄÌìÊÒ! http://cn.chat.yahoo.com/c/roomlist.html

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




Re: traversing a file tree...one step further

2002-01-10 Thread Sudarsan Raghavan

The find routine of File::Find traverses a file tree (recurses through the 
subdirectories as well). Try out the following
piece of code
use strict;
use File::Find;
find (sub {print "$File::Find::name\n";}, $yourdirname);

This should print all the files and subdirectories within $yourdirname to the standard 
output.

hth,
Sudarsan


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




RE: why does open()ing happen only at the line ?

2002-01-10 Thread Bob Showalter

> -Original Message-
> From: Prahlad Vaidyanathan [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 10, 2002 12:14 AM
> To: [EMAIL PROTECTED]
> Cc: Michael Fowler
> Subject: Re: why does open()ing happen only at the  line ?
> 
> 
> Hi,
> 
> On Wed, 09 Jan 2002 Michael Fowler spewed into the ether:
> [-- snip --]
> > How did you go about determining this?  As far as I know, 
> this is not the
> 
> I'll explain. This is something I just ran. 
> 
> [ My /var/log/messages is a test file containing 1 line only. ]
> 
> 
> open(FD,"sudo less /var/log/messages |") ;
> print "test\n" ;
> my $line =  ;
> print "$line\n" ;
> print "test #2\n" ;
> 
> 
> $ ./test.pl
> Password:test
> [waits for password here]
> Jan  6 06:51:13 marvin syslogd 1.4-0: restart.
> 
> test #2
> 
> 
> As you can see, it runs 'sudo' _after_ printing "test\n". ie. when it
> reads from the file.

I think you're getting confused about the way pipe open works.

The fact that the "Password:" prompt (which is printed by sudo)
appears before "test" shows you that sudo *is* being run when you
call open() (although the output could have come in either order,
in this case it demonstrates that sudo is running).

The key is that a pipe open(), unlike a call to system() or backticks,
does not wait for the called program to exit.

Here's the sequence of events:

 test.pl  sudo
 ---  
1.   calls open()  --- forks -->  starts
2.   prints "test"prints "Password" to tty
3.   blocks waiting for   calls getpass(), blocks
 sudo to write to FH  waiting for password
4.exec's less
5.less writes to stdout
6.   receives data from
 less on FH

Now the question is, how do you want or expect it to be acting
differently?

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




RE: Should I use -e -d or opendir ?

2002-01-10 Thread Bob Showalter

> -Original Message-
> From: K.L. Hayes [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 10, 2002 12:28 AM
> To: [EMAIL PROTECTED]
> Subject: Should I use -e -d or opendir ?
> 
> 
> Hello All,
> 
> I've found lot's of info on how to check if a file exists but nothing
> about checking if a directory exists. I've posted the relevant code
> below along with 3 variations of how I "think" it might work. If
> somebody could point to the one that is "correct" or knows of a better
> way I'd appreciate the help. Thank you.
> 
> 
> use constant USER_PATH => '/home/~client/htdocs/clients/';
> $path = USER_PATH . $personal_key;
> 
> ## Is This Correct? ##
> if (-e "$path") {
> &get_on_with_it }
> else { &errorMsg }
> 
> ## Or This? ##
> opendir(CLIENT, "$path") or die " &errorMsg ";
> closedir(CLIENT);
> &get_on_with_it
> 
> ## Or Is It This? ##
> if (-d $path) {
> &get_on_with_it }
> else { &errorMsg }
> 

Probably you just want -d.

-e returns true for plain files, symlinks, sockets, etc. as well as
for directories, so that's not what you want.

opendir() will fail if you don't have read permission on the directory.


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




traversing a file tree...one step further

2002-01-10 Thread Ben Crane

Hi list,

I have got a program running that opens a text file,
finds file names within the txt file and then runs a
file::find to determine the location of these files
(within the same directory). My next question is: If i
want to write a list of all the files within more than
one directory how do I do it.

I have the initial start directory, it locates all the
files within it and prints them out. but within the
directory are more subdirectories...what I want is to
produce a list of every file within the main directory
and the sub directories.

why? the files in these directories change on a
constant basis and I want a txt file (updated every
day) to determine what's there and what isn't...its
part of our corporate website and simple file
management is becoming very hard.

I was thinking of using file::depth but am not
entirely sure if it's the right solution. My next idea
was to put a list of sub directories in an array and
then loop through the array opening each respective
sub direc and printing the files within...at the
moment my text file returns a set of files within the
directory and a list of sub directories...if this
method is simple, how do I dump info into an array for
later use (the array will have data added to it whilst
inside a foreach(..) loop...

Any/all help would be appreciated.


__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Re: Regexp and lower case

2002-01-10 Thread Frank

On Thu, Jan 10, 2002 at 10:38:50AM +0100, Jorge wrote:
> Hi, I have this:
> if (/hardware ethernet /) {   
>   $_=(split/\{/)[1];  
>   s/[^\d:A-F]//g; # remove anything not 0..9,A..F 
>   #print "$_\n";
>   
>   }
>   
> It works but I dont want to remove th eletter between a-f if it is in lower 
> case.
> How can I do to have the upper and th elower case.
> Thanks
>   
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
---end quoted text---
how about s/[^\d:A-Fa-f]//g ?
or s/[^\d:a-f]//ig ?

-- 
 Frank Booth - Consultant
Parasol Solutions Limited.
(www.parasolsolutions.com)

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




Re: addr string

2002-01-10 Thread Jenda Krynicky

"Marius Keraitis" <[EMAIL PROTECTED]> wrote:

> Hi 
> I have a question:
> How to send parameters to another .pl file trough links ( tag)?
> I think it's made using ../another.pl?PARAMETER
> But how I get this parameter in another.pl?

Hope I understand you right.

If you have a hash of values you want to append to a URL you can 
do it like this :

use CGI::Enurl; # http://Jenda.Krynicky.cz
$url = "../another.pl?" . enurl(\%hashname);

Eg.

%hashname = ( name => 'Jenda Krynicky', 
mail => '[EMAIL PROTECTED]');
$url = "../another.pl?" . enurl(\%hashname);

returns

../another.pl?[EMAIL PROTECTED]&name=Jenda+Krynicky

If you only want to pass one param you may do this :

$url = "../another.pl?paramname=" . enurl($paramvalue);

You may also use URI::Escape.

Jenda

=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain.
I can't find it.
--- me

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




DBI

2002-01-10 Thread nafiseh saberi

hi dear team.
I found good information about DBI...
and I will be happier that you know that like me...
read this..
http://ironbark.bendigo.latrobe.edu.au/subjects/bitwen/1999/l18/

thx.
_
Sincerely yours Nafiseh Saberi  

The amount of beauty required to 
   launch one ship.

< I appreciate your sugesstions >




Re: Can anyone help me with utime()

2002-01-10 Thread nafiseh saberi

hi.
see it..
http://www.perldoc.com/perl5.6/pod/func/utime.html
_
Sincerely yours Nafiseh Saberi  

The amount of beauty required to 
   launch one ship.

< I appreciate your sugesstions >

- Original Message - 
From: "a p" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 10, 2002 14:47 PM
Subject: Can anyone help me with utime()


> 
> 
> 
> I wanted to know how to use the utime() function on
> windows perl,
> any sample code and a little explanation would be
> very useful,
> thanks,
> aditya
> 
> __
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
> 
> -- 
> 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]




Can anyone help me with utime()

2002-01-10 Thread a p




I wanted to know how to use the utime() function on
windows perl,
any sample code and a little explanation would be
very useful,
thanks,
aditya

__
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

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




Re: addr string

2002-01-10 Thread nafiseh saberi

hi.
you can use template and with follow tag

you can pass parameter to another file or cgi.

I hope it can help you.
 
_
Sincerely yours Nafiseh Saberi  

The amount of beauty required to 
   launch one ship.

< I appreciate your sugesstions >

- Original Message - 
From: "Marius Keraitis" <[EMAIL PROTECTED]>
To: "Begginers Perl" <[EMAIL PROTECTED]>
Sent: Thursday, January 10, 2002 15:27 PM
Subject: addr string


> Hi 
> I have a question:
> How to send parameters to another .pl file trough links ( tag)?
> I think it's made using ../another.pl?PARAMETER
> But how I get this parameter in another.pl?
> 
> Need help on this!!
> 
> ProgLamerSoft Inc.
> Mario.
> 


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




addr string

2002-01-10 Thread Marius Keraitis

Hi 
I have a question:
How to send parameters to another .pl file trough links ( tag)?
I think it's made using ../another.pl?PARAMETER
But how I get this parameter in another.pl?

Need help on this!!

ProgLamerSoft Inc.
Mario.



[PBML] RE: Extract a value of a key into a hash

2002-01-10 Thread Jorge Goncalvez




Hi, I have this code:
#!/usr/local/bin/perl -w

use Win32::Registry;
my %RegType = (
0 => 'REG_0',
1 => 'REG_SZ',
2 => 'REG_EXPAND_SZ',
3 => 'REG_BINARY',
4 => 'REG_DWORD',
5 => 'REG_DWORD_BIG_ENDIAN',
6 => 'REG_LINK',
7 => 'REG_MULTI_SZ',
8 => 'REG_RESOURCE_LIST',
9 => 'REG_FULL_RESOURCE_DESCRIPTION',
10 => 'REG_RESSOURCE_REQUIREMENT_MAP');

my $Register = "Software\\MICROSOFT\\Windows\\CurrentVersion\\explorer\\Shell 
Folders";
my $RegType, $RegValue, $RegKey, $value;
my %values;

$HKEY_LOCAL_MACHINE->Open($Register,$hkey)|| die $!;
#$hkey="Common Desktop";

$hkey->GetValues(\%values);

foreach $value (keys(%values))
{
$RegType= $values{$value}->[1];
$RegValue   = $values{$value}->[2];
$RegKey = $values{$value}->[0];
next if ($RegType eq '');  #do not print default value if not assigned
$RegKey = 'Common Desktop' if ($RegKey eq '');  #name the 
default key
print "$RegKey";
print " ($RegType{$RegType}) : ";

SWITCH:
{
if ($RegType == 4)
{printf "Ox%1x \n", unpack("L",$RegValue); last SWITCH; 
}
if ($RegType == 5)
{printf "Ox%1x", unpack("N",$RegValue); last SWITCH; }
if ($RegType < 8 )
{printf "$RegValue\n"; last SWITCH; }
print "\n";
}
}
$hkey->Close();


What i wanted is to print the value of the hash %values for the name "Common 
Desktop" only;
Now it prints all thereis in th epath 

%values Hash (Name, Type, Value) for each value 

Thanks




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




Re: Compile .cgi programs

2002-01-10 Thread victor

..  this might be what you are looking for.

http://www.indigostar.com/perl2exe.htm#download



kondreddy Rama koti Reddy wrote:

> Dear Friends,
> can u tell me, how can i create an executable
> file for the .cgi program on linux whihc
> is having perl and javascript statements.
>
> Thanking you
>
> K. Rama koti Reddy.
>
>
>
> --
> 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: Compile .cgi programs

2002-01-10 Thread nafiseh saberi

hi.
i wrote some code with c that execute this perl code for me
in form of exe file...
I search it and reply it to you...
I find it in one search ion google.
_
Sincerely yours Nafiseh Saberi  

The amount of beauty required to 
   launch one ship.

< I appreciate your sugesstions >

> > Dear Friends,
> > can u tell me, how can i create an executable
> > file for the .cgi program on linux whihc
> > is having perl and javascript statements.
> > 
> > Thanking you
> > 
> > K. Rama koti Reddy.



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




Re: Compile .cgi programs

2002-01-10 Thread Jon Molin

Take a look at 'perldoc CGI.pm'
Perhaps you should buy a book as well? Or read the online documentation?
I can recomend 'learning perl'.

/Jon

kondreddy Rama koti Reddy wrote:
> 
> Dear Friends,
> can u tell me, how can i create an executable
> file for the .cgi program on linux whihc
> is having perl and javascript statements.
> 
> Thanking you
> 
> K. Rama koti Reddy.
> 
> 
> 
> --
> 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]




Compile .cgi programs

2002-01-10 Thread kondreddy Rama koti Reddy


Dear Friends, 
can u tell me, how can i create an executable 
file for the .cgi program on linux whihc 
is having perl and javascript statements. 


Thanking you 

K. Rama koti Reddy. 


 


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




RE: perl sandbox creation

2002-01-10 Thread John Edwards

So you've not tried to solve this on your own yet? Have you got any sample
code?

I'd suggest taking the first few lines from your file and playing with that
as the data file until you get a working script. Then you only have to
process a few lines to see if your code is working or not. It also makes
reverting the system to it's clean state quicker and easier.

You'll need to look into opening files. The foreach method of looping over
them, the split function, the mkdir function, the -e file test operator.

HTH

John

-Original Message-
From: garrett esperum [mailto:[EMAIL PROTECTED]]
Sent: 10 January 2002 06:53
To: [EMAIL PROTECTED]
Subject: perl sandbox creation


Hello all,

Here is my environment:
solaris 2.6
perl 5.6.1

Here are descriptions of the files I am working with:
1) a meta-data text file
2) a creation.pl file
3) a CVS repository

The meta-data file contains information about multiple CVS repository files.

There are hundreds of rows with six columns each in the meta-data file. Each

file in the repository basically has it's own row of information. The rows 
columns are as follows:
Column 1 = file name
Column 2 = file type
Column 3 = file location
Column 4 = file owner
Column 5 = file permissions
Column 6 = currently unused optional column
These columns are seperated by a single tab.

Example row:
foo.html html /one/two/three/four haxor 0755

I want to execute the creation.pl file to read the meta-data file and create

a "sandbox" from the meta-data information. I need help with the following 
tasks:

1) How do I process each column of every row? How do I grab one row, split 
it up at every tab, and copy the correct file into it's correct directory 
with its correct permissions?

2) How do I create variables for each piece of the split row? Like how do I 
create a variable for the directory path column and then go and create that 
directory path from that variable if it doesn't already exist?

3)How do I grab the files out of CVS and write them to a temp directory?

4)How do I do all of this in a loop for every row of the meta-data file?

I am very appreciative for your help! Thank You!!

-garrett

_
Join the world's largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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




Re:Regexp and lower case

2002-01-10 Thread Jorge Goncalvez

Hi, I have this:
if (/hardware ethernet /) { 
$_=(split/\{/)[1];  
s/[^\d:A-F]//g; # remove anything not 0..9,A..F 
#print "$_\n";

}

It works but I dont want to remove th eletter between a-f if it is in lower 
case.
How can I do to have the upper and th elower case.
Thanks  



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