Re: How to display database records in a web page !!!!

2006-03-06 Thread gustav
>
>
> Hi , I want to display database records as web page my database
> contains some entries and which i wanna write as a report in web
> page.
>
> I have written a code for it which fetches the data from database
> which i wil show u below: my requirement is to align each fields and
> dispaly them as a report .
>
> #!/usr/bin/perl -w
> use DBI;
>
> #use CGI qw(:standard);
> #use CGI::Carp qw(fatalsToBrowser carpout);
> print("Content-type: text/html\n\n");
>
>
> my $dbh = open_dbi();
>
> my $sth2 = $dbh->prepare( q{ SELECT * From longdescs } )
>
> or die "Can't execute statement  $DBI::errstr";
>
> $sth2->execute();
> print "\nContent of Database is \n\n";
>
> print " bug_id\t who\t  bug_when\t work_time\t
> thetext\t isprivate\t already_wrapped\n";
>
>
>my( $bug_id, $who, $bug_when, $work_time, $thetext,
> $isprivate, $already_wrapped );
>$sth2->bind_columns( undef, \$bug_id, \$who,
> \$bug_when, \$work_time, \$thetext, \$isprivate, \$already_wrapped
> );
>
>
> while( $sth2->fetch() )
> {
>
>
> print "$bug_id\t, $who\t, $bug_when\t, $work_time\t $thetext\t
> $isprivate\t $already_wrapped\t \n";
> }
>
> $sth2->finish();
>
>
>
>  print"\n";
>
> $dbh->disconnect;
>
>
> sub open_dbi
> {
># Declare server variables
>my $host = 'localhost';
>my $db = 'xyz';
>my $db_user = 'madhu';
>my $db_password = 'madhan';
>
># Connect to the server
>
>my $dbh_local = DBI->connect("dbi:mysql:$db:$host", "$db_user",
> "$db_password",
>   {RaiseError => 0, PrintError => 0} )
>
>   or err_trap("Cannot connect to the database");
>
> #print "DB Established\n";
>return $dbh_local;
> }
>
>
>
> when i run this script on apache web server it messes up all data and
> displays like this which doesn't give a clear picture of what is
> what.
>
>
> Content of Database is bug_id who bug_when work_time thetext isprivate
> already_wrapped 6 , 4 , 2006-02-23 10:35:09 , 0.00 Test
> ! 0 0 7 , 6 , 2006-02-23 10:52:50 , 0.00 Test for 0 0
> 5 , 4 , 2006-02-21 17:02:13 , 0.00 Hi this is a test !!! 0 0 5
> , 4 , 2006-02-21 17:11:37 , 0.00 (In reply to comment #0) > Hi this is
> a test !!! Ok  Bug fixed 0 0 2 , 1 , 2006-02-07 11:28:57 ,
> 0.00 Hi the scripts are ready. 0 0 8 , 6 , 2006-02-23 11:07:32 , 0.00
> Hi testing the ! 0 0 1 , 5 , 2006-03-02 15:01:59 , 0.00
> The bug has been fixed so changing the status plz Affected files:
> --- 1.2 --> 1.3 1.2,1.3,xyz/readme.txt 0 0 9 , 6 ,
> 2006-03-02 15:21:27 , 0.00 scmbug test is working !!! 0 0 9 , 6 ,
> 2006-03-02 15:22:25 , 0.00
>
> i want the code to display records like a clear report with individual
> fileds having spaces in between them, i hav been fighting with the
> code for longtime .
>
> Can u plz help me out !!
>
> Thanks in advance
>
> Regards
>
> Madhan.
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>
Hi there!

Seems to me it is something do to with the newline \n - statement
Some operatingsystems do need \r\n instead of only \n

Best regards
/Gustav Wiberg



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




Re: Why glob() ?

2005-11-14 Thread Gustav Wiberg
It was just a temporary thing, this with Perl because of a work in school. I 
have no need of programming Perl otherwise, not at the moment anyway.


/G
http://www.varupiraten.se/

- Original Message - 
From: "Guillaume R." <[EMAIL PROTECTED]>

To: <[EMAIL PROTECTED]>
Cc: 
Sent: Monday, November 14, 2005 7:36 AM
Subject: Re: Why glob() ?



Gustav> Hi there!

Lo

Gustav> ps. I don't have the manual or Perl installed on this
computer...

U should install so. Playing with perl without the docs is like playing
football without the ball...
Why don't u install it?




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




Re: Why glob() ?

2005-11-12 Thread Gustav Wiberg


- Original Message - 
From: "Randal L. Schwartz" 

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: 
Sent: Sunday, November 13, 2005 12:10 AM
Subject: Re: Why glob() ?



"Gustav" == Gustav Wiberg <[EMAIL PROTECTED]> writes:


Gustav> Hi there!
Gustav> Thanx!

Gustav> That's all I needed to know! :-)

Gustav> /G
Gustav> ps. I don't have the manual or Perl installed on this computer...

Then why are you asking about Perl?  How do you expect to use it?
Psychic powers?

Also, don't top post.  Trim your replies to the relevant information,
and put your reply on the bottom.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 
0095

 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!



Psychic powers... ;-)

I have wroten som code in school, but I'm not sitting there now. (*hehe* 
that's sure)


I'm all now at this thing globbing... So I hade to ask because I have a task 
that has to be completed on monday... (yes, I could be doing this earlier... 
sue me ;-))


I didn't mean to irritate you all. I'll be more restrictive with my 
questions from now on.


/G


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




Re: Why glob() ?

2005-11-12 Thread Gustav Wiberg

Hi there!

Thanx!

That's all I needed to know! :-)

/G
ps. I don't have the manual or Perl installed on this computer...

- Original Message - 
From: "Randal L. Schwartz" 

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: 
Sent: Saturday, November 12, 2005 11:47 PM
Subject: Re: Why glob() ?



"Gustav" == Gustav Wiberg <[EMAIL PROTECTED]> writes:


Gustav> This seems totally meaningless, but what would $list = 
glob('*.txt') return?


Now is the time I will start to quote the manpage at you:

$ perldoc -tf glob
   glob EXPR
   globIn list context, returns a (possibly empty) list of filename
   expansions on the value of EXPR such as the standard Unix shell
   /bin/csh would do. In scalar context, glob iterates through 
such
   filename expansions, returning undef when the list is 
exhausted.
   This is the internal function implementing the "<*.c>" 
operator,
   but you can use it directly. If EXPR is omitted, $_ is used. 
The

   "<*.c>" operator is discussed in more detail in "I/O Operators"
   in perlop.

   Beginning with v5.6.0, this operator is implemented using the
   standard "File::Glob" extension. See File::Glob for details.

See the sentence "in scalar context"?  What part of that is unclear?

Please learn to read the manual.  If you have *questions* about the
manual, or can't *find* it in the manual, that's fair game for this
list.  But I don't think you will make many friends asking us to quote
the manual for you.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 
0095

 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl 
training!


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






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




Re: Why glob() ?

2005-11-12 Thread Gustav Wiberg

Hi again!

Thanx! :-)
I'm trying to ask as much as possible just to be on the clear with it... :-)

This seems totally meaningless, but what would $list = glob('*.txt') return?

/G
http://www.varupiraten.se/


- Original Message - 
From: "Randal L. Schwartz" 

To: "Gustav Wiberg" <[EMAIL PROTECTED]>
Cc: 
Sent: Saturday, November 12, 2005 11:31 PM
Subject: Re: Why glob() ?



"Gustav" == Gustav Wiberg <[EMAIL PROTECTED]> writes:


Gustav> Hi again!
Gustav> If I understood it right...

Gustav> @list = glob('*.txt');

Gustav> would return all files that ends with *.txt in current directory?

Yes.  What part of "perldoc -f glob" would lead you to a possibly
different conclusion, or is unclear?  I recognize this is a beginners
mailing list, but if you're going to ask us about each and every
paragraph you read...  it'll be a lot of clutter. {grin}

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 
0095

 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl 
training!


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






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




Re: Why glob() ?

2005-11-12 Thread Gustav Wiberg

Hi again!

If I understood it right...

@list = glob('*.txt');

would return all files that ends with *.txt in current directory?

/G
http://www.varupiraten.se/


- Original Message - 
From: "Randal L. Schwartz" 

To: ; "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Saturday, November 12, 2005 11:10 PM
Subject: Re: Why glob() ?



"Gustav" == Gustav Wiberg <[EMAIL PROTECTED]> writes:


Gustav> Why to use glob()-command when I can use exec() ??? I don't get 
it...


In modern Perl, glob() is internal, where exec/system/backquote/pipes
are external, so it's very likely faster to use glob, perhaps ten or
one hundred times faster.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 
0095

 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl 
training!


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






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




Re: Why glob() ?

2005-11-12 Thread Gustav Wiberg

Hi there!

Thanx!!! :-)

/G

- Original Message - 
From: "Randal L. Schwartz" 

To: ; "Gustav Wiberg" <[EMAIL PROTECTED]>
Sent: Saturday, November 12, 2005 11:10 PM
Subject: Re: Why glob() ?



"Gustav" == Gustav Wiberg <[EMAIL PROTECTED]> writes:


Gustav> Why to use glob()-command when I can use exec() ??? I don't get 
it...


In modern Perl, glob() is internal, where exec/system/backquote/pipes
are external, so it's very likely faster to use glob, perhaps ten or
one hundred times faster.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 
0095

 http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl 
training!


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






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




Why glob() ?

2005-11-12 Thread Gustav Wiberg
Hi there!

Why to use glob()-command when I can use exec() ??? I don't get it...

/G
http://www.varupiraten.se/


Globbing?

2005-11-12 Thread Gustav Wiberg
Hi there!

A question about globbing...

What actually happens in the Operatingsystem when a globbing is done?
is ls *.txt

the same as:

ls hello1.txt
ls hello2.txt
ls hello3.txt

(If these file are in the same directory that ls is typed)

I know I can use exec() but I want to know what actually happens

/G
http://www.varupiraten.se/


Re: How to change the Owner of a file

2005-10-31 Thread gustav
> Hi folks
> Can any body tell me how to change the owner of a file ??
>
> I have written this script ...
>
> unless (chown $uid , $gid , $filename)
> {
> die "chown failed :$!";
> }
>
> this code will give me the error you can't change " permission denied "
> can any body tell me , how to over come this error
>
> bye
> rakesh
>
chmod?

http://www-cgi.cs.cmu.edu/afs/cs.cmu.edu/Web/People/rgs/pl-exp-file.html

/G
http://www.varupiraten.se/




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




Re: Die without textoutput?

2005-10-28 Thread gustav
> [EMAIL PROTECTED] wrote:
>> Hi!
>
> Hello,
>
>> When die is used, there is message something like:
>>
>> x doesn't exist as an environment variable
>> Died at lsh.pl line 510,  line 6.
>> Childprocess complete
>>
>> I just want the current process to die without giving any output to
>> screen, something like this:
>>
>> x doesn't exist as an environment variable
>> Childprocess complete
>
> Isn't that output to the screen?  Did you read the documentation for die
> where
> it explains the different forms of output and alternatives to die?
Yes, but I don't want any output to the screen! Is this possible to achieve?

I'd like something like pseduo..
die 

/G



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




Die without textoutput?

2005-10-27 Thread gustav
Hi!

When die is used, there is message something like:

x doesn't exist as an environment variable
Died at lsh.pl line 510,  line 6.
Childprocess complete

I just want the current process to die without giving any output to
screen, something like this:

x doesn't exist as an environment variable
Childprocess complete

Is there any substitue for the die-command to achieve this?

/G
@varupiraten.se



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




Perl - Add env,.variable?

2005-10-27 Thread gustav
Hi there!

I want to add an environment variable in Perl. Is there any built-in
function for achieving this?

/G
@varupiraten.se


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




Re: Re: ENV(Y)?

2005-10-14 Thread Gustav Wiberg

Hi!

I got your mail from the Perl-malinglist. You have to unscribe from that 
list manually yourself.


Best regards
/G
http://www.varupiraten.se/

- Original Message - 
From: "Thomas J Hughes" <[EMAIL PROTECTED]>

To: <[EMAIL PROTECTED]>
Sent: Friday, October 14, 2005 6:19 PM
Subject: Re: Re: ENV(Y)?


Please remove my email address from your list, thanks

Tom


On 10/14/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Hi again!

I've been looking around...

And one thing I don't get. You tell me that > SOMEVAR will be available to
you in your program and any programs you spawn( with 'system' or
backtics). But after your perl script ends, SOMEVAR is lost) and this
seems to be correct when I test my program, but I get confused when I read
about it on the net...
http://www.devdaily.com/perl/edu/articles/pl020002/pl020002.shtml
http://www.linux.com/howtos/Path-3.shtml

If I like to set an environmentvariable permanently from my program?
Isn't that possible in Perl?


/G
http://www.varupiraten.se/


> Hi gustav -
>
> At 2005-10-13, 23:42:22 you wrote:
>>Hi!
>>
>>Just a quick question. Can I set or unset an enviromentvariable through
>>this Hash? I just need a yes ... :-)
>>If No, please give explanation...
>
> Not really.
>
> If you do something like:
>
> $ENV{SOMEVAR} = 'somevalue';
>
> SOMEVAR will be available to you in your program and any programs you
> spawn
> ( with 'system' or backtics). But after your perl script ends, SOMEVAR 
> is

> lost. This is
> because the system provides you with a new shell - with the envirnoment
> inherited
> from the caller - for the duration of the script; the evironment and its
> modifications are
> lost when the script ends.
>
> On 'nix, you can play with the 'source' operator: '.', which instructs 
> the

> shell to run the
> command following the '.' operator in the same shell (I'm talking bash -
> not sure about
> other shells).
>>
>>/G
>>http://www.varupiraten.se/
>>
>>
>>
>>> Hi!
>>>
>>> Thanx a LOT!!!
>>>
>>> /G
>>> http://www.varupiraten.se/
>>>
>>>
>>>> Hi Gustav -
>>>>
>>>> At 2005-10-13, 23:13:33 you wrote:
>>>>>Hi there!
>>>>>
>>>>>I'd like to get a list of enviromentvariables from the *NIX-system.
>>>>>
>>>>>I'd like it in the format...
>>>>>ENV1=x1
>>>>>ENv2=x2
>>>>>ENV3=x3
>>>>>
>>>>>and so on...
>>>>>
>>>>>I think I have to use ENV-command. (http://perldoc.perl.org/Env.html)
>>>>> Is
>>>>>that right? I don't understand how I get this kind of listing. Please
>>>>> put
>>>>>me in right direction..
>>>>>
>>>>>
>>>>>I tried to use print ENV% but I get this kind of output:
>>>>>HOSTfriggAUDIODEV/tmp/SUNWut/dev/utaudio/8dtstart_sessionlogfile/dev/nullDTSCREENSAVERLISTStartDtscreenBlankXMBINDDIR/usr/dt/lib/bindingsUTAUDIODEV/tmp/SUNWut/dev/utaudio/8AB_CARDCATALOG/usr/dt/share/answerbooks/C/ab_cardcatalogLC_ALLCDTLOGINDISPLAYCLASSSunRayOSTY
>>>>>
>>>>>I envy you how can solve this... :-)
>>>>>
>>>>
>>>> You're almost there. %ENV is a hash, do you can do something like
>>>> this:
>>>>
>>>> print "$_=$ENV{$_}\n" for sort keys %ENV;
>>>>
>>>> Or, with more keystrokes:
>>>>
>>>> for my $var( sort keys %ENV ) {
>>>>   print "$var=$ENV{$var}\n";
>>>> }
>>>>
>>>> Read up on hashes && good luck.
>>>>>/G
>>>>
>>>> Aloha => Beau;
>>>> [EMAIL PROTECTED]
>>>> 2005-10-13
>>>>
>>>>
>>>>
>>>> --
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>>--
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>><http://learn.perl.org/> <http://learn.perl.org/first-response>
>>
>>
>>
>>
>>--
>>No virus found in this incoming message.
>>Checked by AVG Anti-Virus.
>>Version: 7.0.344 / Virus Database: 267.12.0/132 - Release Date:
>> 10/13/2005
>>
>
>
>
> Aloha => Beau;
> [EMAIL PROTECTED]
> 2005-10-13
>
>
>



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






--
Thomas J. Hughes, DoD (CIV)
Information Computer Telecommunciations Specialist Level - 6
Naval Surface Warfare Center
Joint Interoperability Test Center (JITC)
COMM: (301) 274-0160
CELL: (240) 210-0277


--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.12.0/132 - Release Date: 2005-10-13



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




Re: Re: Re: ENV(Y)?

2005-10-14 Thread gustav
AHA!! Ok, thanx! Now I understand it better... :-)

/G
http://www.varupiraten.se/


> Hi Custav -
>
> At 2005-10-14, 02:23:59 you wrote:
>>Hi again!
>>
>>I've been looking around...
>>
>>And one thing I don't get. You tell me that > SOMEVAR will be available
>> to
>>you in your program and any programs you spawn( with 'system' or
>>backtics). But after your perl script ends, SOMEVAR is lost) and this
>>seems to be correct when I test my program, but I get confused when I
>> read
>>about it on the net...
>>http://www.devdaily.com/perl/edu/articles/pl020002/pl020002.shtml
>>http://www.linux.com/howtos/Path-3.shtml
>>
>>If I like to set an environmentvariable permanently from my program?
>>Isn't that possible in Perl?
>
> As far as I know, No.
> It's the way shells work...sorry.
> Someone please correct me if I am wrong.
>
>>
>>
>>/G
>>http://www.varupiraten.se/
>>
>>
> [snipped]
>
> Aloha => Beau;
> [EMAIL PROTECTED]
> 2005-10-14
>
>
>
> --
> 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: Re: ENV(Y)?

2005-10-14 Thread gustav
Hi again!

I've been looking around...

And one thing I don't get. You tell me that > SOMEVAR will be available to
you in your program and any programs you spawn( with 'system' or
backtics). But after your perl script ends, SOMEVAR is lost) and this
seems to be correct when I test my program, but I get confused when I read
about it on the net...
http://www.devdaily.com/perl/edu/articles/pl020002/pl020002.shtml
http://www.linux.com/howtos/Path-3.shtml

If I like to set an environmentvariable permanently from my program?
Isn't that possible in Perl?


/G
http://www.varupiraten.se/


> Hi gustav -
>
> At 2005-10-13, 23:42:22 you wrote:
>>Hi!
>>
>>Just a quick question. Can I set or unset an enviromentvariable through
>>this Hash? I just need a yes ... :-)
>>If No, please give explanation...
>
> Not really.
>
> If you do something like:
>
> $ENV{SOMEVAR} = 'somevalue';
>
> SOMEVAR will be available to you in your program and any programs you
> spawn
> ( with 'system' or backtics). But after your perl script ends, SOMEVAR is
> lost. This is
> because the system provides you with a new shell - with the envirnoment
> inherited
> from the caller - for the duration of the script; the evironment and its
> modifications are
> lost when the script ends.
>
> On 'nix, you can play with the 'source' operator: '.', which instructs the
> shell to run the
> command following the '.' operator in the same shell (I'm talking bash -
> not sure about
> other shells).
>>
>>/G
>>http://www.varupiraten.se/
>>
>>
>>
>>> Hi!
>>>
>>> Thanx a LOT!!!
>>>
>>> /G
>>> http://www.varupiraten.se/
>>>
>>>
>>>> Hi Gustav -
>>>>
>>>> At 2005-10-13, 23:13:33 you wrote:
>>>>>Hi there!
>>>>>
>>>>>I'd like to get a list of enviromentvariables from the *NIX-system.
>>>>>
>>>>>I'd like it in the format...
>>>>>ENV1=x1
>>>>>ENv2=x2
>>>>>ENV3=x3
>>>>>
>>>>>and so on...
>>>>>
>>>>>I think I have to use ENV-command. (http://perldoc.perl.org/Env.html)
>>>>> Is
>>>>>that right? I don't understand how I get this kind of listing. Please
>>>>> put
>>>>>me in right direction..
>>>>>
>>>>>
>>>>>I tried to use print ENV% but I get this kind of output:
>>>>>HOSTfriggAUDIODEV/tmp/SUNWut/dev/utaudio/8dtstart_sessionlogfile/dev/nullDTSCREENSAVERLISTStartDtscreenBlankXMBINDDIR/usr/dt/lib/bindingsUTAUDIODEV/tmp/SUNWut/dev/utaudio/8AB_CARDCATALOG/usr/dt/share/answerbooks/C/ab_cardcatalogLC_ALLCDTLOGINDISPLAYCLASSSunRayOSTY
>>>>>
>>>>>I envy you how can solve this... :-)
>>>>>
>>>>
>>>> You're almost there. %ENV is a hash, do you can do something like
>>>> this:
>>>>
>>>> print "$_=$ENV{$_}\n" for sort keys %ENV;
>>>>
>>>> Or, with more keystrokes:
>>>>
>>>> for my $var( sort keys %ENV ) {
>>>>   print "$var=$ENV{$var}\n";
>>>> }
>>>>
>>>> Read up on hashes && good luck.
>>>>>/G
>>>>
>>>> Aloha => Beau;
>>>> [EMAIL PROTECTED]
>>>> 2005-10-13
>>>>
>>>>
>>>>
>>>> --
>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>>--
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>><http://learn.perl.org/> <http://learn.perl.org/first-response>
>>
>>
>>
>>
>>--
>>No virus found in this incoming message.
>>Checked by AVG Anti-Virus.
>>Version: 7.0.344 / Virus Database: 267.12.0/132 - Release Date:
>> 10/13/2005
>>
>
>
>
> Aloha => Beau;
> [EMAIL PROTECTED]
> 2005-10-13
>
>
>



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




Re: ENV(Y)?

2005-10-14 Thread gustav
Hi!

Just a quick question. Can I set or unset an enviromentvariable through
this Hash? I just need a yes ... :-)
If No, please give explanation...

/G
http://www.varupiraten.se/



> Hi!
>
> Thanx a LOT!!!
>
> /G
> http://www.varupiraten.se/
>
>
>> Hi Gustav -
>>
>> At 2005-10-13, 23:13:33 you wrote:
>>>Hi there!
>>>
>>>I'd like to get a list of enviromentvariables from the *NIX-system.
>>>
>>>I'd like it in the format...
>>>ENV1=x1
>>>ENv2=x2
>>>ENV3=x3
>>>
>>>and so on...
>>>
>>>I think I have to use ENV-command. (http://perldoc.perl.org/Env.html)
>>> Is
>>>that right? I don't understand how I get this kind of listing. Please
>>> put
>>>me in right direction..
>>>
>>>
>>>I tried to use print ENV% but I get this kind of output:
>>>HOSTfriggAUDIODEV/tmp/SUNWut/dev/utaudio/8dtstart_sessionlogfile/dev/nullDTSCREENSAVERLISTStartDtscreenBlankXMBINDDIR/usr/dt/lib/bindingsUTAUDIODEV/tmp/SUNWut/dev/utaudio/8AB_CARDCATALOG/usr/dt/share/answerbooks/C/ab_cardcatalogLC_ALLCDTLOGINDISPLAYCLASSSunRayOSTY
>>>
>>>I envy you how can solve this... :-)
>>>
>>
>> You're almost there. %ENV is a hash, do you can do something like this:
>>
>> print "$_=$ENV{$_}\n" for sort keys %ENV;
>>
>> Or, with more keystrokes:
>>
>> for my $var( sort keys %ENV ) {
>>   print "$var=$ENV{$var}\n";
>> }
>>
>> Read up on hashes && good luck.
>>>/G
>>
>> Aloha => Beau;
>> [EMAIL PROTECTED]
>> 2005-10-13
>>
>>
>>
>> --
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>>
>>
>>
>
>
>



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




Re: ENV(Y)?

2005-10-14 Thread gustav
Hi!

Thanx a LOT!!!

/G
http://www.varupiraten.se/


> Hi Gustav -
>
> At 2005-10-13, 23:13:33 you wrote:
>>Hi there!
>>
>>I'd like to get a list of enviromentvariables from the *NIX-system.
>>
>>I'd like it in the format...
>>ENV1=x1
>>ENv2=x2
>>ENV3=x3
>>
>>and so on...
>>
>>I think I have to use ENV-command. (http://perldoc.perl.org/Env.html)  Is
>>that right? I don't understand how I get this kind of listing. Please put
>>me in right direction..
>>
>>
>>I tried to use print ENV% but I get this kind of output:
>>HOSTfriggAUDIODEV/tmp/SUNWut/dev/utaudio/8dtstart_sessionlogfile/dev/nullDTSCREENSAVERLISTStartDtscreenBlankXMBINDDIR/usr/dt/lib/bindingsUTAUDIODEV/tmp/SUNWut/dev/utaudio/8AB_CARDCATALOG/usr/dt/share/answerbooks/C/ab_cardcatalogLC_ALLCDTLOGINDISPLAYCLASSSunRayOSTY
>>
>>I envy you how can solve this... :-)
>>
>
> You're almost there. %ENV is a hash, do you can do something like this:
>
> print "$_=$ENV{$_}\n" for sort keys %ENV;
>
> Or, with more keystrokes:
>
> for my $var( sort keys %ENV ) {
>   print "$var=$ENV{$var}\n";
> }
>
> Read up on hashes && good luck.
>>/G
>
> Aloha => Beau;
> [EMAIL PROTECTED]
> 2005-10-13
>
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>



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




ENV(Y)?

2005-10-14 Thread gustav
Hi there!

I'd like to get a list of enviromentvariables from the *NIX-system.

I'd like it in the format...
ENV1=x1
ENv2=x2
ENV3=x3

and so on...

I think I have to use ENV-command. (http://perldoc.perl.org/Env.html)  Is
that right? I don't understand how I get this kind of listing. Please put
me in right direction..


I tried to use print ENV% but I get this kind of output:
HOSTfriggAUDIODEV/tmp/SUNWut/dev/utaudio/8dtstart_sessionlogfile/dev/nullDTSCREENSAVERLISTStartDtscreenBlankXMBINDDIR/usr/dt/lib/bindingsUTAUDIODEV/tmp/SUNWut/dev/utaudio/8AB_CARDCATALOG/usr/dt/share/answerbooks/C/ab_cardcatalogLC_ALLCDTLOGINDISPLAYCLASSSunRayOSTY

I envy you how can solve this... :-)

/G
http://www.varupiraten.se/







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




Re: Kill child process?

2005-10-10 Thread Gustav Wiberg

Hi there!

Thanx!

/G

- Original Message - 
From: "zentara" <[EMAIL PROTECTED]>

To: 
Sent: Monday, October 10, 2005 10:25 AM
Subject: Re: Kill child process?



On Sun, 9 Oct 2005 15:53:19 +0200, [EMAIL PROTECTED] (Gustav Wiberg)
wrote:


Hi there!

#Signal-handling for Ctrl-C
   #
   $SIG{INT} = \&whenbreak;

#This triggers when CTRl-C.
#
 sub whenbreak {

  $SIG{INT} = \&whenbreak;
  warn "\n\nChildprocess killed.\n\n";
}

How can I do that a background-process would not stop? (say that I only
want to break current child process, not the parent process also?)


You need to get the pid of the child process, then use kill on it.

Quite often, you need to use Proc::Killfam to kill the process, because
depending on how you create the child process, you may be getting
the pid of the controlling parent shell, not the child itself.

See "perldoc kill" and "perldoc Proc::Killfam"




--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html

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




--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.13/126 - Release Date: 
2005-10-09






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




Kill child process?

2005-10-09 Thread Gustav Wiberg

Hi there!

#Signal-handling for Ctrl-C
   #
   $SIG{INT} = \&whenbreak;

#This triggers when CTRl-C.
#
 sub whenbreak {

  $SIG{INT} = \&whenbreak;
  warn "\n\nChildprocess killed.\n\n";
}

How can I do that a background-process would not stop? (say that I only
want to break current child process, not the parent process also?)

/G

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




Re: Finding directories within a tree

2005-10-07 Thread Gustav Wiberg

Hi there!

Isn't it possible to use dir - command? (dos-command) which is similar to ls

/G
- Original Message - 
From: <[EMAIL PROTECTED]>

To: 
Sent: Friday, October 07, 2005 7:17 PM
Subject: Finding directories within a tree



Good Afternoon

I am attempting to develop a script that will parse a directory listing 
and return only directory names that match a given expression.


It would make sense to me to use File::Find to do this but based on the 
dir structure I am parsing, the amount of overhead to do this is enourmous 
!


Basically, I have a file structure similar to:

Dir1\Dir2\Support\119404\dirx\diry
Dir1\Dir3\Support\119893\dirx
Dir1\Dir4\Support\14\dirx\diry\dirz
.
Dir1\Dir1000\Support\100858

I am simply interested in finding the directories directley under the 
Support dir (ex.119404 from the 1st example) . There is no consistancy to 
the naming convention other then Dir1 and Support. Dir2 can be many 
different values.


I tried functionality similar to the following that did work on a much 
smaller test bed:


my $dirs="I:\\ID_00_000999";
find sub { push @dirs, $File::Find::dir if $File::Find::dir =~ 
m/.+[Ss]upport\/\d+$/;}, $dirs;


But in a larger scale dir structure. The performance of this was horrible 
!! (Since it is looking through the entire structure including dirs under 
the directory I am trying to match on).


As you can see form the I:\\ this is on windows, so ls and similar UNIX 
commands are not available.


Any thoughts on how I can accomplish this task with the lowest amount of 
overhead?


Thanks!
Jason

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




--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.13/123 - Release Date: 
2005-10-06






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




Re: for each

2005-10-07 Thread gustav
Hi there!

Yes, exactly. Thanx a lot! :-)

/G

>
>
> - Original Message -
> From: [EMAIL PROTECTED]
> Date: Friday, October 7, 2005 3:29 pm
> Subject: for each
>
>> Hi there!
>>
> Hi!
>
>> How do I get a for each-statement to start at element 1 (second
>> element)
>
> $ perl -e '
> @arr = qw (a b c);
>  foreach(1 .. $#arr)
> {
>   print "$arr[$_]\n";
> }'
>
> prints:
> b
> c
>
> Is that what you want?
>
>
> --
> Regards,
> Edward WIJAYA
> SINGAPORE
>
>



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




for each

2005-10-07 Thread gustav
Hi there!

How do I get a for each-statement to start at element 1 (second element)

/G


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




Split with backslashes?

2005-10-05 Thread gustav
Hi there!

I would like to split up a string like this

my $cd = $arguments;
@dirs = split(///,$cd); #Split $cd when there occurs a backslash

but it doesn't seem to work. I guess /// must be rewritten in some way,
but how?

/G



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




Re: Current directory?

2005-09-29 Thread Gustav Wiberg

Hi there!

Thanx! I'll try that! :-)

/G

- Original Message - 
From: "Jeff Peng" <[EMAIL PROTECTED]>

To: <[EMAIL PROTECTED]>
Cc: 
Sent: Thursday, September 29, 2005 10:27 AM
Subject: Re: Current directory?


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

print getcwd,"\n"; #get the current path
print $ENV{PATH};  #get the path from environment variable

2005/9/29, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:

Hi there!

I want to get the current environment variable (current directory), and I
type like this:

$currentpath = %ENV;

and I get something like 37/64
instead of maybe usr/username/test

How do I get current directory?

/G




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






--
 Jeff Peng
 [EMAIL PROTECTED]

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




--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.8/114 - Release Date: 2005-09-28



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




Current directory?

2005-09-29 Thread gustav
Hi there!

I want to get the current environment variable (current directory), and I
type like this:

$currentpath = %ENV;

and I get something like 37/64
instead of maybe usr/username/test

How do I get current directory?

/G




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




File Existance

2005-09-28 Thread gustav
Hi there!

I have a lot of experience in programming, but WHAT command do I use for
checking if a file exists... Have searched google, but can't seem to find
any good answers...

/G
http://www.varupiraten.se/



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