Re: One Finder and one iTunes Question?
Re: One Finder and one iTunes Question?
- Subject: Re: One Finder and one iTunes Question?
- From: Skeeve <email@hidden>
- Date: Tue, 08 Apr 2008 23:12:42 +0200
Doug... Are you sure about what you're doing?
> set theCommand to ("perl -e '
> local $/ = undef;
> my $s = <>;
1. no need to set $/ to undef if you local-ised it
2. too broad a scope for the local-ised $/
3. too much memory consumption
my libryry.xml has 34.444.570byte. You read ALL OF THEM to find some
bytes early at the start of the file.
> while ($s=~m|<key>Music Folder</key><string>(.*?)</string>|sg)
4. You read an XML file without using a Module (the perl monk mantra)
4a. You don't care for XML but treat it as pure text. Better would be:
m|<key\b[^>]*>Music Folder</key><string\b[^>]*>%[^<]+</string>|sg;
> {$v = $1;$v =~ s/\\%([a-fA-F0-9]{2,2})/chr(hex($1))/seg;
(minor "problems") % needs no \, {2} is the same as {2,2}, [a-fA-F0-9]
can be shortened:
s/%([a-f\d]{2})/pack 'H2',$1/sieg; (I prefer pack over chr hex)
>$v =~ s|file://localhost||;print $v;}'
5. You don't care that it's at the start of the string:
6. You don't car for localhost being followed by /. What if it were
file:///localhostserver/ ;-)
s|^file://localhost(?=/)|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden