hash question

2005-09-06 Thread Gergely Buday
Hi there, 

do you have a clue why is this not working? The interpreter complains
about a syntax error in line 7 near $myhash.

#!/usr/bin/perl

%myhash = { "alma" => "apple", "korte" => "pear" };

foreach $ky (keys (%myhash))
{
print $ky, ":" , $myhash($ky), "\n";
}

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




Re: hash question

2005-09-06 Thread Shobha Deepthi

Its should be ,

print $ky, ":" , $myhash{$ky}, "\n";

Shobha Deepthi V
The statement below is true.
The statement above is false.






Gergely Buday wrote:

Hi there, 


do you have a clue why is this not working? The interpreter complains
about a syntax error in line 7 near $myhash.

#!/usr/bin/perl

%myhash = { "alma" => "apple", "korte" => "pear" };

foreach $ky (keys (%myhash))
{
   print $ky, ":" , $myhash($ky), "\n";
}

 



Re: hash question

2005-09-06 Thread Ankur Gupta

On 9/6/2005 4:50 PM Gergely Buday wrote:

Hi there, 


do you have a clue why is this not working? The interpreter complains
about a syntax error in line 7 near $myhash.


Seems like you are confused with the brackets...


#!/usr/bin/perl

%myhash = { "alma" => "apple", "korte" => "pear" };


Should be

%myhash = ( "alma" => "apple", "korte" => "pear" );


foreach $ky (keys (%myhash))


No need for any brackets around the hash

foreach $ky (keys %myhash)


{
print $ky, ":" , $myhash($ky), "\n";


Should be

  print $ky, ":" , $myhash{$ky}, "\n";


}


HTH...

--
Ankur

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




naming subroutine reference parameter?

2005-09-06 Thread Jayvee Vibar
How do you name subroutine reference parameter in perl?
Naming a local or pass by value is by simply using my ($param1, $param2) =
@_ ;
How about by reference? I think it would be harder if I'll be using $_[0],
$_[1] direct method.
Is it possible?

Thanks.



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




RE: Unable to use XML module

2005-09-06 Thread Cristi Ocolisan
Try install XML-Simple

Co

-Original Message-
From: Nath, Alok (STSD) [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 05, 2005 10:14 AM
To: Charles K. Clarkson; Xavier Noria
Cc: Perl Beginners List
Subject: RE: Unable to use XML module

When I say ppm>install XML::Simple 
It gives this error 
..
Error: No valid repositories:
Error: 500 Can't connect to ppm.ActiveState.com:80 (connect: Unknown
error)
Error: 500 Can't connect to ppm.ActiveState.com:80 (connect: Unknown
error)



-Original Message-
From: Charles K. Clarkson [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 05, 2005 12:38 PM
To: 'Perl Beginners List'
Subject: RE: Unable to use XML module

Nath, Alok (STSD)  wrote:

:   Error :
:   Can't locate XML/Simple.pm in @INC (@INC contains:
: C:/PROGRA~1/MKSTOO~1/etc/perl
:   /lib C:/PROGRA~1/MKSTOO~1/etc/perl/lib
: C:/PROGRA~1/MKSTOO~1/etc/perl/lib/site_pe
:   rl .) at XMLRead.pl line 3.
:   BEGIN failed--compilation aborted at XMLRead.pl line 3.
: 
:   Pls suggest me how to get rid of this ?


Did you install XML::Simple on your system?

HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328


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




-- 
This message was scanned for spam and viruses by BitDefender.
For more information please visit http://linux.bitdefender.com/



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




Re: naming subroutine reference parameter?

2005-09-06 Thread Jeff Pan

On Tue, 6 Sep 2005 16:12:35 +0800, "Jayvee Vibar" <[EMAIL PROTECTED]>
said:
> How do you name subroutine reference parameter in perl?
> Naming a local or pass by value is by simply using my ($param1, $param2)
> =
> @_ ;
> How about by reference? I think it would be harder if I'll be using
> $_[0],
> $_[1] direct method.
> Is it possible?
> 
> Thanks.
> 


Passing reference as parameter to subroutine is as easy as the normal
way.And,if u pass some types of parameter such as hash,array,or handle
to subroutine,using reference instead is more safer.
for example,such below code is right:

my (%hash,@array);
&sub_test(\%hash,[EMAIL PROTECTED]);

sub sub_test{
my ($hash_ref,$array_ref)[EMAIL PROTECTED];
my %hash=%$hash_ref;
my @[EMAIL PROTECTED];
do something...
}
-- 
  Jeff Pan
  [EMAIL PROTECTED]

-- 
http://www.fastmail.fm - IMAP accessible web-mail


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




Use of find2perl utility

2005-09-06 Thread Sastry
Hi
The perl document says that with the use of find2perl, "the resulting code 
is typically faster than running find itself" 
1) Can you tell me how it is?
2) Does it provide all the functionalities that normal 'find' utility 
provided in bash/korne shell?

Thanks in advance
Ravi Sastry


Re: hash question

2005-09-06 Thread Jeff 'japhy' Pinyan

On Sep 6, Gergely Buday said:


do you have a clue why is this not working? The interpreter complains
about a syntax error in line 7 near $myhash.


You have written '$myhash($ky)' when you meant to write '$myhash{$ky}'. 
You have also written '%myhash = { ... }' when you meant to write '%myhash 
= ( ... )'.


You've flipped your parentheses '(' and ')' with your braces '{' and '}'.


%myhash = { "alma" => "apple", "korte" => "pear" };



   print $ky, ":" , $myhash($ky), "\n";


--
Jeff "japhy" Pinyan %  How can we ever be the sold short or
RPI Acacia Brother #734 %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %-- Meister Eckhart

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




Re: UNIVERSAL class like functionality for non-OO?

2005-09-06 Thread Rex Rex
For logging, why don't you try log4perl?
 http://log4perl.sourceforge.net/
 Cheers,
Rex

 On 9/4/05, Peter Rabbitson <[EMAIL PROTECTED]> wrote: 
> 
> Hello list,
> Is there a clean and elegant way to make a subroutine available to all
> namespaces/packages? Something like the UNIVERSAL class for objects, but
> for non-OO environment. I need to embed a logging facility into a
> multimodule project, so I want to have a certain function (say log_msg()
> ) to be available anywhre in the program, without importing it in each
> and every module.
> 
> Thanks
> Peter
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
> 
> 
>


infile data

2005-09-06 Thread Tom Allison

I've been using the practice of putting something at the bottom of a
file for holding static data, like SQL, by calling a __DATA__ handle:

my $sql = join('',());



__DATA__
select .


Is there any way to do this twice?
To define two sets of static SQL?

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




Re: hash question

2005-09-06 Thread Gergely Buday
Thank you all for your answers.

- Gergely

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




How do you force SOAP::Lite to use document/literal SOAP messages?

2005-09-06 Thread David Adams
I am trying to write a simple SOAP client written in perl and to talk to a 
webservice 
written in .NET.  I am unsuccessful.  I believe the web service is expecting 
document/literal SOAP messages but I think the SOAP::Lite module sends stuff in 
RPC/encoded messages. 
 
Is there any way of telling?  Or, even better, is there a way to force the 
SOAP::Lite 
module to use document/literal messaging?
 
Since everyone like to see some code, here it is:
 
The Web Service (in .NET):


[WebMethod]
public string HelloWorld()
{
   return "Hello World";
}


The Client:
-

use SOAP::Lite;
my $soap = SOAP::Lite
-> uri('http://www.alfredbr.com')
-> on_action( sub { join '/', 'http://www.alfredbr.com', $_[1] } )
-> proxy('http://localhost/Example1/Service1.asmx');
print $soap->HelloWorld()->result;



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




Re: arbitrarily small floating point numbers

2005-09-06 Thread Jay Savage
On 9/5/05, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
> From: Jay Savage <[EMAIL PROTECTED]>
> > On 9/3/05, Sagar Nargundkar <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > I need to use small floating point numbers. Is there a perl module
> > > that allows us to use arbitrarily small floats (of the order
> > > 10^-20)? Something similar to Math::BigFloat which allows us to use
> > > arbitrarily large floats.
> > >
> > > thanks,
> > > Sagar
> >
> > Sagar,
> >
> > "Big" in BigInt and BigFloat refers to the absolute value, not
> > wherther the number is positive or negative. 10e20 and 10e-20 are both
> > equally "Big".
> 
> Erm ... no they are not. And 10e-20 is a positive number. I think
> you've mistaken it for -10e20. That's a fairly big negative number
> whose absolute value is the same as 10e20's.
> 
> In either case Math::BigFloat is just fine for numbers very close to
> zero. Besides 10e-20 is not THAT small.
> 
> Jenda
> = [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
> When it comes to wine, women and song, wizards are allowed
> to get drunk and croon as much as they like.
> -- Terry Pratchett in Sourcery
> 
> 

That's what I get for not proofreading. Yes, I meant -10e20. Although
now that I think about it, OP was probably more interested in 10e-20
anyway...

-- jay 
--
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.dpguru.com  http://www.engatiki.org

values of β will give rise to dom!


Re: naming subroutine reference parameter?

2005-09-06 Thread Dave Gray
On 9/6/05, Jayvee Vibar <[EMAIL PROTECTED]> wrote:
> How do you name subroutine reference parameter in perl?
> Naming a local or pass by value is by simply using my ($param1, $param2) =
> @_ ;
> How about by reference? I think it would be harder if I'll be using $_[0],
> $_[1] direct method.
> Is it possible?

Those are two separate questions... you can name function parameters like so:

sub myfunc {
my %args = @_;
if ($args{debug}) { print "debug!\n"; }
# ...
}
myfunc(debug => 1, foo => 'bar');

And you can pass by reference by using, er, references.

#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;

sub nosoup {
my %args = @_;
if (defined $args{soupline}
  and ref $args{soupline} eq 'HASH') {
if (defined $args{nosoupfor}) {
delete $args{soupline}{$args{nosoupfor}};
}
return $args{soupline};
} else {
  return ();
}
}
my %soupline = (fred=>1,dave=>2);
print Dumper(\%soupline);
nosoup(soupline => \%soupline, nosoupfor => 'dave');
print Dumper(\%soupline);

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




Re: infile data

2005-09-06 Thread Matija Papec

Tom Allison wrote:

I've been using the practice of putting something at the bottom of a
file for holding static data, like SQL, by calling a __DATA__ handle:

my $sql = join('',());


#more efficient
my $sql = do { local $/;  };

check perldoc perlvar if you want to know more about $/


__DATA__
select .


Is there any way to do this twice?
To define two sets of static SQL?


I guess that you don't really want to read two times from  but to 
somehow separate text below __DATA__


(undef, my %static_sql)
  = split /#(\w+)\s+/, do { local $/;  };

use Data::Dumper;
print Dumper \%static_sql

__DATA__
#select1
select * from table1 ..

#select2
select * from table2 ..

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




Re: naming subroutine reference parameter?

2005-09-06 Thread Matija Papec
Jeff Pan wrote:

> Passing reference as parameter to subroutine is as easy as the normal
> way.And,if u pass some types of parameter such as hash,array,or handle
> to subroutine,using reference instead is more safer.
> for example,such below code is right:

It is, however it could be better.

> my (%hash,@array);
> &sub_test(\%hash,[EMAIL PROTECTED]);

& has special meaning so it should be dropped when not needing
particular special behavior.

> sub sub_test{
> my ($hash_ref,$array_ref)[EMAIL PROTECTED];

ok.

> my %hash=%$hash_ref;
> my @[EMAIL PROTECTED];

This isn't needed actually and it only makes unnecessary overhead as
keys/values are copied, so you immediately lost benefit by passing by
reference.

It's better to access them directly like,
$hash_ref->{key}
$array_ref->[0]

> do something...
> }


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




Re: How do you force SOAP::Lite to use document/literal SOAP messages?

2005-09-06 Thread Matija Papec

David Adams wrote:

I am trying to write a simple SOAP client written in perl and to talk to a webservice 
written in .NET.  I am unsuccessful.  I believe the web service is expecting 
document/literal SOAP messages but I think the SOAP::Lite module sends stuff in 
RPC/encoded messages. 
 
Is there any way of telling?  Or, even better, is there a way to force the SOAP::Lite 
module to use document/literal messaging?


There is documentation that comes with every module, always check 
documentation first.


http://search.cpan.org/~byrne/SOAP-Lite-0.60a/lib/SOAP/Lite.pm#INTEROPERABILITY


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




Sort Contents of an Array

2005-09-06 Thread Chico
I want to query three different databases and put all the data into an array
(which works fine).  Next I want to convert the timestamps in the array to
epochtime (Unix Time), then sort the array, and then convert back to
original time stamp.  Can anyone help?

Here is my script:
###Use DBI to Make Connection
use DBI;

###Use ODBC module of DBI to connect to the DB
use DBD::ODBC;

###Variable to make connection to AMER DB Server
$p2pamer = DBI->connect( "DBI:ODBC:p2pamer", "user", "password" ) or
   die( "Could not make connection to database: $DBI::errstr" );

###Variable to make connection to EMEA DB Server
$p2pemea = DBI->connect( "DBI:ODBC:p2pemea", "user", "password" ) or
   die( "Could not make connection to database: $DBI::errstr" );

###Variable to make connection to AUST-ASIA DB Server
$p2paust = DBI->connect( "DBI:ODBC:p2paust", "user", "password" ) or
   die( "Could not make connection to database: $DBI::errstr" );

###SQL Query
$query = " SELECT  EnforcementDate, SourceIP, SourcePort, DestinationIP,
DestinationPort
  FROM  enforcement
  WHERE  EnforcementDate > CONVERT(DATETIME, '20050822', 112)
AND
EnforcementProtocolID = 10
  ORDER BY  EnforcementDate";

###Put all SQL Connection variables into an array, that way you can loop
through them...
@dbh = ($p2pamer, $p2pemea, $p2paust);


###Create a variable for the output file
$file = 'c:\perl\scripts\output.txt';

###Open the output file so it can be written too
open(OUTPUT, ">$file");

###Create the data array to hold the output
@data = ;

###A loop to query each database and add the results to the @data array
foreach $dbh (@dbh)
{
$sth = $dbh -> prepare($query);
 $sth -> execute;
 while (@result = $sth->fetchrow_array())
 {
 push (@data, "@result \n");
 print "@result \n";
 }
}
print OUTPUT "@data \n";



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




RE: Just need a yes or no answer on passing a hash to a package

2005-09-06 Thread Timothy Johnson
This is exactly why it is better to use references.  When you pass arguments to 
a subroutine or package, whatever you pass is "flattened out" into one list.  
The end result is that if you pass just one array or hash, it will work, 
because when you assign it on the other end, Perl will automatically convert 
that list into a hash for you.
 
The problems start when you try to pass more than just a hash or array.  If you 
try to pass a hash and a scalar, for example, the scalar will get sucked up 
into the list, and Perl will give you a warning about assigning an odd number 
of elements to the hash.  Consider this:
 
MySub(@array1,@array2);
 
sub MySub{
   my (@array1,@array2) = @_;
}
 
In the example above, @array1 will get everything, and @array2 will be empty.
 
Hopefully this gives you a little better understanding of why it is better to 
use references when passing arrays and hashes to subroutines and packages.
 
Oh, and one more thing that will end up saving you so much time and grief:  
 
use strict;
use warnings;
 
They may seem like a pain at first, but they're the best tools you will ever 
have in keeping you from making some of the most common mistakes.

-Original Message- 
From: Luinrandir [mailto:[EMAIL PROTECTED] 
Sent: Sat 9/3/2005 12:01 AM 
To: Perl Beginners List 
Cc: 
Subject: Re: Just need a yes or no answer on passing a hash to a package



Yeah I was reading about references... A
i don't get it...
I fgured I could just breah the hash into two arrays, pass them and
reconstruct the hash in the package.. of something like that...
will read more tomorrow..maybe some sleep will make it all make 
sence!LOL
thanks
Lou



- Original Message -
From: "Chris Devers" <[EMAIL PROTECTED]>
To: "Luinrandir" <[EMAIL PROTECTED]>
Cc: "Perl Beginners List" 
Sent: Friday, September 02, 2005 8:34 PM
Subject: Re: Just need a yes or no answer on passing a hash to a package


On Fri, 2 Sep 2005, Luinrandir wrote:

> Can I pass a hash to a package?

Yes.

(Hint: passing any complex data around is generally best done with the
use of references, so that's the area you need to be studying up on.)









Re: nice low cost ISP with support for mod_perl, any suggestions

2005-09-06 Thread Wiggins d'Anconia
Adriano Ferreira wrote:
> I am on the verge of trying to deploy a small web application for
> small business. I would like to see it working  preferably under
> mod_perl. Does anyone has suggestions about possible providers with a
> good compromise between service quality and cost? As it is directed to
> small business, it won't be very demanding on bandwidth or storage and
> cannot be expensive.
> 
> Regards,
> Adriano.
> 

I have come to prefer ISPs that provide VPS (Virtual Private Servers)
accounts. This gives you far greater control over the whole
installation, essentially giving you root access. In most cases you can
install your own software and have complete control over the Apache
config.  Right now I use Westhost (http://www.westhost.net) (I am not an
employee, rep, etc. but WH is the first low cost ISP I have actually
been happy with), but there are more and more springing up. There is
also an open source VPS that some use, Westhost does not, so I might
look at one of them soon.

Good luck,

http://danconia.org

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




Re: Sort Contents of an Array

2005-09-06 Thread JupiterHost.Net



Chico wrote:

I want to query three different databases and put all the data into an array
(which works fine).  Next I want to convert the timestamps in the array to
epochtime (Unix Time), then sort the array, and then convert back to
original time stamp.  Can anyone help?


GET the EPOCH time from your query or search for modules on 
search.cpan.org for ways to transform date/times to epoch.


use strict;
use wanrings;

on your code and you will get more assistance because there are less 
likely to be simplem mistakes in your example code.


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




Re: infile data

2005-09-06 Thread John W. Krahn
Tom Allison wrote:
> I've been using the practice of putting something at the bottom of a
> file for holding static data, like SQL, by calling a __DATA__ handle:
> 
> my $sql = join('',());
> 
> 
> 
> __DATA__
> select .
> 
> 
> Is there any way to do this twice?
> To define two sets of static SQL?

You probably want the Inline::Files module.

http://search.cpan.org/~dconway/Inline-Files-0.62/


John
-- 
use Perl;
program
fulfillment

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




5.6 versus 5.8

2005-09-06 Thread Bowen, Bruce
In the file Brucesubs2.pm:
 #!/usr/bin/perl
 # somesubs.pm
 package Brucesubs2;
 use strict;
 $Brucesubs2::scr = "123";
 $Brucesubs2::lang = "000";


In the file Brucesub2.pl
#!/usr/bin/perl
# srandcall.pl
use warnings;
use strict;
use Brucesubs2;

print $Brucesubs2::lang, " and ", $Brucesubs2::scr;

The pl file works fine in 5.6 but gives "Name used only once errors when run
in 5.8.  Anyone know why?

Bruce Bowen
401-568-8315


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




Extracting data from the Properties tab of a jpeg

2005-09-06 Thread Daniel Smith
Hello all,

I was wondering if someone could shed some light on my problem.  I have over 
1000 jpeg images that need to be added to a database that we run here on 
center.  Problem is, the database folks want all of the metadata (Title, 
Subject, Keywords, Comments, Author) put into a text file for easy ingestion 
into the system.  When these images were captured, the fields in the 
'Summary' tab of the image Properties were filled out. (You know, right 
click, properties, summary)

My question is, how do I get the information out of these file fields into 
some sort of delimited file?  Any suggestions?

-Dan 


RE: Extracting data from the Properties tab of a jpeg

2005-09-06 Thread Cintron,Jose J.
You may want to take a look at the Image::Info module
(http://search.cpan.org/~gaas/Image-Info-1.16/lib/Image/Info.pm) 



+--
| José J. Cintrón - <[EMAIL PROTECTED]>
+--
-Original Message-
From: Daniel Smith [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 06, 2005 16:02
To: beginners@perl.org
Subject: Extracting data from the Properties tab of a jpeg

Hello all,

I was wondering if someone could shed some light on my problem.  I have
over 1000 jpeg images that need to be added to a database that we run
here on center.  Problem is, the database folks want all of the
metadata (Title, Subject, Keywords, Comments, Author) put into a text
file for easy ingestion into the system.  When these images were
captured, the fields in the 'Summary' tab of the image Properties were
filled out. (You know, right click, properties, summary)

My question is, how do I get the information out of these file fields
into some sort of delimited file?  Any suggestions?

-Dan 

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




Re: Extracting data from the Properties tab of a jpeg

2005-09-06 Thread Jay Savage
On 9/6/05, Daniel Smith <[EMAIL PROTECTED]> wrote:
> Hello all,
> 
> I was wondering if someone could shed some light on my problem.  I have over
> 1000 jpeg images that need to be added to a database that we run here on
> center.  Problem is, the database folks want all of the metadata (Title,
> Subject, Keywords, Comments, Author) put into a text file for easy ingestion
> into the system.  When these images were captured, the fields in the
> 'Summary' tab of the image Properties were filled out. (You know, right
> click, properties, summary)
> 
> My question is, how do I get the information out of these file fields into
> some sort of delimited file?  Any suggestions?
> 
> -Dan
> 
> 

No, I don't think we do know. In what program? Or is this "Properties"
or "Get Info" information that some OSs and GUIs maintain? If so,
which OS or GUI? If you're looking for information that's part of the
JPEG itself, do a cpan search for EXIF. using EXIF fields is the
normal way of embedding information in JPEGs. If yu're looking for
system information, search for an appropriate module for your system.

For embedded info, Image::EXIF, Image::ExifTool and JPEG::JFIF might
be good places to start. For OS issues find the appropriate module for
your OS. For me it would be MacOSX::File::Info, others might need
Win32::something-or-other. For you, who knows? searching cpan is
pretty simple.

In the future, please give us enough information to help you, and read
the FAQ about showing us code you've tried that hasn't worked. CPAN
has it's own search engine; this list isn't it.

HTH,

-- jay
--
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.dpguru.com  http://www.engatiki.org

values of β will give rise to dom!


RE: Unable to use XML module

2005-09-06 Thread Brian Volk
See bottom... 

-Original Message-
From: Cristi Ocolisan [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 06, 2005 6:48 AM
To: beginners@perl.org
Subject: RE: Unable to use XML module

Try install XML-Simple

Co

-Original Message-
From: Nath, Alok (STSD) [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 05, 2005 10:14 AM
To: Charles K. Clarkson; Xavier Noria
Cc: Perl Beginners List
Subject: RE: Unable to use XML module

When I say ppm>install XML::Simple 
It gives this error 
..
Error: No valid repositories:
Error: 500 Can't connect to ppm.ActiveState.com:80 (connect: Unknown
error)
Error: 500 Can't connect to ppm.ActiveState.com:80 (connect: Unknown
error)



-Original Message-
From: Charles K. Clarkson [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 05, 2005 12:38 PM
To: 'Perl Beginners List'
Subject: RE: Unable to use XML module

Nath, Alok (STSD)  wrote:

:   Error :
:   Can't locate XML/Simple.pm in @INC (@INC contains:
: C:/PROGRA~1/MKSTOO~1/etc/perl
:   /lib C:/PROGRA~1/MKSTOO~1/etc/perl/lib
: C:/PROGRA~1/MKSTOO~1/etc/perl/lib/site_pe
:   rl .) at XMLRead.pl line 3.
:   BEGIN failed--compilation aborted at XMLRead.pl line 3.
: 
:   Pls suggest me how to get rid of this ?


Did you install XML::Simple on your system?

HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328


I just ran "install XML-Simple" from the Perl Package Manager that comes w/
ActiveState Perl...  XML-Simple comes preinstalled w/ the latest version,
So maybe installing the latest version of ActiveState might solve your
problems.

Hope this helps.

Brian 


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




Re: infile data

2005-09-06 Thread Tom Allison

Matija Papec wrote:

Tom Allison wrote:


I've been using the practice of putting something at the bottom of a
file for holding static data, like SQL, by calling a __DATA__ handle:

my $sql = join('',());



#more efficient
my $sql = do { local $/;  };

check perldoc perlvar if you want to know more about $/


__DATA__
select .


Is there any way to do this twice?
To define two sets of static SQL?



I guess that you don't really want to read two times from  but to 
somehow separate text below __DATA__


(undef, my %static_sql)
  = split /#(\w+)\s+/, do { local $/;  };

use Data::Dumper;
print Dumper \%static_sql

__DATA__
#select1
select * from table1 ..

#select2
select * from table2 ..



I ended up with something like:
my $string = join('',());
my ($sql1, $sql2) = split(/\nn\n/sm, $string);

But I like the $/ idea.

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




Re: infile data

2005-09-06 Thread John W. Krahn
Tom Allison wrote:
> Matija Papec wrote:
>> Tom Allison wrote:
>>
>>> I've been using the practice of putting something at the bottom of a
>>> file for holding static data, like SQL, by calling a __DATA__ handle:
>>>
>>> my $sql = join('',());
>>
>> #more efficient
>> my $sql = do { local $/;  };
>>
>> check perldoc perlvar if you want to know more about $/
>>
>>> __DATA__
>>> select .
>>>
>>>
>>> Is there any way to do this twice?
>>> To define two sets of static SQL?
>>
>>
>> I guess that you don't really want to read two times from  but
>> to somehow separate text below __DATA__
>>
>> (undef, my %static_sql)
>>   = split /#(\w+)\s+/, do { local $/;  };
>>
>> use Data::Dumper;
>> print Dumper \%static_sql
>>
>> __DATA__
>> #select1
>> select * from table1 ..
>>
>> #select2
>> select * from table2 ..
> 
> I ended up with something like:
> my $string = join('',());
> my ($sql1, $sql2) = split(/\nn\n/sm, $string);
^
You probably meant /\n\n/.


> But I like the $/ idea.

You could set $/ to paragraph mode:

my ( $sql1, $sql2 ) = do { local $/ = '';  };



John
-- 
use Perl;
program
fulfillment

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




Substitution problem

2005-09-06 Thread Moon, John
Does any one know how to do this with just a substitution?

perl -e '$a=q{Data.m1234.D1234567890};
$a =~/\d+$/;
$numbers = q{#} x length($&);
$a=~ s/\d+$/$numbers/; print "$a\n";'

What " Data.m1234.D## " as a result.

John W Moon

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




RE: Substitution problem

2005-09-06 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Moon, John wrote:
> Does any one know how to do this with just a substitution?
> 
> perl -e '$a=q{Data.m1234.D1234567890};
>   $a =~/\d+$/;
>   $numbers = q{#} x length($&);
>   $a=~ s/\d+$/$numbers/; print "$a\n";'
> 
> What " Data.m1234.D## " as a result.
> 
> John W Moon

Did the following:
perl -e '$a=q{Data.m1234.D1234567890};
$a =~ s/(\d+)$/'#'x length($1)/e;
print "$a\n";
output was:
Data.m1234.D##

Wags ;)


***
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
***


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




Re: Substitution problem

2005-09-06 Thread John W. Krahn
Moon, John wrote:
> Does any one know how to do this with just a substitution?
> 
> perl -e '$a=q{Data.m1234.D1234567890};
>   $a =~/\d+$/;
>   $numbers = q{#} x length($&);
>   $a=~ s/\d+$/$numbers/; print "$a\n";'
> 
> What " Data.m1234.D## " as a result.

$ perl -le'$_ = q{Data.m1234.D1234567890};
s/(\d+)$/ "#" x length $1 /e;
print;
'
Data.m1234.D##


$ perl -le'$_ = q{Data.m1234.D1234567890}; 1 while s/\d(#*)$/#$1/; print'
Data.m1234.D##


$ perl -le'$_ = q{Data.m1234.D1234567890}; 1 while s/\d(?=#*$)/#/; print'
Data.m1234.D##


$ perl -le'$_ = q{Data.m1234.D1234567890}; s/\d(?=\d+$|$)/#/g; print'
Data.m1234.D##



John
-- 
use Perl;
program
fulfillment

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




Re: infile data

2005-09-06 Thread Tom Allison

>> I ended up with something like:
>> my $string = join('',());
>> my ($sql1, $sql2) = split(/\nn\n/sm, $string);
>^
>You probably meant /\n\n/.
Yes, thanks
>
>
>> But I like the $/ idea.
>
>You could set $/ to paragraph mode:
>
>my ( $sql1, $sql2 ) = do { local $/ = '';  };
>

Could I also do:
my ($sql1, $sql2) = do { local $/ = '\n\n'; );
??

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




Re: infile data

2005-09-06 Thread John W. Krahn
Tom Allison wrote:
>>>I ended up with something like:
>>>my $string = join('',());
>>>my ($sql1, $sql2) = split(/\nn\n/sm, $string);
>>   ^
>>You probably meant /\n\n/.
> Yes, thanks
>>
>>>But I like the $/ idea.
>>You could set $/ to paragraph mode:
>>
>>my ( $sql1, $sql2 ) = do { local $/ = '';  };
> 
> Could I also do:
> my ($sql1, $sql2) = do { local $/ = '\n\n'; );
> ??

Yes that will work if you have exactly two newlines between each paragraph
while "$/ = '';" will work for any number of newlines between paragraphs.


John
-- 
use Perl;
program
fulfillment

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




Re: Substitution problem

2005-09-06 Thread John W. Krahn
John W. Krahn wrote:
> Moon, John wrote:
>>Does any one know how to do this with just a substitution?
>>
>>perl -e '$a=q{Data.m1234.D1234567890};
>>  $a =~/\d+$/;
>>  $numbers = q{#} x length($&);
>>  $a=~ s/\d+$/$numbers/; print "$a\n";'
>>
>>What " Data.m1234.D## " as a result.
> 
> $ perl -le'$_ = q{Data.m1234.D1234567890};
> s/(\d+)$/ "#" x length $1 /e;
> print;
> '
> Data.m1234.D##
> 
> $ perl -le'$_ = q{Data.m1234.D1234567890}; 1 while s/\d(#*)$/#$1/; print'
> Data.m1234.D##
> 
> $ perl -le'$_ = q{Data.m1234.D1234567890}; 1 while s/\d(?=#*$)/#/; print'
> Data.m1234.D##
> 
> $ perl -le'$_ = q{Data.m1234.D1234567890}; s/\d(?=\d+$|$)/#/g; print'
> Data.m1234.D##

$ perl -le'$_ = q{Data.m1234.D1234567890}; s/\d(?=\d*$)/#/g; print'
Data.m1234.D##


John
-- 
use Perl;
program
fulfillment

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




Re: Extracting data from the Properties tab of a jpeg

2005-09-06 Thread Chris Devers
On Tue, 6 Sep 2005, Daniel Smith wrote:

> My question is, how do I get the information out of these file fields 
> into some sort of delimited file?  Any suggestions?

Your question is "how do I poke at the EXIF data in a JPEG image"?

JPEGs store metadata -- file size, file date, camera make, camera model, 
date & time, resolution (width x height), whether a flash was used, 
focal length (mm), exposure time, aperture (f/stop), ISO speed, etc -- 
in a section called the EXIF header. 

You're looking for a way to access this data. Try a CPAN search:

http://search.cpan.org/search?query=EXIF&mode=all

This is the first hit:

http://search.cpan.org/~ccpro/Image-EXIF-1.00.3/EXIF.pm

As noted in another reply, you can also use Image::Info for a more 
generic version of the same information:

http://search.cpan.org/~gaas/Image-Info-1.16/lib/Image/Info.pm

And as another person noted, it helps to know what platform you're 
talking about. On POSIXy systems (Linux, OSX, Solaris, BSD, etc), the 
`jhead` command line tool provides quick access to EXIF data:

$ jhead ~/south_tower_invisible_beyond_fog.jpg 
File name: /Users/cdevers/south_tower_invisible_beyond_fog.jpg
File size: 859667 bytes
File date: 2005:07:17 13:40:20
Camera make  : OLYMPUS OPTICAL CO.,LTD
Camera model : X-2,C-50Z   
Date/Time: 2005:07:17 02:49:30
Resolution   : 1920 x 2560
Flash used   : No
Focal length :  7.8mm
Exposure time: 0.0031 s  (1/320)
Aperture : f/5.6
ISO equiv.   : 80
Whitebalance : Auto
Metering Mode: matrix
Exposure : Creative Program (based towards depth of field
$

Etc. Image::Exif will let you examine the same data in a Perl script.



-- 
Chris Devers

xIÕ¼¡.‡þC
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


Re: naming subroutine reference parameter?

2005-09-06 Thread Jeff Pan

> > my (%hash,@array);
> > &sub_test(\%hash,[EMAIL PROTECTED]);
> 
> & has special meaning so it should be dropped when not needing
> particular special behavior.

I can't understand for this,can u give me some examples?


> > my %hash=%$hash_ref;
> > my @[EMAIL PROTECTED];
> 
> This isn't needed actually and it only makes unnecessary overhead as
> keys/values are copied, so you immediately lost benefit by passing by
> reference.
> 
> It's better to access them directly like,
> $hash_ref->{key}
> $array_ref->[0]
> 
> > do something...
> > }

This point is great,thank u.
-- 
  Jeff Pan
  [EMAIL PROTECTED]

-- 
http://www.fastmail.fm - I mean, what is it about a decent email service?


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




Perl and Unix/Linux Tutorials

2005-09-06 Thread Mark Sargent

Hi All,

can anyone point me to some sites(tutorials) that deal with Perl and 
Linux(Unix) admin stuff.? I'm hoping to use Perl for just that, as 
opposed to Web stuff etc. I've been following this tutorial, 
http://www.codebits.com/p5be/ which is great. Certainly well written for 
a newbie. Also, are there any books written specifically with Unix/Linux 
admin in mind.? Cheers.


Mark Sargent.

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