Guest User

Untitled

a guest
Aug 16th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. error while using perl template toolkit
  2. $var1={
  3. 'Object'=>[
  4. {
  5. 'Component'=>[
  6. {
  7. 'type'=>'analog',
  8. 'name'=>'Temp',
  9. 'value'=>'23'
  10. },
  11. {
  12. 'type'=>'digital',
  13. 'name'=>'Temp',
  14. 'value'=>'22'
  15. },
  16. {
  17. 'type'=>'analog',
  18. 'name'=>'pressure',
  19. 'value'=>'23'
  20. },
  21. {
  22. 'type'=>'analog',
  23. 'name'=>'humidity',
  24. 'value'=>'23'
  25. }
  26. ]
  27. }
  28. ],
  29. };
  30.  
  31. [% FOREACH st IN Object %]
  32. [% FOREACH st IN Object.Component %]
  33. [% Component.type %][% Component.name %][% Component.value %]
  34. [% END %]
  35. [% END %]
  36.  
  37. [% FOREACH obj IN Object %]
  38. [% FOREACH comp IN obj.Component %]
  39. [% comp.type %] [% comp.name %] [% comp.value %]
  40. [% END %]
  41. [% END %]
  42.  
  43. my $template = Template->new(
  44. {
  45. STRICT => 1, #Β or
  46. DEBUG => 'undef'
  47. });
  48.  
  49. [% FOREACH obj in Object %]
  50. [% FOREACH item in obj.Component %]
  51. [% obj.type %] [% obj.name %] [% obj.value %]
  52. [% END %]
  53. [% END %]
Add Comment
Please, Sign In to add comment